#dev-contrib
1 messages ยท Page 140 of 1
Isn't that useless unless you have server to follow messages into?
I guess
I use it in a number of servers just to get the announcements I'm interested in without notifications of other messages
Ya bro Ik about following announcement channel Thanks a lot ๐
For notifications you can also enable all messages in announcement channels, but I canโt remember how it works for mobile push notifs
Iโve been on DnD for months
If someone has an android, can they confirm whether this link works
I'm on android atm and it works for me
The above one's don't, but that does
So I guess adding a / fixes it
Wait nvm it doesn't work lol
Should I try to confirm
I can easily open it
Nope don't work
@gritty wind remove the slash and it works
It breaks without it, see above
The fuck
Wait, just read dev announcements, does this mean @viscid badge is getting the boot?
I get that it doesn't have an article for that
Which one?
No, metricity is still a separate service. This just allows for starting up metricity with bot like how you would start up site
Ah
Ah
So you can actually use metricity for features if you do
Yea ๐ and also means you don't need to manually run some SQL to work with anything related to metricity in dev
EG voice verification would error previously, since metricity relations just didn't exist
Can I add rock paper scissors to @dusky shore
I think it is already there
And also a new tag to @stable mountain
Unable to convert 'rps' to valid command, tag, or Cog.
A new one
A new tag?
And Can you also tell me what the new tag should be related to
Yeah you can create an issue for the tag you have in mind, and if it gets approved you can work on making a PR for it
What's PR
A Pull Request. It is for adding things to a GitHub repo that allows people to review the code you want to add
Ahh I used ! instead of . for the rock paper scissors
.src rps
There are quite a few games on sir-lancebot, do you want to check them out?
Head over to #sir-lancebot-playground and type in .help . That will give you a list with a few of the things that sir-lancebot can do
Okie
I got one idea for @dusky shore
Np if it's not a game idea but it's cool ๐
Feel free to share the idea, though you donโt have to come up with your own idea to contribute.
You can check out our issue tracker which has a lot of issues you can take.
These issues specifically are good for beginners:
Wdym Can I not make a tag or Game for @dusky shore
I mean something more
Like a good command on my own
You absolutely can, just have to fill out the issue form template with the relevant information

Ok, so yeah you can make both. If you want to make a command for sir lance bot, you can share your idea here, or pick one of the existing ideas.
For tags, you can suggest them in #community-meta
I mean I want to make a new command on my own idea
Thatโs fine, share your idea here
So my idea is that
I want to create a Coin flip command that will just give a random input as Head or tails
Ik it's simple ๐คท but still interesting or something like a role dice command
Sure, thatโs not a bad idea. Could you create an โissueโ on tracker?
That way we can assign you, and know whoโs working on what.
https://github.com/python-discord/sir-lancebot/issues
Should see a button at the top of this page

