#dev-contrib
1 messages · Page 7 of 1
Did we ever fix that one?
@static canyon , any thoughts?
Poetry 1.2.0 was released 2 days ago, but I'm not seeing anything in https://python-poetry.org/blog/announcing-poetry-1.2.0/ that I would think could cause this
I can't really look because I'm on mobile, sorry
Wasn't there an issue/PR for pinning the poetry version? Maybe it's related to that?
Oh
Yes I just saw this
Hmm
Only pins the version in the Dockerfile
Hi @vale ibex
Please explain bot#2268
Thanks
Our bird just opened a new PR and and the workflow failed because Poetry said the arguments passed to it were invalid.
But looks like you're now moving Poetry out of the main body and into the Dockerfile and pinning to the previous version?
Do we just need to wait and rerun the CI after your PR is merged?
have you guys considered adding some web frameworks to the eval command (just for their utilities and such), i see people asking about them a lot
What kind of frameworks are you talking about?
Something like flask?
I don't know if that would be too helpful, because eval can't serve multiple requests
What could you do in a single eval'd code block?
again, utilities and such that don’t actually run a web app
im not sure if they work at all without the app though so it might be pointless
So I just had a big brain idea
Why not make #voice-verification use buttons
It can then respond with an ephemeral message
No one can mix up the command
And the bot doesn't need to auto-delete messages
nice idea.
it's kinda weird to see general have 0 activity. maybe it's because of the time in the most common time zones in this server? But I doubt that.
it does ebb and flow.
https://stats.pydis.com has some stats on that.
Public statistics for the Python Discord server
Too much to type on mobile, but the pr linked in that pr should describe it
Basically Yea, once that has merged, it will fix your ci
👍
What're you waiting on?
Just reviews?
Reviews
Wait I'm confused, why did we need the user pip installs anyways instead of venv? Was it a caching issue?
it was more that we didn't need a venv, since it's a one off image
Also if bot#2268 is switching to venvs shouldn't that fix the issue related to poetry 1.2? But it's also pinning it back to 1.1.15?
CI is pinning to 1.1.15, so I'm leaving the dockerfile be the same until that is updated
Ah okay, but theoretically it would work for 1.2 now?
Yea
So currently lint-test.yml has also been changed to use poetry 1.1.* via HassanAbouelela/actions/setup-python@setup-python_v1.2.1?
Yea, that pins it
can we disable the lancebot fuzzy matcher for pygen? Some people were spamming it just now, it's bound to happen again
not that it's always malicious but when one person accidentally invokes it everyone goes 'hey look broken thing' and everyone tries it
related to sir-lancebot#1090
If the fix is too involved, we can disable the misbehaving code path in the meantime, sure
could I look into a fix for 1090? Since it's not currently approved
The reason it’s not approved was because it’s a bug without a clear resolution pass, that’s probably going to require discussion to figure something out
Following the philosophy of organization, I thought it shouldn’t be approved till we know what we actually want
No one’s looked into it because people are busy, and it’s not a critical thing
I mean the solution is pretty easy. Just don't call self.on_command_error.
Imo we should also move the util to botcore since both bot and lance use it, but ig that's not necessary
am i understanding correctly that an issue should be opened before PR'ing?
That's the best way to go yes
Gives us a chance to look into the proposed change before you put work into changing the code
thanks
and also mention the issue in the pr
It was proposed before, but it’s not something we want to do in terms of implementation or behavior. It’s hard to implement because the onus is on snekbox to figure out when input is required, communicate back with the bot and the user, and manage the resource and time limits, or parse user code (which is also not easy). In terms of behavior, it’s not something we consider important. Why do you need input instead of just putting in whatever you actually want to run in your program
(If you really need it, you can write directly to stdin)
i already suggested this here https://github.com/python-discord/bot/issues/2255 and it seems it’s really just not worth the work
these didyoumeans are really annoying!
is there a way to disable them if the message starts with ..?
sir-lancebot#1090
It's not gotten approved but I'm planning to fix it as soon as it does
Apparently it's not being considered critical atm though & the core devs are rather busy
ah
Approval to fix the bug? sure, I think it's indisputable that this is a bug
@cold island see Scale's messages here
For me the only question is do we move the util to botcore?
- What util
- Why does it call self.on_command_error in the first place
And let's fix the issue on lance first, we can discuss moving it to botcore separately
The util that tries to get similar commands
Part of that util triggers on_command_error, but it shouldn't
I described it all in a comment on the issue
How will you check whether it can be run instead?
The exact same. We just pass instead of handling the error
So before 1064 it would raise an error for not being able to run the command, and then suggest it?
And the only thing that changed now is that it does it multiple times
It doesn't suggest it
It just raises & sends the error to Discord
It doesn't tell you what the command was
Interesting that it didn't come up before, probably because staff/mods don't get these
Because when looping the similar commands, there was a return which meant it'd only do it for the first matching command, and ig it seemed intentional at that point
Now there's a continue, so it does it for all matching commands (including subcommands iirc)
The error message also self-deletes after so many (I think 3) seconds so realistically only the invoker would see it
And if as you say staff/mods don't get them, then that's another thing
All contributors to it not being noticed
Anyway that looks like a good solution as far as I can see so I say go for it
So changing await self.on_command_error(...) to pass?
Do you need to explicitly pass?
If it'd otherwise be a blank except body then yes
Isn't there a log or something in there
But just remembered there's a continue there, so no need for pass
Yeah that too
Should be, we should test that doesn't mess things up
Should I also fix the typehint that 1064 did? I.e. Optional[list] --> list (it's always provided, just is sometimes empty)
def get_command_suggestions(
all_commands: list[str], query: str, *, cutoff: int = 60, limit: int = 3
) -> Optional[list]:
"""Get similar command names."""
results = process.extract(query, all_commands, score_cutoff=cutoff, limit=limit)
return [result[0] for result in results]```the return type for this
Yep
Cool
Was... this not how you run tests?```
PS C:\Users\tizzy\sir-lancebot> poetry run task test
could not find task "test"
PS C:\Users\tizzy\sir-lancebot> poetry run task tests
could not find task "tests"
no tests in lance
Also forgot I can't access my GH account right now because I don't have my standard phone number since I'm abroad
So I guess the PR will be tomorrow/day after
Sure
Can someone please note on 1090 that it's been approved by @cold island and that I've implemented the fix
(sir-lancebot#1090)
Whats the status of bot#2263 I added a pr for it, when will it be merged?
Hey folks,
Can I get some reviews on bot#2261 and site#770 please ?
I know wookie is supposed to review them, but they appear to be busy with other things so I thought maybe someone else could ?
Here's your reminder: review if not already merged
[Jump back to when you created the reminder](#dev-contrib message)
Hey! I have a very simple PR, that needs one more review, I'd appreciate if someone took a look at it.
sir-robin#60
RE sir-lancebot#1062
For the part about adding interactivity (react with ❌ to delete etc.) how exactly should this be implemented?
I'm thinking the bot adds the reactions itself, and then a wait_for (potentially in a loop if there's multiple interaction options) will trigger when the user presses one. Maybe even buttons, but I imagine reactions are better here due to the size of buttons.
Isn't it just a regular
?
.help
Right, the delete specifically is
yeah, it uses wait_for iirc
Cool
with contextlib.suppress(NotFound):
try:
_, new_message = await self.bot.wait_for(
'message_edit',
check=_message_edit_predicate,
timeout=REDO_TIMEOUT
)
await ctx.message.add_reaction(REDO_EMOJI)
await self.bot.wait_for(
'reaction_add',
check=_reaction_add_predicate,
timeout=10
)
await ctx.message.clear_reaction(REDO_EMOJI)
with contextlib.suppress(HTTPException):
await response.delete()
except asyncio.TimeoutError:
# One of the `wait_for` timed out, so abort
await ctx.message.clear_reaction(REDO_EMOJI)
return None
else:
# Both `wait_for` triggered, so return the new content to be re-run
return new_message.content
return None```Where does the bottom `return None` ever get reached? I'm thinking it's only when `await ctx.message.clear_reaction(REDO_EMOJI)` fails due to the emoji not having been added (i.e. when the first `wait_for` fails)
Right
so it could be for that clear reaction, or even for the add reaction
So also add_reaction
Yeah
async def continue_job(ctx: Context, response: Message) -> Optional[str]:
"""
Check if the job should be rerun.
For a job to be rerun, the user must edit their message within `REDO_TIMEOUT` seconds,
and then react with the `REDO_EMOJI` within 10 seconds.
"""
# Correct message and content did actually change (e.g. wasn't a pin status udpate)
_message_edit_predicate = lambda old, new: new.id == ctx.message.id and new.content != old.content
_reaction_add_predicate = lambda reaction, user: all((
user.id == ctx.author.id, # correct user
str(reaction) == REDO_EMOJI, # correct emoji
reaction.message.id == ctx.message.id # correct message
))
with contextlib.suppress(NotFound):
try:
_, new_message = await self.bot.wait_for(
'message_edit',
check=_message_edit_predicate,
timeout=REDO_TIMEOUT
)
await ctx.message.add_reaction(REDO_EMOJI)
await self.bot.wait_for(
'reaction_add',
check=_reaction_add_predicate,
timeout=10
)
await ctx.message.clear_reaction(REDO_EMOJI)
with contextlib.suppress(HTTPException):
await response.delete()
except asyncio.TimeoutError:
# One of the `wait_for` timed out, so abort
await ctx.message.clear_reaction(REDO_EMOJI)
return None
else:
# Both `wait_for` triggered, so return the new content to be re-run
return new_message.content
return None # triggered whenever a `NotFound` was raised
```does this look good?
I do think the function name should be changed, but not sure what to
Maybe rerun_job
Or check_rerun_job/maybe_rerun_job since it's not guaranteed to rerun and the function doesn't do the rerunning itself
Maybe you can take inspiration from the structure in eval
!src eval
Run Python code and get the results.
I've also added the comments for clarity
out of the options above, adding maybe is my preference
I'm thinking check_rerun_job since the docstring is literally "Check if the job should be rerun."
And I feel like maybe_rerun_job sounds like the function will do the rerunning (which it doesn't)
I think I'm just about ready to PR
Is this good for a bot-core docstring?```py
async def check_rerun_job(ctx: Context, response: Message) -> Optional[str]:
"""
Check if the job should be rerun.
For a job to be rerun, the user must edit their message within `REDO_TIMEOUT` seconds,
and then react with the `REDO_EMOJI` within 10 seconds.
Args:
ctx: The command's context
response: The job's response message
Returns:
The content to be rerun, or `None`.
"""```
If this is bot-core then it should be as generic as possible
variable duration for editing, maybe also take a callable to process the response
Also you should try implementing it in eval to see if what you did covers this use case, since that's why you're writing it in bot-core
is this function the only thing you're adding to bot-core, or are there other parts as well?
Use double backticks
is that a sphinx thing?
Yes, single backticks do different formatting stuff than md
Double backticks are the equivalent
Just this util
just a typing suggestion but otherwise looks good
Much appreciated! 😄
additionally it shouldn't use global variables, unless botcore is basically on pypi for pydis use only
It’s not on pypi
Would be good to get another opinion on https://github.com/python-discord/bot/pull/2272
something happened earlier and this help channel did not close
#help-dumpling message
for a second i even saw @stable mountain reply with an embed to the OP saying "did you mean !close?" or something like that
I think the previous use of the lock from the channel's id was still being holded by some await statement, possibly in claim_channel(/bot/bot/exts/help_channels/_cog.py) could be something else too like the lock from user's id being holded somewhere(hard to traceback) becuase when you tried to close it, it closed
Apologies if this is the wrong place to ask this. I've been referencing the Python bot's testing code in order to learn to setup testing in my own bot, and I noticed a tiny issue. In bot/tests/helpers.py line 320, additional_spec_asyncs features an attribute, redis_ready, that (seems to) no longer exist in Bot or BotBase. I believe it was removed in fc05849. I'm looking to make small contributions since I've never contributed to an open source project before, would this be something worth making an issue for?
edit: nvm, i was confused what you were asking
nah you were fine, i just didn't read properly
@timid sentinel re bot#2233 do you mean the command docstring?
yeah
Cool, will do that soon™️
!remind 28h if not done already
Your reminder will arrive on <t:1663001978:F>!
Good spot. Feel free to create an issue, it's also fine if you'd like to create a PR without an issue since it's a small change.
Thanks, will do
@timid sentinel would you mind having a look on bot#2261 again please?
Mark has suggested that we'd allow the rule numbers and keywords to be sent in any orders but also lookup based on multiple keywords and just one.
I thought that it wouldn't really matter after all so I changed it.
Thank you!
Since I'll be poking around in the testing code for my own purposes, is there anything else there that I could help with? Didn't see anything in issues under the testing label
Tbh, the testing setup for bot is not great
Testing discord.py is already a terrible process, so most contributors struggle with the unittests
We don’t pay too much attention tests, we just keep them passing
What is there is fine, nothing wrong with it, but it probably shouldn’t be your reference
I see. I've been trying to find a way to add tests for my own bot projects and Mocks seem to be the most sane option. Never used them before so I was looking to see how other discord bot projects used them.
Discord bots make up the bulk of my "portfolio" projects I show to employers, so it feels wrong to not have any sort of testing.
!charinfo !closе
\u0021 : EXCLAMATION MARK - !
\u0063 : LATIN SMALL LETTER C - c
\u006c : LATIN SMALL LETTER L - l
\u006f : LATIN SMALL LETTER O - o
\u0073 : LATIN SMALL LETTER S - s
\u0435 : CYRILLIC SMALL LETTER IE - е
\u0021\u0063\u006c\u006f\u0073\u0435
Wasted a bunch of time looking into that 😑
Ah sorry I forgot about that, I'll try and take a look tomorrow
hilarious
Was literally about to send a message here about how I had traced through the logs and code and was convinced what was happening was impossible and made no sense at all, then figured I should just double check...
Made the rookie mistake of entertaining the idea that there could be a bug in our code
lmaooo
very obvious now that i look at it now
surwei 
so what was that log about notify_session_participants and something being locked?
it's not a bug, it's a feature
I should have also checked that earlier, spent a lot of time on my test server to reproduce it and understand the lock code
Where do the results of .http_status come from?
.src http_status
bot/exts/fun/status_codes.py lines 8 to 9
HTTP_DOG_URL = "https://httpstatusdogs.com/img/{code}.jpg"
HTTP_CAT_URL = "https://http.cat/{code}.jpg"```
Oh I forgot the .src command.. thank you!
Here's your reminder: if not done already
[Jump back to when you created the reminder](#dev-contrib message)
not sure if there was any discussion about it before but
now that python 3.11 rc2 is out, should snekbox be updated to use it or just ignore that version?
I thought about it, but seeing as how there are not going to be any changes included other than bug fixes which have open PRs now till release, I thought there's no point
Bumping doesn’t cost us anything, feel free to PR it (to the correct branch) if you like
It just might take a few days to build and deploy since we didn’t finish the CI for it
!remind 10h30M
Your reminder will arrive on <t:1663146007:F>!
Here's your reminder: See referenced message.
[Jump back to when you created the reminder](#dev-contrib message)
Is there a reason that the docstring of the remind edit command includes that of remind edit duration? Surely the help for a subcommand shouldn't be included in the parent? If you want to know how the subcommand works then you can invoke help on the subcommand -- or even press the button for the subcommand since we have that
!help remind edit
!remind edit
Can also use: remind change, remind modify
*Commands for modifying your current reminders.
The expiration duration supports the following symbols for each unit of time: - years: Y, y, year, years - months: m, month, months - weeks: w, W, week, weeks - days: d, D, day, days - hours: H, h, hour, hours - minutes: M, minute, minutes - seconds: S, s, second, seconds
For example, to edit a reminder to expire in 3 days and 1 minute, you can do !remind edit duration 1234 3d1M.*
Subcommands:
!remind edit content <id_> <content>
Edit one of your reminder's content.
!remind edit duration <id_> <expiration>
Edit one of your reminder's expiration.
!remind edit mentions <id_> [mentions]...
Edit one of your reminder's mentions.
I'm thinking of just removing it as part of my current PR, since it's already in the duration subcommand
1
So... I tried to rip off @dusky shore, but I broke it.
I stole this:
for ext in walk_extensions():
bot.load_extension(ext)
But it gives me this:
RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited bot.load_extension(ext)
How/when/where do these get awaited?
I think lancebot is still using an alpha version of dpy2
Where these are synchronous methods
Oh
Welp
Who can I steal from then?
The Python bot
Bump
Sure
Could someone look at my PR and give me an idea of why linting & tests is failing. I only changed one line of code and I'm a bit confused now.
Due to a recent change in our dependency manager, our CI is broken temporarily
Fyi just pushed this 👍
What changelog version should a PR to botcore have currently? The next one is 8.3.0, but there's already a PR with that version so should I go latest that isn't taken by a pre-exisiting PR?
If you’re coordinating with someone to merge PRs in a certain order, sure
Otherwise no just bump as you need from main
We follow semver strictly
I'm not coordinating with anyone, so I just go for 8.3.0 and whichever gets merged after will have to be changed?
Yeah
Aight
I don’t think you’ll pass linting
Also please use two backticks for the docstring
Single backtick in Sphinx is a different thing than markdown’s
I don’t understand if you want an actual review or not
I mean you can, but I've not tested it yet so things might end up changing slightly to fix bugs with it
@timid sentinel hey do I need to do anything else to get bot#2275 reviewed?
!contribuute
Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!
Projects to Contribute to
• Sir Lancebot - our fun, beginner-friendly bot
• Python - our utility & moderation bot
• Site - resources, guides, and more
Where to start
- Read our contribution guide
- Chat with us in #dev-contrib if you're ready to jump in or have any questions
- Open an issue or ask to be assigned to an issue to work on
Hey anyone here
I would like to be assigned to this issue
Add number guessing game #1082
[lancebot]#1082
it's for the lancelotbot
Or I can add a cellular automaton generator to the bot
sir-lancebot#1082
yeah that's the one
is there anything to do before I clone it and pull request?
It's still not approved - so - get a core dev to approve it
(of which I am not)
oh
ok what about this idea
I already have the code
and it's functional on a another bot I made
Go ahead and make an issue for it
You can technically go ahead and make PRs too - there's just no guarantees if they're not approved
Description Hello, the feature I would like to propose is a cellular automaton generator. like if someone types; .simulate <rule-number> <position: left|center|right|random&...
Hello folks,
I'm having a look at our _create_redis_session function in bot.__main__.py and i saw that the type hints are off.
async def _create_redis_session() -> RedisSession:
"""Create and connect to a redis session."""
redis_session = RedisSession(
host=constants.Redis.host,
port=constants.Redis.port,
password=constants.Redis.password,
max_connections=20,
use_fakeredis=constants.Redis.use_fakeredis,
global_namespace="bot",
decode_responses=True,
)
try:
return await redis_session.connect()
except RedisError as e:
raise StartupError(e)
I'm saying they're off because the connect call returns None.
I know that this isn't that critical, but I'm also guessing it isn't intentional and consistent, right ?
Shouldn't we instead star the connection then return the redis_session ?
the RedisSession.connect method does return self
probably
I'll run the command to update them & check again
had a busy week 😓. Am taking a look now but it seems like there are a bunch of commits on the PR that shouldn't be there, i'm not sure how that happened?
Yeah the history got messy when I merged from main again to get my branch up to date since the linting Github action was failing :/
Did I do it wrong ?
@static canyon I'm looking at your pr for lance command suggests, not sure if it's fully within scope but would you want to add an exclusion for commands beginning with multiple (.) to not report a command error at all? It's a pretty common issue and was part of the original issue post
Yep, that was it.
The other commits shouldn't be there so I think so. I'm not sure how you'd fix it though, maybe someone else here knows?
Maybe by rebasing ? It shouldn't conflict with was is currently there
And in the worst case, I can make a new PR & cherry-pick my commits since there aren't so many, what do you think ?
Addressing that wasn't really part of the issue, and so I'd argue hasn't exactly been approved
I don't see why we need to specifically address that anyway
It just means if you do ...help it'll recommend help since ..help and help are seen as close enough
Is that so bad?
(The thing of having multiple responses is nothing to do with the multi-prefix, if that's what you were referring to by "it's a pretty common issue")
I'll quickly try the solution mentioned here, if it doesn't work you could give rebasing a go, idk https://stackoverflow.com/questions/16306012/github-pull-request-showing-commits-that-are-already-in-target-branch
Do all the bots respond to mentions?
seemd to work
Most do
Yep !
I'll leave you to have a look then.
And maybe we should discuss how we should display the keywords for each rule, and maybe how many keywords per rule are we having now and how many could we have in the future ?
hmm yeah that's true
is our CI broken again?
why is the check failing on that
.github/workflows/lint.yaml lines 73 to 78
# Install our dependencies if we did not restore a dependency cache
- name: Install dependencies using poetry
if: steps.python_cache.outputs.cache-hit != 'true'
run: |
pip install poetry
poetry install --no-interaction --no-ansi```
Not sure why
@gritty wind @vale ibex hello, CI seems to be broken on lancebot. Is this a known thing? (sir-lancebot#1096 and sir-lancebot#1097)
Yes it’s a regression in poetry 1.2 that’s affected all our projects
We’re rolling out fixes as quickly as we can, but we’re limited by a lack of reviewers
So far bot is fixed
We’ll get them all eventually
Cool 👍
CC @fossil veldt (why CI is broken on lance)
And thanks for the review 👍
I don't mind being a trigger finger, but I really don't feel like I know enough about these things to review it
Considering the importance, if both you and Chris approve it it's enough for me
@timid sentinel Fyi I've addressed your review on bot#2232, thanks!
Nice, looks good
@timid sentinel All the changes should be in place for bot#2261.
I've tested it against the cases you've mentioned in your last comment & it works accordingly.
However, what do you think about making the command return the matched rules and we add a test for it ?
Have a look whenever you can, thanks !
bot#2278 is a pretty simple bug and fix if someone wants to approve it
done 👍
As the author, were you wanting to implement the fix yourself?
yeah I'll probably get to it today, but if anyone else really wants to I don't mind
I'll leave it to you 👍
@timid sentinel I don't mind removing that fwiw
it was just copy + paste
we might use it in future 
Nah might as well leave, does no harm
I've been adding it to all the bots 😅
Thanks, have submitted a review. Tests aren't required, although it could be a nice if you'd like to, up to you!
Awesome, thank you.
I've resolved your comments.
This should be the last review for that PR.
does the doc build here https://github.com/python-discord/bot-core/pull/88 fail for anyone else? I can't get it locally with the poetry docs task https://github.com/python-discord/bot-core/actions/runs/3077983162/jobs/4973229590
If you're talking about netlify I believe it's a known issue
I don't think netlify is involved there
I've ran into similar issues
if you delete docs/build and docs/output you should get it locally
not sure how it deals with invalidating the build cache
didn't get anything when I cleared the build and output
I got ```
Warning, treated as error:
C:\Users\chris\src\bot-core\botcore\utils\cooldown.py:docstring of botcore.utils.cooldown.block_duplicate_invocations:8:py:class reference target not found: botcore.utils.cooldown.ParamSpec
got it with a recreated environment, not sure what was going on
Does any one know why my lint-test action is failing here ?
https://github.com/python-discord/site/actions/runs/3078077698/jobs/4973387884
pythondiscord.com - A Django and Bulma web application. - Add a collection of keywords per rule · python-discord/site@49909a3
It's currently failing on all PRs, https://github.com/python-discord/site/pull/772 should fix it when merged
So don't worry about it
Alright, all good then
I'm curious @timid sentinel, how would people know that they can now use keywords to search for rules ?
Aside from watching people who know about it using it
Idk 🤷♂️
We'll post about it in #changelog when it's merged
That will let people know they can use keywords, although doesn't help so much with knowing what keywords they can use :P
Ahahahah true, I'll open up an issue for the new command that lists the available keywords
Yeah, probably best for a follow up PR
Thanks @vale ibex 
Thank you for writing all of them
lol
The url key on the original object doesn't seem to be documented on giphy's api
The GIPHY Developer Portal is how you integrate the world's best GIF API into your business, app or project.
I've tested locally and it's returned by the API
So I'm not sure if this is a mistake on giphy's part, or if we're using an undocumented key that's likely to cause issues again in future
I might suggest changing to data["data"]["images"]["downsized"]["url"]
as that's documented
and also guarantees the image is <2MB
Ah yeah, your suggestion sounds good, similar to what I suggested a while ago when I looked into it (https://github.com/python-discord/sir-lancebot/issues/1050#issuecomment-1116368854).
I do wonder how they came up with what's in the PR though, maybe just from looking at the API response?
@vale ibex @gritty wind What's the reason for using the Poetry installer in the Dockerfile? I fail to see what benefits isolating Poetry itself has when it's going to be the only package installed outside of a venv.
Yeah I don’t mind either way, it’s just what was in the source we copied from
Since we’re using the base image, it doesn’t really matter
Hmm okay. I will PR a change then. Would make the Dockerfile simpler and avoid installing curl
👍
On second though, I think I'll leave it alone.
Because it's in a separate image now, the manner of installation is a bit opaque
And we can't guarantee consumers will not install other packages globally
@gritty wind I'm not following how your action configures the cache directories. Can you explain?
You're caching ~/.cache/py-user-base, but where is this actually being set as the user base dir?
It’s just the default location described in the docs
For the setup-python action?
Yeah
I did not consider that it would change the default user site.
For pip and poetry specifically, the GitHub python action actually mentions those by name
Under caching
I'm not seeing that in its docs
But I guess the poetry and pre-commit directories used are the defaults as well?
You’re right actually, I can’t find where py-user-base is listed
But the other two are listed in their docs for sure
Are you sure it's actually caching the user base then :D
It would emit a warning if a path is missing haha
Though is there any point in caching the user base if we're no longer doing user installs in CI?
Wouldn't you want to cache the poetry venv instead?
Or the site-packages inside of that. IDK... venvs are more finicky since they aren't portable
I’m not sure if it does, but I figured it shouldn’t hurt
But yes I hate the new setup
Installing to the system is no longer a supported use case however
In general I think caching user base was a "weird" thing to do - I don't see anyone else doing that, probably cause it's fragile to some degree. But the reasoning behind that is even if the package is downloaded, there is extra time required to install it. not having to do that can save time.
“Not using venvs in an anti-pattern”
I think the non portability of venvs is mostly with the activation scripts. CI is a controlled environment though. As long as we don't move the venv and cache based on Python version then I think we should be okay?
I think this justification is bogus but the other reason of not wanting to rely on pip anymore was perfectly reasonable. Though I'm not sure if I'd characterise user installs as too niche to replicate as a Poetry feature.
me tuning out packaging bullshit and using requirements.txt
I’ve come to understand you ways, science man. And I must say, you’re a genius
If I commit a suggestion from someone does their approval still count (as they'd be co-author, no?)?
Yea, coauthors are fine
It's only when some commits to the branch they can't approve
Whether that's an entirely new commit or a rebase
I concur with mbrauh there, apart from it making a grid of cell based on some rules, I have no idea what it's doing with the arguments
the arguments there make the generation happen
the rule-number says which type of automaton happens
the position tell where to place the starting cell
Explain how it works in the issue then, e.g. how the number relates to what's going to happen
I did
i think
done
The bot repo has a CustomLogger class that adds a trace method to prevent linting highlights. I've noticed that sir-lancebot has logging, uses .trace, but gives linting warning because it doesn't have the custom class.
Can we do a PR moving the class to bot-core instead, so that it's accessible by both bots?
It's being bot core that is, my pr didn't change logging
Didn't want to double the size of the pr lol
So bot and lancebot (currently) don't use the bot-core class?
Not sure
It doesn't seem so
Should be possibly to check
here is an example of a generation gif
this is rule 60, with a single cell in the center
I'll start with bot, and then check out lancebot
Can you link your PR please?
Not easily, I'm on mobile
Ah no worries
There's only like 4 prs on lance atm
Yeah, I'll look
the bot will send a picture of the output not gifs since a gif takes time
That comment was a response to tizzy, not you
I know I mistaking replied to it
Ok
Am I right in saying that this still needs to stay in bot? https://github.com/python-discord/bot/blob/main/bot/log.py#L45-L129
It's the setup(), setup_sentry() and _set_trace_loggers()
I thought that adding tests never hurts, so take a look at the new changes if you'd like.
It's currently waiting on some other things, but could use a review or two on https://github.com/python-discord/bot-core/pull/88I
Can the "the code jam is under way" banner be removed from this page? https://www.pythondiscord.com/events/
Yes. Want to create the PR? :)
can't do it now, i'm afraid. i might be able to do it tomorrow evening if someone else doesn't, i don't particularly care.
@static canyon sir-lancebot#1096 fixes the on command error but doesn't address the ...... part as in ......what is still triggering the command suggestion while it shouldn't be since to me it seems like Lance should only trigger if the message matches ^\.[^\.\s]+. Should I open a new issue and reference sir-lancebot#1900?
It was never supposed to address that
It wasn't in the issue, and so didn't get approved, and so I didn't implement it
You can make another issue if you'd like to, and if it's approved I'm happy to implement
Lovely
Do we have some way to keep up with new posts in Discourse? #mailing-lists message
they seem to support RSS feeds for most things, but we also have to consider how much of it (more specifically, which categories) we would want to keep up with
No longer reaches the proper audience
Why? Because they all retired of old age?
Mailing lists man
Yeah I think we'll want to keep track of specific categories like the PEPs
@timid sentinel RE bot#2232
Would something like Mentions: <@user> (user#discrim) be good?
yeah that sounds fine
iirc there should be a method in member utils for that
Doesn't seem to be
There's get_or_fetch and handle_role_change
Hmmmmm
its in the messages utils iirc
Hey @brazen charm your change seems to be merged into sphinx autodoc typehints. I just tried it locally and it seems to work.
If you want to pin the version to https://github.com/tox-dev/sphinx-autodoc-typehints/archive/d8a9b9c19450268f46fc89b048f8f1efb9bc248c.zip and relock I'd be happy to merge once CI passes
obviously when a full release is made we can pin to that version instead
re bot-core#88 for context
I think a proper release will go out today or tomorrow, if my last contribution there is anything to go by
ah alright fair enough, no need to rush then
The util returns the id alongside the mention, not the name#discrim
Which imo is pointless here because the whole point is we want to display extra information for when the ping doesn't render
If the ping doesn't render then people will already see the id
Fyi just pushed @timid sentinel
I'm writing a PR where I move the re-run logic of !e into bot-core, and I'm trying to also fix a bug with the logic.
After an edit, the bot just assumes everything after !eval is the code, even though it could be a different command argument (in this case, specifying the python version to use)
!eval 3.10 print("hello world")
@static canyon :x: Your 3.10 eval job has completed with return code 1.
001 | File "<string>", line 1
002 | 3.10 print("hello world")
003 | ^^^^^
004 | SyntaxError: invalid syntax
I.e. this is a valid invocation, but doesn't work when you do it through an edit
What's the best way to fix this?
My current solution is to have the user specify what args can be changed, and then see what actually changed, and go from there (and return what can be changed if everything went correctly)
Is it possible to re-parse the message as a command and get it arguments, without actually executing the command again?
On second thought, that command may rely on additional parsing within rather than just on d.py
So if that's the case, maybe refactor the parsing into a separate function?
Yeah, it is
!d discord.ext.commands.Bot.get_context
await get_context(origin, /, *, cls=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Returns the invocation context from the message or interaction.
This is a more low-level counter-part for [`process_commands()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.process_commands "discord.ext.commands.Bot.process_commands") to allow users more fine grained control over the processing.
The returned context is not guaranteed to be a valid invocation context, [`Context.valid`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.valid "discord.ext.commands.Context.valid") must be checked to make sure it is. If the context is not valid then it is not a valid candidate to be invoked under [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
Note
In order for the custom context to be used inside an interaction-based context (such as [`HybridCommand`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.HybridCommand "discord.ext.commands.HybridCommand")) then this method must be overridden to return that class...
Via that ^
I mean I got close, but then dpy didn't have a feature to return {command_arg: value_used, ...} from a Context object (or at least, I can't find it)
Which I needed
If I had that I'd be set
The closest I can get is using ctx.args and pairing to ctx.command.clean_args, but there's no fool-proof matching since first provided arg (given by .args) isn't necessarily the first possible arg (given by .clean_args)
As an example of my end goal:```py
@bot.command()
async def greet(ctx, name: str = "World"):
"""Will keep saying hello until the user doesn't edit name anymore."""
print("running")
while True:
response = await ctx.send(f"Hello, {name}!")
changed_args = await check_rerun_job(ctx, response, args_user_can_change=('name',))
if not changed_args or "name" not in changed_args:
break # user didn't change the name, so stop saying hello```
I'll look into this later this evening and let you know if I think of a good solution.
Thanks, appreciate it 😄
Honestly if it's resending the result anyway, we could make it re-run the command on the message
Pretty sure there's something in dpy for that
The code change will be mostly not having a loop anymore, since if the rerun reaction is pressed, it creates a task to rerun the command and then just ends
Yeah, I think you're correct.
One difference would be that the stats would count every re-eval but that's fine, and we probably should've been doing that already.
I was trying to avoid that, but I don't think I can really
So that's most likely what I'll end up doing
Which is annoying considering how close I was to making my way work
I'll need to see whether error handling works properly when reinvoking, but I don't see why it wouldn't
Yeah it can happen, some case that's only discovered in testing. But it seems like a good way to solve it, I use re-invocations in the filtering rewrite and it seems to work well
Yeah, that's fair. I'll test reinvoking whenever I get time
Good to hear it works for filters
So I thought this was going well, until I tried subcommands...
Apparently bot.get_context will get the parent command, not the subcommand
And so when I check to see if the command changed, it says it did (even though it didn't)
Now I can just not check the command is the same, but that means it allows you to invoke other commands when editing, which I imagine we don't want
Tl;Dr; when using subcommands ctx.command != (await ctx.bot.get_context(ctx.message)).command even though it's the same message being parsed
From how I see it, we either let the user edit the message into a different command (meaning e.g. an !eval invocation could become a !ping invocation), or don't let users re-run through edit
I don't see a big issue with letting users edit into other commands, other than it's not intended behaviour and can't be done unless the command has the util for re-running
@clever wraith I have a project you can contribute to.
ill see if i can be of any use
Do you know what an api is
yes
Do you know what an api wrapper is?
*not new to python or coding in general
yes
Alr. What’s ur most advanced/complex project
worked on https://localmonero.co (EDIT, i worked with the OWNERS regarding escrowing funds)
created https://bitdaily.xyz
Earn crypto with other 30,702 users! We have paid over $17,393 in crypto and processed 0 withdrawals! Earn crypto with many different ways! 50% Referral rewards!
just bored tbh
no longer work on any of them, for clarification
Wait u made ur own cryptocurrency and platform for it?
no, i made my own platform for cryptocurrency transactions
the simpliest way to explain what i made:
a framework for verifying, sending, and notifying if a transaction has been complete
@clever wraith @midnight jasper this channel is not for discussing projects other than the ones here on PyDis. You should move your conversation to one of the off-topic channels
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
The dog guy told us to come here bc he was looking for a project to xontrivute to
Maybe it was jsut to contribute to pydis projects?
Idk
ye
Yes, that's probably what they meant.
Why do you need to know if the command changed? Also if it's not in the command maybe it's ok the args?
If you run the command from the ctx it should just work
Why do you need to know if the command changed?
To stop them editing it into a different command 🤷
We don't have to do that, but it seems odd to allow behaviour that isn't a feature (i.e. you can't edit any command into a different command)
Hmmm right
maybe it's ok the args?
That... might work
In the args*
Yeah
It doesn't work unfortunately
Because ctx.command is a Group, which doesn't have .args
It presumably has something to realise there's a subcommand though, so maybe I can find that
Ctx.args
An empty list
Weird
Gonna delve into the source code and see if I can find anything
This seems to be the code that detects a subcommand https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/core.py#L1619-L1632
discord/ext/commands/core.py lines 1619 to 1632
ctx.invoked_subcommand = None
ctx.subcommand_passed = None
early_invoke = not self.invoke_without_command
if early_invoke:
await self.prepare(ctx)
view = ctx.view
previous = view.index
view.skip_ws()
trigger = view.get_word()
if trigger:
ctx.subcommand_passed = trigger
ctx.invoked_subcommand = self.all_commands.get(trigger, None)```
I think I've got it
I just need to a recursion support so sub-subcommands, sub-sub-subcommands, etc. work
It's looking good
oh hey, sir-lancebot#1092 is looking mighty fine to review 
Maybe not. Don't think I can make it recursive, since I need a ctx.view again which won't exist for the command object
I can probably figure out an iterative approach (maybe)
Work all of the commands, and see if any match
new_ctx = await ctx.bot.get_context(ctx.message)
if new_ctx.command is ctx.command:
await new_ctx.command.invoke(new_ctx)
return
else:
print("not same command, so trying to get subcommand")
if not isinstance(new_ctx.command, Group):
print("not a group so can't have subcommand")
return
group: Group = new_ctx.command
for command in group.walk_commands():
if command is ctx.command and new_ctx.message.content.startswith(ctx.prefix+command.qualified_name):
print("FOUND SUBCOMMAND!")
await new_ctx.command.invoke(new_ctx)
return
await ctx.send(":warning: Aborted since you changed the command.")```this *seems* to be working perfectly
Nvm
If you invoke a parent, you can then edit into a subcommand
What do we think about adding a !http command to look up what all of the codes mean? I know we have one that is kind of memish with the cat images, but it doesn't offer an explanation
The one we have is !http_status
Currently .http_status picks a between cat and dog randomly if not specified
We can change that, so that if you don't specify it gives you the "formal" description
Adding the .http alias if it isn't there
ok but can it tell me the correct code to use
There's a flowchart for that
What could be simpler than returning HTTP status codes? Did the page render? Great, return 200. Does the page not exist? That’s a 404. Do I want to redirect the user to another page? 302, or maybe 301. I like to imagine that HTTP status codes are like CB 10 codes. "Breaker breaker, this is White Chocolate Thunder. We've got a 200 OK here."— Aaro...
Quite old, so doesn't have the new "hip" codes twitter is trying to make happen, but gets the job done for everything else
Oh, I lied, it does
"are you twitter" hahaha
@summer garden did you want to do this yourself?
yeah I would

I'll probably do this over the weekend
I envision an embed for it with a link in the title to some more concrete info
can we just do a big enum for all of the codes?
there's one in the http built-in
it'll resolve codes to their short meaning
and as you say, we can link out for more info
The python http library?
Yea
I'm looking and there seems to be some missing. I was looking for 111
http.HTTPStatus
Are there a bunch of different standards?
code 111 came up earlier today so i had it memorized
A cache SHOULD generate this when sending a stale response because an attempt to validate the response failed, due to an inability to reach the server.
I thought warn codes were deprecated?
Yea
Was deprecated in rfc9111
Should they be included for the sites that may still be using them?
rfc7234, the one that webconcepts links to, has at the top that it was Obsoleted by: 9111
Hypertext Transfer Protocol (HTTP/1.1): Caching (RFC 7234)
HTTP Caching (RFC 9111)
I'd rather not, since it would mean maintaining our own list, and potentially signalling that they're still ok to use
warn codes are in addition to http response codes
they're a separate header
After way, way too many hours, I've finally got a solution for a re-run util. I'll upload it to GitHub tomorrow, but here's the code on a paste: https://paste.pythondiscord.com/jazuvifome
CC @cold island @tawdry vapor
Wikipedia has some good reference articles for all the codes that goes beyond just their usage (history and stuff). You could use that for the external link
Don’t need to hardcode it either, just ask the api for the url, or use a string template
mdn good
history and stuff could be cool though
Maybe both? Not sure what the embed would look like
The specific code link can be in the title and the "find out more" wikipedia link in the footer?
Yea, that could be good
pushing people to mdn in general is good, it's an amazing resource
I've now pushed to GitHub, and it's ready for review 👍
bot-core#137
Hi 🙂
EnvCommandError
Command C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-INSnasTY-py3.10\Scripts\pip.exe install --no-deps C:\Users\tizzy\AppData\Local\pypoetry\Cache\artifacts\21\17\d4\ad0f3a8b93e95e364982481a40ecad444c6a57d5fad7c43f74c4283a04\emoji-2.1.0.tar.gz errored with the following return code 1, and output:
Processing c:\users\tizzy\appdata\local\pypoetry\cache\artifacts\21\17\d4\ad0f3a8b93e95e364982481a40ecad444c6a57d5fad7c43f74c4283a04\emoji-2.1.0.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error
pip subprocess to install build dependencies did not run successfully.
exit code: 1
[3 lines of output]
WARNING: Skipping page https://pypi.org/simple/setuptools/ because the GET request got Content-Type: Unknown. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/html
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
pip subprocess to install build dependencies did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\utils\env.py:1195 in _run
```Trying to redo the env for my local lancebot, and getting this error (failing to get setuptools>=40.8.0). Anyone have any ideas?
A manual pip install emoji==2.1.0 seems to have worked 🤷
Try poetry cache clear --all
WARNING: Skipping page https://pypi.org/simple/setuptools/ because the GET request got Content-Type: Unknown. this seems like the important line
Also, what version of poetry are you on?
updating might help if you're not on latest
It should be the latest
Or near enough
1.1.14 apparently
RE sir-lancebot#1079
The code snippets feature uses wait_for_deletion, which currently isn't in lance or bot-core. In fact, bot-core is missing all the message utils, so should I create a PR on bot-core adding these before doing the lance PR?
Try updating to 1.2
1.1.16 apparently fixed a caching issue
What's the best way to update it?
Poetry self update is a thing in a recent version, not sure if you have it
If not, do the pipe to python thing shown on the website
Yeah, it seems to be running 👍
The command worked, but now poetry is broken```py
Traceback (most recent call last):
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\tizzy\AppData\Roaming\Python\Scripts\poetry.exe_main.py", line 4, in <module>
ImportError: cannot import name 'main' from 'poetry.console' (C:\Users\tizzy\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console_init.py)
Aight
I... don't think it did?```py
PS C:\Users\tizzy\sir-lancebot> poetry --version
PS C:\Users\tizzy\sir-lancebot>
I mean the error is gone, but no output
Same for things like poetry --help
Re-invoking the command on website just says it's already installed
Huh
That's likely the problem 😅
bump btw
if anyone has a chance, a second review on bot#2245 would be good
I'll try to review it tomorrow
yea, having that in bot-core seems reasonable
reviewed
you're welcome
Thanks!
lol
Should I move all the message utils? (from both bot and lance)
Don't think they rely on any :)
Ah, bot has Emojis, MODERATION_ROLES, NEGATIVE_REPLIES
So how do we approach that?
depednds on the nature of how they're used
they could be hard coded into bot-core if appropriate
alternatively, we could do something similar to how the roles get passed into the generic view
I'll take a look and see
lmao
The only issue I'm having atm is figuring out the botcore equivalent of bot's bot.instance
right_reaction = (
user != bot.instance.user
and reaction.message.id == message_id
and str(reaction.emoji) in allowed_emoji
)```
you could refactor that to be not user.bot
slightly different behaviour, but still fine
Very true
Yeah
try:
try:
await bot.instance.wait_for('reaction_add', check=check, timeout=timeout)
except asyncio.TimeoutError:
await message.clear_reactions()
else:
await message.delete()
except discord.NotFound:
log.trace(f"wait_for_deletion: message {message.id} deleted prematurely.")
```in `wait_for_deletion`
I guess make the util take bot as an arg, with a typehint of commands.Bot?
This is what I've gone with for now
A PR has been opened! bot-core#141
hmmmm is there a way to do something when a modal is canceled?
I guess there's no response so the modal object wouldn't know...
My code is such a hot pile of garbage, I'm surprised it actually does what I want 
Hello folks !
I was going through the different issues that we have in our bot project, and I've seen a lot of ones related to filters so it got me intrigued to how it works.
Is there a particular way you'd recommend to have a high level overview of our filtering system & then deep dive ? Or shall I just browse the code ?
If you mean message filtering, I'm probably handling most of them atm. Maybe I should assign myself properly
I know you are, I saw all the issues & I was wondering if I contribute, but then I was like "I have no clue of how it works"
But yeah, maybe they should be assigned to you
I'll try to document it properly when I open the PR, but atm it's mostly work that can't really be split
I was mostly looking at bot#1379 now, is that something you're working on ?
Ah no, like the issue says it's not blocked by my work
Yep, I saw that, but then I when you said "I'm probably handling most of them atm", I thought this could be another thing you're working on & unassigned to you
Alright !
yeah there are some things there which aren't blocked, just wasn't sure which you were referring to
Anything that's related to how a message is processed is probably not blocked
if you need help to find the relevant code that needs changing lmk
I'm actually looking at it atm.
I just need to reproduce the issue with a mobile twitter link.
I'll make an account & see what I can make out of it, thanks !
Should I assign you then?
Gladly !
ok, can you comment on the issue?
Sure thing
man, it's too easy to click the "assign yourself" button. Assigned you now
Ahahahha I saw that, thanks !
Is there an extra step when running migrations on site?
found it
Is it possible to do it in the container? it says the fs is read-only and I'd rather not set up everything locally
I believe what you're seeking was discussed here https://github.com/python-discord/site/pull/622#discussion_r757771435 and we never figured out a solution
Ah there's poetry run task dockermigrations, nice
yea, my intention was to add that in that PR
but there was some odd file permission issues on linux that I couldn't fix as I didn't have a linux machine to reproduce the error and investigate
Yea :D
What about Mark's suggestion in https://github.com/python-discord/site/pull/622#discussion_r776490897 ?
Yea I think that's what we'd want to change the task to
it doesn't solve the permission issue though
then.. it doesn't work?
why specifically linux?
File permission differences
hmmm
as in, the PR works fine on my windows machine
but obviously we want it to work on linux before merging too
alright.. I'll just steal the command from the PR in the meanwhile
you'll need to add the compose volume(s) too
lol
How do I setup the webhook in these cases ?
Am I supposed to create a webhook to the same TextChannel and put its id in the config.yml ?
Is that documented somewhere ?
Ok found it
Found out what to do I mean
But still curious about this
I think the setup guide for the bot has a page that explains how to create a webhook and get its ID.
Does anyone have comments on this? https://github.com/python-discord/bot-core/pull/88#discussion_r897390979
I don't remember seeing it, maybe I didn't pay much attention
Also, on this line https://github.com/python-discord/bot/blob/71fbd5aa7ef8fdf3547dbae845cf7e6b9bc08277/bot/exts/moderation/watchchannels/_watchchannel.py#L131
remove_cog isn't awaited, isn't that a bug ?
bot/exts/moderation/watchchannels/_watchchannel.py line 131
self.bot.remove_cog(self.__class__.__name__)```
If it's a coroutine function and it's not awaited then yes it's a bug
It's an async function, yes
I've just opened the issue, and it's bot#2281
I'll include the fix in another PR that I'm working on, so it'll be great if you can assign it to me.
Thanks!
Hello folks,
I need to make a function that does some string operations on a URL.
This will be used in the watch_rich_embeds filter to fix a bug mentioned in bot#1379
Does it need to live in bot only ? ( If yes, maybe in bot.utils.helpers ? ) or in bot-core ?
Alright, thanks !
If someone wants to have a look, it should be rather quick in bot#2283
Wait: where did the announcement about the shortcut tags go for rules?
Sheesh. Okay thanks. I thought I was going crazy
... or at least more crazy than normal
fwiw I just tried it on Windows and it gave me the read-only error
I need help with solving task based on Lagrange theorem
Does somebody here know math good enough?
Interesting, I wonder if it's a docker version change, I haven't tried it myself recently
The thing is we're mounting .:/app as read only, and then a more specific path as writable
So there may be odd interactions there
Which issue are you working on?
Express number as a sum of 4 squares
No, i mean which issue on our github repo?
What's github repo?
This channel is for discussing Python Discord projects, found here https://git.pydis.com/
Check the channel description
If you're not here for help related to one of our projects, your best bet it to read #❓|how-to-get-help
anyway, for now it might be easier to run the site locally, connecting to the other services using compose
DATABASE_URL=postgres://pysite:pysite@localhost:7777/pysite
METRICITY_DB_URL=postgres://pysite:pysite@localhost:7777/metricity
SECRET_KEY=suitable-for-development-only
STATIC_ROOT=/var/www/static
DEBUG=1
Is it possible to mount it as writable?
we could mount app as writable, the only reason it isn't is that if the code gets altered by the images somehow, it wouldd be reflected on the host too
but I guess that's no different to running on host
we could make a new docker compos spec, with the app volume mounted as writable
then if you want to run migrations in a fully docker setup, you can use that compose file instead.
Update the compose file and dockerapp file.
The development app from the compose file will now apply migrations on boot and additionally, it will use Django's development server along with the current directory mounted read-only into the container in order to support code reloading, helpful while development.
@last patio a commit you made in 2018. Are you saying that without read-only code reloading won't work?
Or were you saying it's mounted to support reloading
If it was the case back then, it isn't anymore
this
mounted read only to prevent permission messes
just get a better os 
thanks
I heard rocky was good
bot#1
sir-lancebot#1
Could I get some help with pre-commit
Flake8...................................................................Failed
- hook id: flake8
- duration: 0.92s
- exit code: 1
C:\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
The command line is too long.
You can probably ignore the poetry warning, I'm just not sure if the The command line is too long. is part of it or not
Thanks Chris
Flake passes on it's own
(This is the most verbose output I could generate)
It's the flake and pre-commit versions from this PR https://github.com/python-discord/site/pull/769
can we bump versions in .pre-commit-config?
flake8 = "5.0.4" and pre-commit = "2.20.0"
Sure, but pre-commit uses system local flake
So it doesn't matter
Ah
Using local flake is a source of so much pain
But specifying all linting dependencies twice is not great either
Here's the flake config (unchanged from master):
- repo: local
hooks:
- id: flake8
name: Flake8
description: This hook runs flake8 within our project's environment.
entry: poetry run flake8
language: system
types: [python]
require_serial: true
That would be my system setuptools, and I'm pretty sure it's producing a warning because it's too up to date
I'm already on Version: 65.4.1
Poetry is doing something in a fashion that has been deprecated
So I'd need to downgrade to remove that warning
Or wait for poetry to fix it
Fun
I technically could just ignore this since CI does not run flake through pre-commit 
But then no one would be able to commit to site
Which does seem like an oversight
Yeah I fixed that locally
Ahh right, the error above from locally?
site-py3.10C:\Github\PyDis\site>flake8
.\pydis_site\apps\api\tests\test_github_utils.py:31:68: B026 Star-arg unpacking after a keyword argument is strongly discouraged, because it only works when the keyword parameter is declared after all parameters supplied by the unpacked sequence, and this change of ordering can surprise and mislead readers.
site-py3.10C:\Github\PyDis\site>flake8
site-py3.10C:\Github\PyDis\site>
Yeah so flake passes now
Just pre-commit is broken big-time
try remaking the precommit env?
pre-commit uninstall iirc
Nah that would just get the hook
clean is just for cache
Clean seems to have done it
As well as deleted all the deps for all the projects on my system
Use with caution lol
Anyway, flake is still failing in pre-commit
I've pushed all my local changes now, you should be able to see the same things I'm seeing
I imagine CI is going to pass, so I've locked down the PR
running locally now
Uhhh
CI failed lol
Interestingly, I did get that warning locally, but only on one file
I removed require_serial: true from the pre commit config and it ran fine locally
I can confirm the same result
I also got like 400 deprecation notices, which is interesting
65.4.1
🕙 16:05:38 ❯ poetry run task lint -v
Check for merge conflicts................................................Passed
- hook id: check-merge-conflict
- duration: 0.24s
Check Toml...............................................................Passed
- hook id: check-toml
- duration: 0.21s
Check Yaml...............................................................Passed
- hook id: check-yaml
- duration: 0.35s
Fix End of Files.........................................................Passed
- hook id: end-of-file-fixer
- duration: 0.32s
Mixed line ending........................................................Passed
- hook id: mixed-line-ending
- duration: 0.28s
Trim Trailing Whitespace.................................................Passed
- hook id: trailing-whitespace
- duration: 0.3s
check blanket noqa.......................................................Passed
- hook id: python-check-blanket-noqa
- duration: 0.23s
Flake8...................................................................Passed
- hook id: flake8
- duration: 4.84s
Unable to find qualified name for module: manage.py
Lol what
If you still have it up, could you run tests?
These are straight up exceptions not just deprecations
And I can't repro
yea will do now
just need to rebuild everything
I cleared my docker system not long ago
Ok I found where the deprecations are coming from
Weird it didn't pop up when running the project itself, seems django's deprecation warnings only come up when the code is activated
I guess that works out for us since we have a 100% coverage requirement on site
from datetime import datetime this is going to be the bane of my existance today
it completed 248 tests without any warnings
out of 285
rerunning a few times it never got passed that
You have to explicitly enable warnings as an env var
set PYTHONWARNINGS=error
Deprecation warnings are disabled by default
It's fine, I've gone ahead and fixed everything
cool cool
Tests seem to be taking significantly longer now
Fuck
2 3 4m and going compared to the 18s on main
I wonder if it's broken
My test suite is consistently getting stuck
Ok, perhaps one of the tests is now broken on linux machines, any idea which one?
when I ctrl+c it's always on File "C:\Users\chris\src\site\pydis_site\apps\redirect\tests.py", line 32, in test_redirects
Since I'm running through pycharm
I'm running poetry run task test
As I've said before, we should delete the redirects app
test = "coverage run manage.py test"
Ok, this is a good lead, thanks chris
The only other line I can see in our code is File "C:\Users\chris\src\site\pydis_site\apps\resources\views\resources.py", line 117, in get
How are you still getting the whitenoise error
That should be fully suppressed now
Ok repro confirmed
And now I've confirmed it's only if you run through manage.py
It seems to be a django test runner issue, not something in our config/usage specifically. If I bypass all the test stuff in our config and just have it run through manage.py normally, it still freezes
Seems to be an issue with django 4.1.*
Running it with a debugger, there doesn't seem to be any place where it freezes or takes an unexpected amount of time
Although I've only tested one redirect
Ok, seems it isn't all redirects, just a specific app most likely
Ok, seems that all 10 resource redirects take >12 seconds per resource
These are all dynamic
Seems like the django render function is responsible
Maybe the template is pulling in network resources?
Well it would've failed my original test then hmm
Ok found it, there does seem to be something here: ```html
<div class="content is-flex is-justify-content-center">
<div class="container is-fullwidth">
{% for resource in resources.values %}
{% include "resources/resource_box.html" %}
{% endfor %}
</div>
</div>
This block alone takes 15 seconds per resource
That includes ~72 resources in total, the question is why does it start taking so long after 4.1
Huh, it takes just as long on django 3
Hmm, running now with the same version as CI, it's still really slow
Does include make a subrequest of some sort
Well actually, if downgrading did not resolve the issue, perhaps that's a red herring
I did actually make another change in this PR to the redirects app itself, but I don't see why that would be the cause when it's resources that's failing, not all redirects
It was not the cause
I reverted all package changes to what's on master, and reverted to python 3.9 which fixed the issue. Now i have the incredibly fun task of again bumping each dep one by one till the issues start again
It was sentry
sentry is pretty recent in the call chain for my error
Well sentry would be present in literally anything that uses the client since it wraps the requests
true
I have no idea why it slows things down, why specifically for this page, and why on includes
So does it all work well fi you bump everything but leave sentry?
I'm working on that now
Downgrading sentry does indeed resolve the issue
Do we just disable sentry in tests
currently writing a script that checks every version between 0.20.3 and latest to see where it fails
I'd start with 1.9.8 since 1.9.9 does not install in python 3.9
Smells of broken release
So IG we just pin to 1.9.8 for now
Their django update is marked as ongoing
so maybe it'll be fixed
Why does pip just now show anything if I run pip show sentry-sdk
Mildly/highly concerning
Ah wasn't in venv
Ok agreed
Stickers don't work for me, so I just assume that's the skill issue sticker
Would be a real shame if it loaded and it wasn't that
I won't spoil the surprise for you
So much so that you might just have to edit your message now before it loads
Now this is the real skill issue
Are you running through manage.py?
Or the poetry task
Oh static preview failed
so both?
nnice