site#594 could use reviews! I've got some changes to make so make sure you look at bluenixes review first please
So it's ready for review or do changes need to be made first?
Ready for review but I haven't done what bluenix has asked in his review yet
Hey, api#17 could also use some reviews. The models were generated based on the current schema, so it needs a lot of thorough reviews to spot possible mistakes. ๐
(It's quite an easy PR to review, regardless ๐ )
Man whoever made .reverse messed up, can't even reverse aibohphobia \s
Okay ๐
!remind 15h ^
Your reminder will arrive on <t:1632818613:F>!
WOW
@celest charm @tawdry vapor apparently, pip install . will install the bot just fine
so poetry isn't even needed for the dockerfile
nor is a requirements.txt file needed
the only problem that there is with that situation that its not easily possible to install the dependencies before copying over the source code
which can be extremely annoying for any developer
the way I am attempting to get around that, is to copy the minimally required dependencies into the container
installing it, copying the rest, and installing it again
although what I will probably do is the requirements.txt thing lol
@thorny obsidian RE sir-lancebot#861 would it be better to just remove the hacktoberfest cog completely if we're no longer going to participate in it?
No, people did put work into the cog and there's no reason to remove it. It's still useful outside of this server's participation in hacktoberfest
@commands.group()
async def hacktoberfest(self, ctx: Context):
"""Group which contains the `timeleft` subcommand."""
pass
@hacktoberfest.command()
async def timeleft(self, ctx: Context):
...```is the kind of thing you were envisioning? @thorny obsidian
Or did we want to change this around and have everything under hacktoberfest like so?```py
@commands.group()
async def hacktoberfest(self, ctx: Context):
...
@hacktoberfest.command()
async def timeleft(...):
...
@hacktoberfest.group(...)
async def stats(...):
...
@stats.command()
async def link_user(...):
...
...
@hacktoberfest.group(...)
async def issues(...):
...```
If you can even have nested subcommands like that in dpy (I believe you can)
That's gonna be rather big for one file but I guess it could still be organised into multiple files if we import stuff (perhaps that's bad though)
yes
I doubt pip supports Poetry's custom lockfile format. And the lockfile is the main point of using Poetry. Do you really mean that it can install all locked dependencies?
!pep 517
๐
I think so
what happens is pip installs poetry-core as a build dependency before installing the project
!pypi poetry-core
that's what this is
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
In order to improve the above situation, poetry-core was created. Shared functionality pertaining to PEP 517 build backends, including reading lock file, pyproject.toml and building wheel/sdist, were implemented in this package. This makes PEP 517 builds extremely fast for Poetry managed packages.
tldr yes
That's not a bad idea, imo! You should open an issue about it on Sir Lancebot!
now, the problem is this:
# Copy the source code in
COPY . .
# install the full package
RUN pip install .
it is not possible to install the package without the source files already being copied
trying to install with just poetry.lock and pyproject.toml results in some issues
lemme uh
oof
that's going to be a bit harder to add , given that support for all user provided images was removed
I would still make an issue, but given that, it may be rejected, since it repeats a user's content
this is the issue I get when using the below in my dockerfile:
ValueError: /modmail/modmail does not contain any element
file:
# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./
# Install dependencies and project
RUN pip install . --use-feature=in-tree-build
# Copy the source code in last to optimize rebuilding the image
COPY . .
Wait I'm confused by what you mean by "user provided images"?
That's because the build system expects a library at modmail/modmail, but the source code wasn't copied yet
Don't we still have the avatar commands?
Yeah and .rotate <image/message/attachment> would make someone quite clearly aware of it no?
like i said, i would still make the issue
Oh yeah for sure, that goes for anything added.
and then we can discuss it there where its on the record
Only profile pictures please, no attachments
We don't trust users enough to process and random images
May I ask the difference? Someone could still easily upload rule-breaking images as their profile pictures
Having the bot parrot back an arbitrary image is quite different from setting it as your profile picture
Profile picture changes are also heavily ratelimited
i believe its more for the client breaker files
and spam prevention
beside, other communities and Discord T&S are also moderating profile pictures
!remind 11M continue pep 517 discussion
Your reminder will arrive on <t:1632775481:F>!
Yeah that was one argument I could come up with
We don't have any good way to moderate arbitrary images posted and we don't really want the bot to parrot back something offensive when it could be missed by the mod team
however, i do agree that the command itself is useful
Can't we force some guidelines on it though?
like, its a nice concept
but maybe its not useful here, and would be easier to rotate an image manually
I mean, we have our code of conduct. We still have to enforce it
Like only being involved in the same channel and some X messages?
helpers+ imo
Or just... have the person you're trying to help not post a screenshot of the code?
That way, if another user uploads some rule-breaking content and it is found by the moderation team that means that the bot's parrot will also easily be seen.
I mean at this point you may as well be clicking the rotate button on your device gallery
I am pretty confident that the only files sent here are not just screenshots, lol
That sounds like a lot of complexity for a minimal benefit (if there's any at all)
I'm referring to the proposed use case of this command
My biggest worry would be CSAM because we would download the image
@thorny obsidian this is the proposed use, I don't see anything about code screenshots?
that is also not code, so I'm not sure where you got that idea from, kutiekatj9
I presumed it was for help channels and the most prevalent use case there is screenshots of code
I do think there is a concern there, this would most likely be adopted for that as well
Do you just want to use pydis as a service to rotate random icons then? 
The use case seems to be exactly what @thorny obsidian just mentioned
Here's your reminder: continue pep 517 discussion
[Jump back to when you created the reminder](#dev-contrib message)
Either way, yeah, we won't be implementing it. Sorry, but it is without user input or nothing.
a solution I've come across for this is to copy the modmail/__init__.py and required README.md file since they're required for build here: https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L8
https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L13
I would like to point out that while I am not actually referencing a pydis project in these code snippets, the function is exactly the same.
pyproject.toml line 8
readme = "README.md"```
`pyproject.toml` line 13
```toml
packages = [{ include = "modmail" }]```
that ends up looking something like this:
# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./
COPY modmail/__init__.py ./modmail/
COPY README.md .
# Install dependencies and project
RUN pip install . --use-feature=in-tree-build
# Copy the source code in last to optimize rebuilding the image
COPY . .
# install the full package
RUN pip install . --no-deps --force
while its not best, this means that it will install all of the dependencies, then install the code
What is this important?
tldr this is all linked to this issue #dev-contrib message
If the current implementation is such a problem, why not just use Poetry's custom installer? Or one of the other alternative installation methods?
Or just add poetry as a dependency
that's explained here
that's explained up there, as being a bit of a hack
So...
there's several different solutions here. One way is to use requirements.txt
- export deps # as ci or in docker
this means either maintaining a generated requirements.txt file or creating it every docker container
then we can just pip install -r requirements.txt and then copy the source files over.
the other way is to just do pip install .
However, this comes with a major drawback, the dependencies will be installed every time the docker container is created since the source code has to be copied before running pip install .
Don't both of those methods ignore the concept of a lockfile?
no, the requirements.txt is exported as pinned versions, and pip install . uses pep517, as explained starting here #dev-contrib message
@brisk brook what do you think of this for disabling insteadof just editing it out?
I think that is what I am talking about yeah
alright, it's pushed
This is when you disable them correct?
Yep
Tbh should the kata button be disabled?
It's a link, I don't see a reason to turn off a link
Don't we need to disable the whole view after 3 minutes though?
Links are different :P
ah wait a link button is not aninteraction
You have it in the embed title so I don't think it's a big problem
Ah, ok
I would maybe look weird if some buttons were disabled but not others
IMO removing any way to click a link is worse than the wonkiness of one button enabled and the rest disabled
Buuut it's in the title so
@brisk brook RE running sir-lancebot on v2.0, I get open C:\Users\tizzy\sir-lancebot\.env: The system cannot find the file specified. each time I try to rebuild
Same error for running, although I did find a way around that but then get an error because the dpy version used is 1.7.x and so Thread stuff stops execution
I suppose thinking about it, I should try with just an empty .env
yes, you need one
Yeah I've heard about that
C:\Users\tizzy\sir-lancebot>docker-compose run sir-lancebot
[+] Running 7/7
...
Error response from daemon: driver failed programming external connectivity on endpoint sir-lancebot_redis_1 (20d06b00d3db2f0d3c3b95ee8d4d75b9af7270b248cb8fbe3dc8cb9bc9839320): Bind for 127.0.0.1:6379 failed: port is already allocated```new one now
Same for docker-compose up
@brisk brook @green oriole ^
๐ค
docker ps?
you never docker-compose down
huh
Right, let's try again
How do I configure my bot token again?
Hopefully the same as with bot
Your reminder will arrive on <t:1632782034:F>!
The commands suggestions when an invalid command is sent on @dusky shore is different for .invalid_command and .help invalid_command (since they use different methods to find similar commands). Is this something we want to change to be consistent?
There's an example on my PR comment regarding this: https://github.com/python-discord/sir-lancebot/pull/884#issuecomment-928315087
since it all got split up I'm reposting this so all of the information is together
14:05] arl: @ fix error#1642 @ Mark#3118 โฆ๏ธ apparently, pip install . will install the bot just fine
[14:05] arl: so poetry isn't even needed for the dockerfile
[14:05] arl: nor is a requirements.txt file needed
[14:07] arl: the only problem that there is with that situation that its not easily possible to install the dependencies before copying over the source code
[14:11] arl: which can be extremely annoying for any developer
[14:11] arl: the way I am attempting to get around that, is to copy the minimally required dependencies into the container
[14:12] arl: installing it, copying the rest, and installing it again
[14:12] arl: although what I will probably do is the requirements.txt thing lol
[16:16] Mark โฆ๏ธ: I doubt pip supports Poetry's custom lockfile format. And the lockfile is the main point of using Poetry. Do you really mean that it can install all locked dependencies?
16:18] arl: what happens is pip installs poetry-core as a build dependency before installing the project
!pypi poetry-core
This snippet from pyproject.toml is the pep517 backend which is supported by the above.
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
As mentioned in the above package's readme:
In order to improve the above situation, poetry-core was created. Shared functionality pertaining to PEP 517 build backends, including reading lock file, pyproject.toml and building wheel/sdist, were implemented in this package. This makes PEP 517 builds extremely fast for Poetry managed packages.
now, the problem is the best way to install
This is not possible:
# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./
# Install dependencies and project
RUN pip install . --use-feature=in-tree-build
# Copy the source code in last to optimize rebuilding the image
COPY . .
it is not possible to install the package without the source files already being copied
Running the above in a dockerfile results in this error:
ValueError: /modmail/modmail does not contain any element
This dockerfile is intentional to not have to reinstall all dependencies when any code is edited. If so, docker development would not be too feasible.
However, there's a few solutions I've discovered for how to not have to reinstall all packages.
Solution A: double install
A solution I've come across for this is to copy the modmail/__init__.py and required README.md file since they're required for build here: https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L8
https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L13
Then installing the library, copying the source code, and then installing the code again with pip, but with the --no-deps flag since we've already installed the dependencies.
Solution B: requirements.txt
Either by maintaining an autogenerated requirements.txt file checked in to the repo by poetry export or by generating a requirements.txt file by copying the necessary files of poetry.lock and pyproject.toml in the container and then running pip install -r requirements.txt
Either way, we have a requirements.txt file in the docker container, and it gets installed before the source code is copied.
Note, I know these examples are from my bot, but the same concepts and snippets apply to pydis and the dockerfiles for pydis
pyproject.toml line 8
readme = "README.md"```
`pyproject.toml` line 13
```toml
packages = [{ include = "modmail" }]```
This is an entire summary of everything I brought up earlier, but there is some additional information which is the two possible solutions
subjective opinion:
Update: For my own project, I've opted to go with an autogenerated requirements.txt file checked in to the repository with a manual pre-commit hook ran by default on github actions only, manual locally but with a taskipy shortcut task. This ensures that the requirements.txt file will always be up to date, but won't run on every commit with an edited pyproject.toml file since locking can take some time, and isn't super fast. If pydis chooses to go this same route, I can share the hook code that I'll be writing to check if the requirements.txt file is changed ๐
However, I am choosing solution b for my own project since I require a requirements.txt file for a different purpose
I actually favour solution A
Hey all, in regards to sir-lancebot#859 I am trying to use asyncio to create a scheduled task. For debug and testing I have it set to 1 minute, but I keep getting this error:
sir-lancebot | 09/28/21 03:34:31 - bot.exts.utilities.wtf_python DEBUG: self.last_fetched = datetime.datetime(2021, 9, 28, 3, 34, 31, 572890)
sir-lancebot | Traceback (most recent call last):
sir-lancebot | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 672, in _load_from_module_spec
sir-lancebot | setup(self)
sir-lancebot | File "/bot/bot/exts/utilities/wtf_python.py", line 121, in setup
sir-lancebot | bot.add_cog(WTFPython(bot))
sir-lancebot | File "/bot/bot/exts/utilities/wtf_python.py", line 46, in __init__
sir-lancebot | asyncio.create_task(self.fetch_readme())
sir-lancebot | File "/usr/local/lib/python3.9/asyncio/tasks.py", line 360, in create_task
sir-lancebot | loop = events.get_running_loop()
sir-lancebot | RuntimeError: no running event loop
sir-lancebot | The above exception was the direct cause of the following exception:
sir-lancebot |
sir-lancebot | Traceback (most recent call last):
sir-lancebot | File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
sir-lancebot | return _run_code(code, main_globals, None,
sir-lancebot | File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
sir-lancebot | exec(code, run_globals)
sir-lancebot | File "/bot/bot/__main__.py", line 31, in <module>
sir-lancebot | bot.load_extension(ext)
sir-lancebot | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 732, in load_extension
sir-lancebot | self._load_from_module_spec(spec, name)
sir-lancebot | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 677, in _load_from_module_spec
sir-lancebot | raise errors.ExtensionFailed(key, e) from e
sir-lancebot | discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.utilities.wtf_python' raised an error: RuntimeError: no running event loop
sir-lancebot | sys:1: RuntimeWarning: coroutine 'WTFPython.fetch_readme' was never awaited
The code in question is this code block:
...
class WTFPython(commands.Cog):
"""Cog that allows getting WTF Python entries from the WTF Python repository."""
def __init__(self, bot: Bot):
self.bot = bot
self.headers: dict[str, str] = dict()
self.last_fetched = datetime.datetime.now()
log.debug(f"{self.last_fetched = }")
asyncio.create_task(self.fetch_readme())
async def fetch_readme(self) -> None:
"""Gets the content of README.md from the WTF Python Repository."""
refresh = self.last_fetched + datetime.timedelta(minutes=README_REFRESH)
if refresh > datetime.datetime.now() and self.headers:
return # cache should be up-to-date
async with self.bot.http_session.get(f"{WTF_PYTHON_RAW_URL}README.md") as resp:
log.trace("Fetching the latest WTF Python README.md")
if resp.status == 200:
raw = await resp.text()
self.parse_readme(raw)
...
!d discord.ext.tasks @dim pelican
Oh because it's greedy
Uh
Well tldr you need to use it in the cog creation
One minute
Down here?
def setup(bot: Bot) -> None:
"""Load the WTFPython Cog."""
bot.add_cog(WTFPython(bot))
I'm on mobile but uh
Tldr you don't use asyncio to create a task, you use the bot method
Or use the method decorator
Added the tasks import and the decorator:
from discord.ext import commands, tasks
...
@tasks.loop(minutes=README_REFRESH)
async def fetch_readme(self) -> None:
Now get this:
sir-lancebot | sys:1: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
you need self.fetch_readme.start() in the __init__ function
Alright, removed the decorator and added the .start(), now getting this:
AttributeError: 'function' object has no attribute 'start'
Added the decorator back, and have this:
sir-lancebot | sys:1: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
you need both
class WTFPython(commands.Cog):
"""Cog that allows getting WTF Python entries from the WTF Python repository."""
def __init__(self, bot: Bot):
self.bot = bot
self.headers: dict[str, str] = dict()
self.last_fetched = datetime.datetime.now()
log.debug(f"{self.last_fetched = }")
asyncio.create_task(self.fetch_readme())
self.fetch_readme.start()
@tasks.loop(minutes=README_REFRESH)
async def fetch_readme(self) -> None:
- asyncio.create_task(self.fetch_readme())
Get rid of that?
ye
wild shit man
its explained here
minimal example:
import asyncpg
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.data = []
self.batch_update.add_exception_type(asyncpg.PostgresConnectionError)
self.batch_update.start()
def cog_unload(self):
self.batch_update.cancel()
@tasks.loop(minutes=5.0)
async def batch_update(self):
async with self.bot.pool.acquire() as con:
# batch update here...
pass
also yes
you need to add self.fetch_readme.cancel() to WTFPython.cog_unload()
I was trying to follow this btw: https://github.com/python-discord/sir-lancebot/pull/859#discussion_r715954775
I uhh, don't unload the cog anywhere lol
def cog_unload(self):
self.fetch_readme.cancel()
you add that anyways
even if you don't unload it
that means that someone unloading the cog from the bot will not actually remove that fetch request
and it will forever continue until the bot is kilt
๐ I have a lot to learn about this async magic
part of this is just discord.py
Also, thanks a bunch!
np
The command suggestions when an invalid command is sent on @dusky shore is different for .invalid_command and .help invalid_command (since they use different methods to find similar commands). Is this something we want to change to be consistent?
There's an example on my PR comment regarding this: https://github.com/python-discord/sir-lancebot/pull/884#issuecomment-928315087
yeah, sure
Here's your reminder: ^
[Jump back to when you created the reminder](#dev-contrib message)
Okay, that then raises the question of which method do we want to use -- difflib.get_close_matches, or rapidfuzz.process.extract?
Using rapidfuzz seems to need less code
most probably rapidfuzzy
Yeah, okay. I'll change .invalid_command to use rapidfuzz.process.extract then. Perhaps making a util since it's used twice?
sounds like a good idea
I suppose a different PR since it's not related to .help anymore
It's fine, I won't sue you for this
What permissions would I be granting to policy bot by accepting this? I'm not 100% certain what it does or is for.
I just mean "act on your behalf" seems a bit broad.
Well bunch of stuff but it doesn't actually use any of that
Act on your behalf is a catch all iirc, it will show up if one of many perm flags are set
Alright ยฏ_(ใ)_/ยฏ
If this is for pydis projects, I donโt think you need to accept this
(Maybe to see the actual website, but thats just it iirc)
You need it to see the website for whatever reason
Hey how long before I can nag someone for re reviewing my PR ?
Depends on the someone ๐ which one do you want a look at?
Sure, you can easily send a link by typing sir-lancebot#874
I nagged Blue a couple of times, but he must be busy I guess. Last change blue requested was the anagram file was around 130k lines big with words which werent common, now the file is reduced to around 17k lines with common words, which should be easy for users to guess
@dim pelican Done with suggestions, glad all of them were minor nothing major
Apparently it fixed the end of line error which we just introduced
lol, really?
Just curious, do you have the pre-commit hooks installed? It should run on your commit in the command line before a push
yeah i have, if i have any errors github stops me from committing
Ahh you commited from my comments
Yeaaaah
i remember for eof errors, it would fix it by itself when pushed to github
is that not the case when we commit suggestions inline ?
the precommit might fix that, but committing from github doesn't go through the precommit
The precommit is a hook installed on your computer
Ah should i fix it by pulling and pushing again ?
brad already approved my PR, is that allowed after approval changing files ?
if there are lint errors you should fix them yes
Oh yeah, mine is a small approval. Blue needs to approve and I think 1 or more Core Devs have to approve as well
Nah, just a core dev now
Blue requested changes, so he does need to approve
it is one contrib or helper + one core dev
Oh, right
Blue's review can be dismissed though
he doesn't have to approve
the linting error is now resolved, im just gonna let the grownups now sort it out
site#594 is good for reviews! @brisk brook I've resolved your review
Yeah I am gonna play it locally a bit before approving. I just don't have any more complaints
Which PR of yours is this?
Nah it was his, I had left a few suggestions on it sir-lancebot#874
Ah
However, if you are feeling in a reviewing mood, sir-lancebot#859 should be ready-ish now
Yes it is! It's on my "Lab rat testy" list
I don't understand one thing though, you went back to the looping?
It's probably not the worst thing in the world to pull data like that so if tyou feel that's better then that's fine with me
#dev-contrib message
This is the start of the saga
I kept getting an issue with the asyncio.create_task
I thought all cogs were loaded specially exactly for this reason?
ยฏ_(ใ)_/ยฏ
there's no running loop when it's in the init, you can get the loop through bot.loop and create the task on it
Perfect mister @molten perch thank you very much
I also updated the API(I mean the FastAPI) models ๐
@green oriole how can I get print statements to work in @dusky shore whilst I'm debugging stuff?
Ah right
Fair enough
raw_commands = []
for cmd in ctx.bot.walk_commands():
if not cmd.hidden:
raw_commands += (cmd.name, *cmd.aliases)```why does this code lead to duplicates? (duplicates shown below)```py
{'avatareasterify': 2, 'easterify': 2, 'quiz': 2, 'leaderboard': 3, 'stop': 2, '8bitify': 2, 'reverse': 2, 'fact': 2, 'prideavatar': 2, 'avatarpride': 2, 'pridepfp': 2, 'prideprofile': 2, 'flags': 2, 'count': 2, 'c': 5, 'info': 3, 'spookyavatar': 2, 'savatar': 2, 'spookify': 2, 'about': 2, 'sub': 2, 'unsub': 2, 'lb': 2, 'reload': 2, 'r': 3, 'list': 2, 'all': 2, 'movie': 2, 'mosaic': 2, 'name': 2, 'show': 2, 's': 2, 'help': 2}```
This is code that's already in @dusky shore but I don't understand why there's duplicates
Hmm
I guess raw_commands needs to be a set then
So apparently the real issue is just that it doesn't consider subcommands at all
So in the instance of .foo bar with the alias .foo baz, foo, bar, foo and baz would get added to raw_commands (note that foo gets added for each of its subcommands)
When what we actually want is foo bar and foo baz to be added
Rewriting this now to fix the issue
root_aliases are the bane of my existance right now lol
all cogs are actually loaded by first importing them and checking for a setup method before the bot starts. ๐
TBH @radiant merlin doesn't have that problem since it'll just load every single file in the exts folder
Well f*ck. My fears have just been confirmed. The issue is bot.walk_commands() returns duplicates because of root_aliases. I either re-implement this to not give duplicates, or just set() it and to be honest I think I'm just going to do the latter at this point
What do you mean?
I'm working on the custom help command right now
Rewriting it because it's broken as hell
Not even just in the obvious way of raising a TypeError on every invocation for an invalid command, but there's a shit tonne of stuff which doesn't do what it's supposed to do (getting duplicates etc.)
which bot?
Both help commands are completely different
.help asdfd
.help u
but both help commands are so so so different
that's an example where it raises an error that doesn't get handled, because it's doing dict() with 3 arguments
the one for @stable mountain does not inherit the default help command, and the sir-lancebot one does
I know, I commented on the issue ๐
this is important, since Python reimplemented additional methods
!src help
An interactive instance for the bot help command.
If you are truly replacing the sir-lancebot I recommend just copying Bot if that one is good enough, and removing the tag stuff
bot/exts/info/help.py line 104
for command in await self.filter_commands(self.context.bot.walk_commands()):```
It uses .walk_commands() as well
except I've never seen it have the same bug
It'll have duplicates, trust me
do !help adf, pls
That's because the error for that was fixed
ah, but there's still another one?
It's not an error, it's an issue
bot.walk_commands() gives the command twice when the command has root_aliases
Idfk why but it does
because root_aliases are hacked in
As in forpy @extensions_group.command(name="reload", aliases=("r",), root_aliases=("reload",)) async def reload_command(self, ctx: Context, *extensions: Extension) -> None:doing list(lambda x: x.qualified_name, bot.walk_commands())) will give ['reload', 'extensions reload', 'extensions reload']
The extensions reload comes twice
And idfk why
I got to go eat dinner now, and honestly I need the break :p
I have a feeling it's because .qualified_name doesn't get updated when we "hack" root_aliases
Hmm
Idk actually
I'll have to look more closely into the root_aliases implementation
It depends on how the new commands.Command is made
for alias in getattr(command, "root_aliases", ()):
if alias in self.all_commands:
raise commands.CommandRegistrationError(alias, alias_conflict=True)
self.all_commands[alias] = command```called it. We need to change the `command`'s `parent` before adding to `all_commands`
eh, that breaks shit so nvm rofl
It's right, but also wrong
Dpy doesn't let have you a sharing alias and command, even if it means .x vs .something x
It thinks the two are the same command
Oh no, my suggestion broke the anagram
Don't worry about it, that's why we test
@brisk brook I fixed the seconds causing issue, shouldve tested it on my end first then committed
@brisk brook resolved
please review sir-lancebot#849
Opinions on this? .Png image / no image / .jpg image?
https://github.com/python-discord/sir-lancebot/pull/859/files#r717863236
Excuse me?
It doesn't explain why you out of context sent the message "grub hub butt" here
Stop spamming here please
This channel is just for conversation of python discord projects
So please stop
<@&831776746206265384> not sure about this one
!pban 892453482815193139 Seems like you're just here to spam nonsense. We don't need that in this community.
:incoming_envelope: :ok_hand: applied purge ban to @daring tide permanently.
Sorry about the ping
That was a good ping Kron
You don't have to be sorry - that's what you do if that happens
I assure you, one extra ping isn't going to make any of us mad :p
We get like 50+ daily pings anyway
Including 5 within 2mins at times lol
Our filters also produce loads
So yeah, no need to worry about pinging us. If you're not sure, ping us and we can let you know whether it was appropriate for future reference ๐
Hey! Could someone take a look at sir-lancebot#857 and api#17 ? I'd appreciate it! ๐
Moved to #ot1-perplexing-regexing
Any chance someone could give modmail-plugins#6 a once over, would like to get this merged, so I can rebase my other feature branches onto it without having PR dependancies
There seems to be line ending changes?
Yea, since I added the lint it fixed them all
there was also a bunch of whitespace too
That's pretty neat
Wait, hold on
https://github.com/python-discord/bot/blob/01826e8969f9d5c35928b4951f9756df0f1cf2bb/bot/utils/scheduling.py#L47 Why do we have an assert here?
bot/utils/scheduling.py line 47
assert inspect.getcoroutinestate(coroutine) == "CORO_CREATED", msg```
It's the only instance in the bot production code that we have it
Everywhere else is in test
check the blame? I'd assume it's something to catch the coro already beaing awaited during development and shouldn't be reachable in prod
Still bizarre to see it in prod. I've always assumed that assert isn't suitable for it
@tawdry vapor why
Asserts are good for things you know shouldn't ever happen, but in case it does you want to have an early fail point, so you don't have to trace back the error
I'd say that's a decent use of assert right there
Should do more of those
Fair enough
@mellow hare oh also I just saw the issue, we will need a site issue too to add the new voicemute type and add a custom migration to change all the current voice bans to voice mutes. Feel like writing it? I can do it before the end of the week otherwiiiise
Yeah, I think assert is generally underused. At NASA they have a requirement of one assert statement for every 5 lines of code (or something).
The idea is to make the code fail closer to where the problem occurred.
But an assert should never be used to implement an interface, and it shouldn't have any side-effects (aside from unavoidable ones like CPU usage).
Also if the system get's into a weird state, it could help stop it before it does too much permanent damage ๐
failed automerge on https://github.com/python-discord/bot/pull/1822
approving reviews are @vale ibex and @vocal wolf
Branch is outta date
Yes, love asserts. They're basically a "Assert that certain assumptions are correct" vs. "Super weird indirect error from the computer continuing running".
The worst of bugs would be solved with asserts.
asserts are for when I know that something is impossible but i need to convince the type checker 
such as things in bot subclasses potentially being None because the thing that sets them to something runs in an override of async def start()
I'll knock it out tomorrow
Well neat, I'm glad I learned about the assert thing
sir-lancebot#860 would anyone want to test this PR out? if so, thanks!
Because the O compiler flag (optimization) removes assert statements.
Its better to use an if statement which raises an assertionerror if the assertion is needed in prod
Yes ik I'm not Mark but it's still the answer ๐
iirc S100 complains about them
S101
I think I used an assertion because it's more of a programming error than a runtime error. Not sure if I totally agree with that still but assertions vs. exceptions kinda has a blurry line.
ye. I'm of the opinion that if it should be checking in prod, use an if / raise
else, its fine to use an assert
Not sure if I should put this here or anywhere else, but I wanna add https://goalkicker.com/ to the list of resources for Python
Specifically, this one: https://goalkicker.com/PythonBook/
It is AMAZINGLY detailed for a free book (PDF)
(I didn't write it, so I'm not really self-advertising)
From their website:
Looks pretty cool to me! Would the target audience be any one and everyone or could it be broken down to beginner/intermediate/advanced?
With 200 chapters I can see this being a bit tricky to find what you need
Especially if you don't know what you don't know
Very cool ๐
And this is an extract, detailing what kind of language it uses
I mean, I would definitely recommend checking it out yourself first
before publishing it on the resources page
looks cool, imma dig in
As of now, the book's latest Python version (the version listed in the book) is Python 3.8
So the normal process for adding it to the site would be a PR through the repo: https://github.com/python-discord/site
The only thing to do before that is to make an issue for it so it's approved by the Devs. Is that something you would be interested in?
pythondiscord.com - A Django and Bulma web application. - GitHub - python-discord/site: pythondiscord.com - A Django and Bulma web application.
I could look into it
all you really need to do is to make an issue
Sweet, if you hit any blocks there are usually people here to help out! And if you don't want to deal with it I'm sure someone can pick it up as well
This one, right?
yup
Thanks!
yw
We have moved content to the meta repository!
Oh really? My bad Alt!
Yeah it's a fairly new decision
Resource type Book Where can the resource be found? https://www.goalkicker.com/ What sort of content is in the resource? What areas of Python does it cover? GoalKicker's tagline is &quo...
Done!!!
Thanks for the help, folks!
Also, y'all might just wanna tone down @dusky shore's sass level. This got me good
I can't tell if it's bugged or just roasting me
That was from the .spookify command right? It supposed to act scared lol. I think there is one with bats that gets applied on a black background that you can't see every time
Yea, we should add a white border to the bat png
Looking for opinions: logo or no logo in the embed for the .wtf command?
https://github.com/python-discord/sir-lancebot/pull/859#discussion_r718122654
Are you able to send a mobile-friendly version of with vs without logo?
Can't really view the gh page on mobile
Actually that doesn't look bad (with the logo)
I think the dark mode might just look bad because of my phone contrast (I'm outside atm)
You really can't see it on dark mode since it is a .png, so the background is transparent
All I can see is the python logo in some sort of box-shape
I'll have to look when I get back home
So a few hours
right, so if I made a .jpg image with a background color to give contrast it might look ok-ish then
!remind 3h this ^
Your reminder will arrive on <t:1633016847:F>!
Worth trying ig
But then that might make it look weird on light mode
If I do a light grey? Just enough to stick out on both
Yeah, that could work
No it looks bad on all of my screens
You can't really make out the logo
I thought the .jpg work-around was a nice solution
๐ definitely didn't try and fail to get a local .jpg to attach to an embed and then make the suggestion to not have an image
Just send it to Discord (like in here maybe?) and use that
Oh as the url? I was thinking of including it in the resources folder, but kept getting a path error when testing locally
*Using the relative path of the project structure to create a discord.File object and then attaching that to embed
are you running in docker ?
Yup!
The cwd should be the project root
right so
LOGO_PATH = "/bot/resources/utilities/logo.jpg"
Should work when I pass to
image = discord.File(LOGO_PATH)
But it usually gets a file not found error
Holy shit, I had exts in the path....๐คฆ
!remindme 6 hours
6 is not a valid duration string.
6 is not a valid duration string.
Your reminder will arrive on <t:1633035577:F>!
this is an absolute path lol
You want ./bot/...
Indeed, thanks Akarys!
hey guys, whats the deal with some links when editing locally redirecting to pythondiscord.local?
i looked at the guide and there isnt any mention of it anywhere
Here's your reminder: this ^
[Jump back to when you created the reminder](#dev-contrib message)
This does look a lot better on my laptop than my phone, but I do think trying out the light grey should be done
never mind, aliased it to 127.0.0.1 and everything works
@brisk brook update!
anyways, please review site#594
@brisk brook So I saw your comment on sir-lancebot#860, I'm not sure why that's happening though
This is after waiting for the components to edit
Hmm
Oooh juicy components, I like this
So it happened after waiting for that long?
Interesting
I figured out the problem; did you by chance have a lot of views open?
It works for me with just one
I might add a cooldown then
or just edit out the view entirely
Yup that's exactly what I spammed
I had a lot of them open
Ah, no wonder
I should just add a cool down for a minute
Or better yet would you be fine with just editing out the view entirely?
I don't understand the problem, why does a lot of views cause this issue?
API overload? but that wouldn't cause the error would it
it might be some internal jumbo for dpy
@brisk brook (sorry for pinging you again, just curious as to what your thoughts are from just completely removing the view)
Hey @dim pelican , I found out something...
So apparently PIL.ImageColor.getrgb can handle the following patterns and return a tuple of RGB,
'rgb(255, 0, 0)' # spaces after or before `,` doesn't matter
'hsl(0, 100%, 50%)' #same as rgb for spaces, and `%` is required
'hsv(0, 100%, 100%)' #same as hsl
'#FF0000' # case insensitive
So in python, it would be:
>>> from PIL import ImageColor
>>> ImageColor.getrgb('rgb(255, 0, 0)')
(255, 0, 0)
>>> ImageColor.getrgb('hsl(0, 100%, 50%)')
(255, 0, 0)
>>> ImageColor.getrgb('hsv(0, 100%, 100%)')
(255, 0, 0)
>>> ImageColor.getrgb('#FF0000')
(255, 0, 0)
I think we should use this, and for the regex for these patterns,
you can refer the source file for ImageColor, https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageColor.py,
and besides it also contains some 140 standard HTML color names, but I don't think we can use this, but anyway, it also returns a RGB tuple:
>>> ImageColor.getrgb('limegreen')
(50, 205, 50)
Is it an intended behaviour that when I call wait on a View the bot keeps typing, until the View either times out or gets stopped?
(I was implementing sir-lancebot#857 when I encountered this "side effect")
๐คฏ
That....will make things so much easier for us lol
yeah lmao
It seems to do so. It might be a glitch with dpy I'm not sure.
Depends, are you using a context manager?
Or calling wait directly as a func
If it's the former, then move the ctx.send outside of the context manager
And from the source code, to handle CMYK mode, ig this will work
import re
color = 'cmyk(0, 99, 100, 0)'
match = re.match(r"cmyk\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
if match:
c = int(match.group(1))
m = int(match.group(2))
y = int(match.group(3))
k = int(match.group(4))
r = int(255 * (1.0 - c / float(100)) * (1.0 - k / float(100)))
g = int(255 * (1.0 - m / float(100)) * (1.0 - k / float(100)))
b = int(255 * (1.0 - y / float(100)) * (1.0 - k / float(100)))
print(r, g, b)
@molten perch
Or, just await the send typing func directly, rather than use the contact manager, since it stays for 5s anyway
No, no actually. I don't mean to achieve typing effect. It's just a side effect.
I did the same thing as in the examples, provided in the dpy repo.
That is because it is done within the async with ctx.typing()
Just move it out once
๐ฅถ Missed it, sorry. Thanks for pointing out, didn't realise it. :/
I might just remove the view altogether after the view expires for the challenges command
Adding a cool down would be obnoxious
Unless itโs a short one
Iโll test it out with a 15 second cool down
Do you know why it fails when you have a lot of views open?
Since, it's been patched sir-lancebot#857 could use some reviews, I'd appreciate it! ๐
Here's your reminder: Fix Logo Path
[Jump back to when you created the reminder](#dev-contrib message)
I actually don't
I'm going to edit the view to None and see what happens
Even after the cooldown it still raises it, weird..
I'm just going to remove the view altogether
Hm... it still edits the view properly and disables it after the error? I'm wondreing if I should just ignore the exception
Alright, editing the view out entirely works
it doesn't provide any usage if it's disabled
or if it's just out entirely
so I'm just gonna remove the view
Very nice! I like it both in light and dark modes!
Thanks! The problem that I was having is that I was using the absolute path, and also not attaching the image file to the embed
sir-lancebot#859 should be ready to test / review now
site#594 and sir-lancebot#849 both need reviews! We are getting close to merges on both
I think 594 needs a core dev approval
And 849 needs wookie and xith, don't know their timezones so I'm not sure if I should ping them or not
.bm #dev-contrib message Better Color
wookie is european, xith's drifts and no one knows for certain
Sweet, then maybe a ping nice and early tomorrow Kron?
Likewise for sir-lancebot#860 if anyone wants to review it!
Same applies to api#17 , it might seem like a lot, but on the contrary, itโs relatively easy. ๐
Those look great! Nice work
if you can find mine that would be great
@clever wraith .quack has been merged.
.quack
Sir Lancebot currently reacts with spooky emojis to user messages, but also bots. Fine with you if I PR to ignore bots?
That sounds like a good idea
Yeah, that seems smart
I'd open an issue first though
Itโs such a tiny change that I think itโs redundant in this case
Yeah, don't need to, consider this as your friendly core dev approval: 
Akarys spin is the ultimate approval
Quite indeed
When y'all have time please look at site#594
So official. Thank you for the approval, dear core developer of python discord.
danger is another one
I'll eventually get them all
spooky danger skeleton halloween doot jack-o-lantern
pumpkin is the only one you missed
lol does it use the same reaction as jack-no-lantern
And halloween
Are the reactions a new feature on Lance?
spooky
Nice
halloween
Nice
This is cool
Thanks to whoever did this!
Not new, just locked to October
Ah, ok, makes sense
halloween pumpkin
Ok, let's not use bot commands anymore here. #sir-lancebot-playground
!remind 12h this
Your reminder will arrive on <t:1633170301:F>!
Sorry for asking again and again - but when anyone is free, could anyone who is fine with doing so test out sir-lancebot#860, I havenโt run into any errors so far but Iโm wondering if anyone else does
Apologies for asking so much, but could people look at site#594?
Does anyone know why @dusky shore reacted to #sir-lancebot-playground message ? lol
spooktober?
iirc it reacts to random messages
bot/exts/holidays/halloween/spookyreact.py line 32
async def on_message(self, message: discord.Message) -> None:```
I would, but I don't know much about Gitpod, sorry
Lol
??? This makes no sense
On one message there is no reaction but on the second there is
And the reaction itself makes no sense
Clearly there is a bug somewhere
Does anyone know where?
Apparently it's a thing, I asked Akarys about it earlier
itโs a candy collecting game
Oh ok
Here's your reminder: this
[Jump back to when you created the reminder](#dev-contrib message)
Dark mode?
Hey! Yesterday I pushed a few changes to api#17 , that should make it way more convenient to review the pr. Thus, I would really appreciate if someone took a look at it. ๐
I believe that's Volcy
ye
I'm curious, where can I find the init.sql for metricity? Is it the same as the site init.sql? Because I see these lines: https://github.com/python-discord/site/blob/main/postgres/init.sql#L1-L3
postgres/init.sql lines 1 to 3
CREATE DATABASE metricity;
\c metricity;```
It seems like it, there you create the metricity database then connect (that's the \c metricity;) to it.
Oh ok, I was wondering if that was the same file for both and didn't know that \c syntax
Oh wait, isn't site also the API?
it is
metricity doesn't have an init, on account of not having a database. Sqlalchemy iirc does the migrations
Can't remember if it's sqlalchemy or something else
alembic iirc
Correction, yup ^
Here it is, just found it
Hey everyone! I have two small requests to make this morning. Thanks for putting up with me 
First, when you guys have time, could you changelog .quack?
Also, site#594 needs reviews! It's just a documentation change, nothing big
Have a nice day everyone
workflow as a whole
I think, at least
maybe not thinking about it, I can't remember
Hey! Could someone take a look at sir-lancebot#857?
Any idea why @dusky shore responded to this: #sir-lancebot-playground message
Oh, does it react randomly in that channel?
Nvm.
!rule 9 and That's not on topic for this channel nor server
lance doesnโt have a config file
it has few enough env vars that just following the setup guide should be a quick process
True
ty @vale ibex
@trail pilot
I'm bad at remembering people who use different names in discord ๐
updated it ๐
Ping me when the PR is opened @obsidian patio
Sure, thanks
@fervent sage did you get anywhere with quackstack S3? otherwise I'm going to add it today
The moment has arrived. sir-lancebot#891
yeah, instead of on fs which gets reset
My server nickname just went purple and got a duck emoji next to it for <1s. Is that due to one of you guys' duck bots?
check if it's in S3 and return that link if it is
More likely a discord-ism
Just a random display bug
Ah ok thanks
we oly need to check if it is there and return the URL
we're not serving images from quackstack, you'll get a link back to an S3 bucket
the bucket is uhhhh
thank you it's me enjoying a tuna mayo sandwich
yea
we haven't used the bucket yet
but i wanted the name lol
Oops, I should probably change my name here to my GitHub name
hah no worries
Haha
Was reviewing https://github.com/python-discord/bot/pull/1831 and noticed this: https://github.com/python-discord/bot/pull/1831/files#diff-e5bace3e9f8f891dbdcc81752a2b2104a54662304da3b068d64df115ce598aec, was wondering if anyone could think of a better way of handling the circular imports problem here, not something I really know about.
That is, # use logging.getLogger (not bot.utils.logging.get_logger) to prevent circular import
Would moving the CustomLogger into a different file fix it?
wait no
actually maybe yes, idk
I'd say just move it into the functions that need it?
In general they're just gonna be used once
There's 4 uses I can see
3 sorry:
https://github.com/python-discord/bot/blob/00af16266c65462bc0cfedde729e01d6d97363b7/bot/constants.py#L106
https://github.com/python-discord/bot/blob/00af16266c65462bc0cfedde729e01d6d97363b7/bot/constants.py#L125-L128
https://github.com/python-discord/bot/blob/00af16266c65462bc0cfedde729e01d6d97363b7/bot/constants.py#L184-L190
The first is just from loading the config, which could be troublesome
The third* is accessing an attribute that doesn't exist. Which should never happen. If it does then something's bad and the potential performance cost is okay
don't think those logs show up anywhere since the file is loaded before logging init ๐
The second was actually when checking the required values. Which is also a function and can be delayed

bot/log.py line 12
from bot import constants```
logging init depends on config
Ah lol, that's fun. Is there a way of making it work? Just using a default logger config before setting up our own one that relies on constants? Or should we just not bother logging anything in constants.py?
fwiw the same fix in the PR was also in this file https://github.com/python-discord/bot/pull/1831/files#diff-950e2907ace87d93e3d7f55765ba691bab24f5ef8f26c445d3d467feeb8caf50
that is, services.py, not sure if that link jumps to it
i'm not sure why that one has a problem
okay i ditched the quackstack s3 bucket
https://duck-cdn.pythondiscord.com/ is what we'll use
yea am debugging it
oh, cloudflare is caching
which is good, but not for dev lol
wait
hm
hmmm yeah
not sure why
bucket definitely exists
lol
hm
should have named it ddn for duck delivery network ๐
for me it's cutting between working and not working
damn that's pretty good i think we'll go with that
even with v1 i get mixed results
maybe we use b2
well, eventually we'll cut over to cloudflare r2
lmfao
Why did you yeet quackstack lmao
I personally think the info log on L107 doesnt need to be there (it already doesnt reach stdout, if I'm not mistaken), or it could just be a print, L126 will kill the bot via an exception anyway (so the message could go in the exception instead), and L190... I'm upset because I never realized the annotated attrs aren't fetched from the yaml until a lookup is made, I always assumed the attrs get set on the classes to fail immediately if not found ๐ฌ
Makes sense, I guess we could just not log in that file then. Not sure on the best way to solve it in services.py though, it's imported in the util folder's __init__.py https://github.com/python-discord/bot/blob/main/bot/utils/__init__.py while the utils/logging.py file is being imported. Things I can think of are
- Don't have the
__init__.pyimports and just use the full paths elsewhere - Move the logging import to inside the function
send_paste_to_servicesfunction, probably the easiest option but feels a little more fragile.
could we import get_logger in the __init__ of the bot package and then import the function from bot directly?
IE in __init.py__ do from bot.utils.logging import get_logger and then anywhere we want to log we from bot import get_logger [...] get_logger(__name__)
you can do it
Hey! If someone happens to have some time, I would really appreciate if they could take a look at api#17 .
Nothing special, porting Django models to SQLAlchemy models basically.
I believe so, yes.
However, if the model pr gets merged, it'll be fairly easy to port the endpoints. I believe.
It's not as bad as it seems.
Actually, the hardest parts are the checks(validations) and not the models itself.
๐ You're welcome
JSON Binary pretty sure
Hey, I added the package to pyproject.toml but it didn't pick it up. Why did this happen, and how can I fix it
Yeah it has to do with PostgreSQL
For sir lancebot
difference is described in that docs
By didn't pick it up, what I mean is: I added it to pyproject.toml and imported it from another file, but I get this
ir-lancebot | import markovify
sir-lancebot | ModuleNotFoundError: No module named 'markovify'
sir-lancebot |
Did you run poetry install after you added it? You'll need to if you manually added the entry.
sort of
Well.. there was a "helper_text" attribute on the Django models, I thought since there is no such thing in SQLAlchemy(or at least it wouldn't make sense to add them), I'll add them so that new contributors will understand what each field represents. Actually.. not just new contributors ๐
I think this is a very good thing
there is no reason to remove documentation, unless it is redundant
and some of those names really aren't self documenting
I'm gonna be totally honest with you.. I copied it from:
https://github.com/python-discord/site/blob/main/pydis_site/apps/api/models/bot/off_topic_channel_name.py#L14
๐
pydis_site/apps/api/models/bot/off_topic_channel_name.py line 14
RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ว๏ผโ'๏ผ๏ผ]+$"),```
I believe it should be.
(btw. https://github.com/python-discord/site/blob/main/pydis_site/apps/api/models/bot/role.py ๐ )
pythondiscord.com - A Django and Bulma web application. - site/role.py at main ยท python-discord/site
Wrong one
pydis_site/apps/api/models/bot/role.py lines 62 to 64
def __le__(self, other: Role) -> bool:
"""Compares the roles based on their position in the role hierarchy of the guild."""
return self.position <= other.position```
Thank you so much! Iโll push the changes tomorrow.
(Btw. As for the port mapping: https://github.com/python-discord/site/blob/main/docker-compose.yml , it seems like itโs valid, and during testing it worked fine)
pythondiscord.com - A Django and Bulma web application. - site/docker-compose.yml at main ยท python-discord/site
I believe we should merge the models pr first.
It's a way to manage database versions
https://www.cloudbees.com/blog/database-migration might explain it
getting a fresh database to the state it is in today
so assume you start with an empty database, like a fresh install
then you want to add an app that handles todos, so you add a model that defines a table of todos
then to actually get that schema to the databsae you add a migration that does the actual sql ops
then say you add users later down the line, you add the models and then add the migrations to match the database up to thta
so you have basically a changelog of all modifications to the database
and since that gets replayed you can go backwards and forwards at will
it's sort of that, yeah
django auto-generates most messages
that's the naming of migrations, we picked most of those though
yeah, similar to metricity
pythondiscord.com - A Django and Bulma web application. - site/pydis_site/apps/api/migrations at main ยท python-discord/site
yes - but keep in touch here so it is integrated correctly and configured right
wdym by partial UUID approach?
the migration tool needs to know what order to run the migrations in, they're very much order dependant
alembic default
yea p much
That's pretty cool
Would anyone want to test/review sir-lancebot#860 when they're free? I'm wondering if anyone else is getting errors because on my end I haven't gotten any but I might be missing a few edge cases
Hey Mark, can you repost the code you sent here? I recently tried to do something similar but it didn't quite work for me
I'll try to find it
Don't remember what branch it's on
I'm not able to find it. I might have to go through local branches 1 by 1 but there are lots of them.
ok, not important then, thanks
Yeah sorry. I really have no idea where that code is
I found it
I think it's this one, but there's also a version that used dataclasses https://paste.pythondiscord.com/acohosicod.py
Thanks!
Right, so the solution was using init_subclass. I tried doing something similar with a metaclass, but got a metaclass conflict because of ABCMeta
General question: when should a PR have the commits squashed? Is this possible to do from the PR itself or should I do the rebase locally then push it prior to merging?
If the PR should squashed it will be done during the merging
You squashing and force pushing messes with the reviews.
eh, there are valid use cases for squashing outside of merge time
since squash merging always squashes to 1 commit
Got it! Just looking at the sir-lancebot#859 and thinking to myself "These 40 commits could just be 4" lol
Yea, the main issue with squash merging like this, is that there's no easy way for reviewers to tell if something got messed up with the rebase
without reviewing all over again
In that case I will just keep going with atomic commits and let them build up ๐ thanks for the quick responses fellas
๐
!remindme 10h Test sir-lancebot#860
Your reminder will arrive on <t:1633385426:F>!
That's true yeah, if you just want to clean up history.
You should be able to clean up the history without changing files
Back when I was working on the MVP for forms, I'd usually write a feature, use 300 commits, and once it was more or less done, I'd git reset --soft, then make commits of the final product, without changing any code from before I reset
Yea, the point I was making is that to a reviewer, the PR just shows as force pushed
there's no way to tell if the author actually changed the code, or if the commits were just squashed
Yeah so you need to look through it again and Approve (if that's what you did previously)
And all of them get dismissed afaik
If anybody needs PR reviews lemme know
You asked, I delivered. ๐
api#17 needs as many reviews as possible.
Maybe sir-lancebot#859, but it should be pretty close already. Could try to test it out and see what breaks
I meant sir-lancebot#874
Well, not really sure how to answer that. Let me put it this way: I'd say if you been waiting more than a week to get an approved PR merged, then certainly follow up. But in general, it's always a good practice to be patient. Hope that answers your question.
Do I have to contact any core dev or its all handled
Someone might get around to it if they have the time. If it sits for too long feel free to bump
We don't want PRs to sit for too long, but sometimes people are busy or don't notice
I'm going to wait another week then follow up maybe, I got approval around a week or more before so I thought I'd check in
@cold island @vale ibex not to distract y'all from other things right now, but I got somewhere with static builds:
https://615b32be1025c010fb532b0e--pydis-static.netlify.app/
This is zig's PR, though do note that not the entire site is working yet. I know resources barely work, though please do tell me if you notice something not acting as expected
awesome ๐