#dev-contrib

1 messages · Page 23 of 1

trim cradle
#

what is the point of the trashcan except to give people a way to ignore instructions that make it easier for (and thus at the expense of) volunteers to help them?

cold island
#

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

trim cradle
hard topaz
trim cradle
trim cradle
#

@upper storm your message was removed for soliciting labor and for being off-topic for this channel.

outer oasis
#

Tiny docs-only PR: bot#3237

dusky shoreBOT
outer oasis
#

Are the docs inventories refreshed on a schedule or only on demand?

cold island
#

Bot restarts could be called a sort of schedule I guess 🙃

outer oasis
vale ibex
#

Iirc inventories are cached in redis, so I dont think bot restarts would refresh

#

I did a manual refresh yesterday though

vale ibex
#

bot#3231 and bot#3340 for two help cog improvements

vale ibex
#

bot#3240

dusky shoreBOT
trim cradle
#

@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"
cold island
#

Don't show the world this abomination. I just wanted something that worked 🫣

foggy egret
#

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()

lusty nacelle
#

hello

#

i want to contribute to this

dim pelican
#

Welcome

#

!contribute

stable mountainBOT
#
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

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
lusty nacelle
#

how can i reproduce that message "Full output:[link]"

#

and what part of code should i look for

dim pelican
#

Maybe the eval handles it

#

!src eval

stable mountainBOT
#
Command: eval

Run Python code and get the results.

Source Code
lusty nacelle
#

thank you , but how can i get that message , to test my changes

dim pelican
#

With a truncated output from the bot

#

!e

for _ in range(100):
    print("Hello")
stable mountainBOT
lusty nacelle
#

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

dim pelican
#

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

lusty nacelle
#

okay thank you

#

i did this for now

#

what do you guys think about it ?

cold island
lusty nacelle
#

like this

lusty nacelle
#

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

obsidian patio
#

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

vale ibex
#

@waxen zealot @fresh hazel @placid stump @wary falcon This channel is for discussing Python Discord projects. If you need help, ask in #1035199133436354600

thorny obsidian
#

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?

obsidian patio
#

Might be around, feel free to ping

rapid swallow
rapid swallow
#

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

stable mountainBOT
night tide
#

Hi folks! I'm trying to setup 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? sorry for the noise, I forgot to invite the bot to the server 🤦‍♂️

#
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
night tide
#

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.

cold island
#

good catch about the message intent, it was probably written before it was a thing

granite plaza
#

Anyone bored want to take a crack at this?

#

I think the best option is

  1. If the library is specified use it. !d lib1.hello.world !d lib2.hello.world
  2. 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

outer oasis
#

Isn't there a relatively low limit on the number of items in autocomplete?

#

Also, can they even be adjusted dynamically?

granite plaza
#

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

outer oasis
#

The list itself

granite plaza
#

yeah, you can return whatever 25 (or less) elements you want

outer oasis
#

When I do !doc refresh, can the list of autocomplete-able items be edited while the bot is running?

granite plaza
#

what does doc refresh do?

granite plaza
outer oasis
#

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>"]

granite plaza
#

So when a lib updates !doc does not auto update?

outer oasis
#

no

granite plaza
#

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

cold island
granite plaza
#

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

cold island
#

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

granite plaza
#

Thats how some of the discord bot libraries work
Library names py-cord disnake and discord.py import name discord

cold island
granite plaza
#

the latter

cold island
#

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

granite plaza
granite plaza
thorny obsidian
granite plaza
#

No but it is the same principle

cold island
#

Because it's a UX question. I'd rather inconvenience a relatively small minority with an extra step than inconvenience everyone

thorny obsidian
#

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.

granite plaza
#

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

cold island
#

I think a 1:9 ratio is pretty significant

thorny obsidian
#

Inconveniencing the other 90% is not a good option

granite plaza
#

i dont really get how clicking a single button is an inconvenience.

granite plaza
thorny obsidian
#

An extra action everytime adds friction and becomes tedious. Especially when 90% want the same option. It really adds up

thorny obsidian
granite plaza
thorny obsidian
granite plaza
#

pip install discord.py is the correct way to install not pip install discord

thorny obsidian
#

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.

cold island
cold island
granite plaza
#

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.

granite plaza
cold island
#

That's why in large programs with lots of choices you will often have a toolbar with common choices

cold island
#

I just don't think it's a good reason to require a dropdown selection every time the top-level name "discord" is invoked

sharp crag
granite plaza
#

So just assume discord.py and if you give false information to someone its fine because you are right most of the time?

sharp crag
#

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

granite plaza
#

I constantly help people who have mismatched code and library

fervent sage
#

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)

sharp crag
#

yeah not a fan of that either, though i don't hate it as strongly as you do :P

trim cradle
#

@plucky lark wants to make a contribution to the bot. but he doesn't know what to do.

plucky lark
#

Big balls

trim cradle
plucky lark
#

Okay 😦

trim cradle
plucky lark
#

Oki doki

tame pebble
plucky lark
#

Not yet, ill check it out today

night tide
#

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? 🤔

sharp crag
#

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

thorny obsidian
#

Will refreshing doc inventories actually fix the error popping up in dev log?

rapid swallow
#

!d refreshdoc

stable mountainBOT
#
Inventories refreshed
night tide
#

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?

GitHub

The community bot for the Python Discord community - Issues · python-discord/bot

stable mountainBOT
#

bot/exts/moderation/infraction/superstarify.py line 106

@command(name="superstarify", aliases=("force_nick", "star", "starify", "superstar"))```
night tide
#

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? 🤔

vale ibex
#

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"

rapid swallow
#

oops i was scrolled a bit up

wind ruin
#

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

rapid swallow
cold island
#

An admin can int e and check which item has that id

vale ibex
#

If you hover over the URL or open it, it's a few different symbols causing this

cold island
#

I'm guessing something changed in how we parse the inventory files?

thorny obsidian
night tide
#

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?

thorny obsidian
sharp crag
night tide
night tide
vale ibex
#

!d refreshdoc

stable mountainBOT
#
Inventories refreshed
vale ibex
vale ibex
# night tide Quick question: do we have any interest in adding tests to sir-lancebot?

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)

vale ibex
night tide
night tide
#

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

vale ibex
#

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?

night tide
#

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": "🐺"
  }
}
vale ibex
#

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

night tide
#

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
    }
}
vale ibex
#

Yeah, either switch to using a pydantic.RootModel, or add another level like you have there

timid sentinel
#

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.

vale ibex
#

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

timid sentinel
#

yeah

night tide
#

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.

digital zephyr
#

I'm looking to contribute

#

Is anyone interested

dim pelican
stable mountainBOT
#
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

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
digital zephyr
#

Thank

royal prawn
#

!e from scipy.ndimage import convolve

stable mountainBOT
# royal prawn !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

royal prawn
#

can this be easily fixed

#

also, apparently neither of the snekbox 3.13s have scipy 😔

dusky shoreBOT
outer oasis
cold island
#

you can set an environment variable to make it work on one thread I believe

outer oasis
#

Yeah it says that in the error message, I just didn't know if a smaller number of threads would cause problems

cold island
#

nah, it'll just be a bit slower

#

you shouldn't use large inputs with snekbox anyway

outer oasis
#

oh wait what

stable mountainBOT
#

config/snekbox.cfg line 13

envar: "OPENBLAS_NUM_THREADS=5"```
outer oasis
#

it's already set

tawdry vapor
stable mountainBOT
#

config/snekbox.cfg line 103

cgroup_pids_max: 6```
mossy wolf
#

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

vale ibex
wind ruin
# mossy wolf Hey there. I saw that you guys forked the modmail-dev/modmail bot and made some ...

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)

mossy wolf
#

I feel like it's respectful to still ask even if the license allows it

wind ruin
#

yeah fair

mossy wolf
#

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

wind ruin
vale ibex
#

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

wind ruin
#

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)

vale ibex
#

lol

mossy wolf
#

thanks. I've made the PR now

#

I can add that to my CV as well

  • Used git cherry-pick once
vale ibex
#

hah nice

thorny obsidian
stable mountainBOT
#

bot/exts/fun/duck_pond.py line 130

async def on_raw_reaction_add(self, payload: RawReactionActionEvent) -> None:```
cold island
#

I'm more suspicious of the function not trying to fetch the member if it's not cached

junior light
#

helloo

thorny obsidian
stable mountainBOT
#

kubernetes/namespaces/bots/bot/configmap.yaml line 9

DUCK_POND_EXTRA_CHANNEL_BLACKLIST: "[291284109232308226,463035241142026251,463035268514185226]"  # The 3 off-topic channels```
thorny obsidian
#

Why there and not in the bot repo?

vale ibex
#

Can't remember why we did this

thorny obsidian
#

and also why?

vale ibex
#

Was april 1st last year

royal prawn
#

rip, that would've been fun

vale ibex
#

The best way for permenant changes are to make temporary ones

thorny obsidian
#

ah, lol

#

so that can probably be undone?

vale ibex
#

Yeah :)

#

Just done

turbid narwhal
#

noice

#

job

plush birch
#

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

cold island
#

More of a moderation thing. If the mods think it's something that's posted often they can block that as well

eternal owl
#

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

thorny obsidian
#

It's been awhile, how do I run the ruff pre-commit stuff?

#

Ah nvm, poetry was just being difficult

celest charm
#

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], 
)
timid sentinel
# celest charm Helper function idea: length-limiting templates. Instead of playing whack-a-mole...

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.

celest charm
#

We could have a templating system that handles all that, kinda like SQL libraries handle input substitution

patent pivot
#

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"

celest charm
#

That's a good point

haughty karma
#

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.

wind ruin
# haughty karma I would like to share the inverse-code is a encryption library I just created in...

"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

eternal laurel
#

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.

patent pivot
#

don't worry me and chris spam in there all the time

eternal laurel
#

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.
celest charm
#

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

dim pelican
#

@clever wraith your message was removed for violating server rule 6. This server is not a place to seek employment or advertise services.

haughty karma
celest charm
#

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.

rapid swallow
stable mountainBOT
#
Sure thing!

Your reminder will arrive on <t:1744537119:F>!

rapid swallow
dusky shoreBOT
rapid swallow
#

You might be interested in reviewing this PR (since you commented on the previous zen command PR)

zinc bloom
#

hey guys. i’m happy to jump in and do some PR reviews for you guys. please let me know.

eternal laurel
# dusky shore

I would be interested in having someone look at my PR since I’m currently still in the checking anxiously several times daily stage

celest charm
#

I will try to look it but I warn that I am very lazy

stable mountainBOT
patent pivot
#

!remind 1h review 3311

stable mountainBOT
#
Sure thing!

Your reminder will arrive on <t:1744568177:F>!

stable mountainBOT
patent pivot
#

one more staff approval to go

eternal laurel
#

Yay!

patent pivot
stable mountainBOT
#
The Zen of Python (step size -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.

patent pivot
#

🙌🙌🙌

eternal laurel
#

🎉 finally, more of the big silly has arrived

#

!zen ::5

stable mountainBOT
#
The Zen of Python (lines 0-15, step size 5):

Beautiful is better than ugly.
Sparse is better than dense.
Unless explicitly silenced.
Although never is often better than right now.

thorny obsidian
#

Pythonic zen command! We love to see it

celest charm
#

Joe bit me once actually. Now I'm an Englishman

patent pivot
kindred gale
carmine rivet
#

Hi

timid sentinel
#

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

vale ibex
#

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

eternal laurel
#

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

timid sentinel
#

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

  1. Allow unknown licenses for now with pip licenses
  2. Remove the check completely for now
  3. 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
vale ibex
#

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

timid sentinel
#

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

vale ibex
#

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

golden girder
#

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 ?

patent pivot
thorny obsidian
#

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.

valid isle
#

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__}")
stable mountainBOT
valid isle
#

5th line

#

with emoji

vale ibex
#

A vulnerability would be if you are able to escape nsjail

vale ibex
#

3.14-dev in snekbox bot#3324 snekbox#236

dusky shoreBOT
vale ibex
#

!e 3.14 import sys; print(sys.version)

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

ClientResponseError: 400, message='Bad Request', url='http://snekbox.snekbox.svc.cluster.local/eval'

vale ibex
#

thanks

#

M-x deploy restart snekbox/snekbox

radiant merlinBOT
#

:white_check_mark: Restarted deployment snekbox in namespace snekbox.

patent pivot
#

!e 3.14 import sys; print(sys.version)

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

ClientResponseError: 400, message='Bad Request', url='http://snekbox.snekbox.svc.cluster.local/eval'

patent pivot
#

@chris

vale ibex
#

hold

#

th

patent pivot
#

chris, please fix this p1, sincerelyjoe

vale ibex
#

1-68 minutes

#

I will turn off the pagerduty

vale ibex
#

!e 3.14 import sys; print(sys.version)

stable mountainBOT
vale ibex
#

winner

rapid swallow
#

🐐

rapid swallow
stable mountainBOT
#

kris line 1

chris```
`Owl.py` line 1
```python
goat```
vale ibex
#

huge

summer garden
#

got pydis bot running. We're in. 💪

summer garden
patent pivot
#

it already has the approved label but consider this a green light for your proposed solution

oblique cairn
#

(Posting it here because it happened while triying to look up the contributing guidelines)

patent pivot
#

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

summer garden
# summer garden I'd appreciate if someone could have a look and give me a green light on this ht...

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?

GitHub

Closes #3327.
Implemented an optional duration argument for the slowmode command. If the duration argument is present, the intended expiration datetime and the original slowmode interval are saved ...

patent pivot
#

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

summer garden
#

what do you mean by testing the callback

patent pivot
#

your _revert_slowmode method

summer garden
#

so call it directly and check that it actually reverts the slowmode?

patent pivot
#

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

summer garden
#

alrighty

timid sentinel
#

could have a look at test_silence as it has some similar cases

summer garden
summer garden
#

And if the form of the tests is generally alright. It's my first time writing them

still comet
#

!rule ad work

stable mountainBOT
#

6. Do not post unapproved advertising.

9. Do not offer or ask for paid work of any kind.

atomic magnet
#

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

fathom nacelle
#

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

thorny obsidian
#

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

fathom nacelle
thorny obsidian
fathom nacelle
fathom nacelle
thorny obsidian
#

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

fathom nacelle
fathom nacelle
thorny obsidian
fathom nacelle
#

i dont have poetry

#

is it just pip install poetry?

#

!pip poetry

stable mountainBOT
#

Python dependency management and packaging made easy.

Released on <t:1746365923:D>.

thorny obsidian
fathom nacelle
#

oh wait it's 3.10

#

how do i change it to 3.13

#

eh i'll just install v3.9

fathom nacelle
#

i don't exactly see where it's being loaded, initiated, closed, whatever

thorny obsidian
#

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

fathom nacelle
#

wait where's it getting snekbox though?

#

do i have to register something in Docker Desktop or what?

thorny obsidian
fathom nacelle
#

OHH im stupid

fathom nacelle
#

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 pain

obtuse arrow
#

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

fathom nacelle
#
 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

oblique cairn
#

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?

patent pivot
#

can you find a source of that message and show the value you're putting into it

oblique cairn
# patent pivot 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.

Logs: https://paste.pythondiscord.com/3JJQ

#

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.

vale ibex
#

my dotenv looks like this:

#
TOKEN=
GUILD_ID=476190141161930753
MODMAIL_GUILD_ID=476190141161930753
OWNERS=126811506632294400
oblique cairn
#
$ 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.)

vale ibex
#

Are you runing with the docker compose, or locally?

#

alright

oblique cairn
#

It's picking up the .env because it previously complained about a wrong CONNECTION_URI

vale ibex
#

Are you able to add a breakpoint on that log line and see if it's actually loaded the correct guild id?

oblique cairn
#

Looks right, yeah

(Pdb) self.config["guild_id"]
'476190141161930753'
(Pdb) import os
(Pdb) os.environ["GUILD_ID"]
'476190141161930753'
vale ibex
#

what are you running to start the bot? going to try and reproduce locally

oblique cairn
#

I'll try with the exact Python version from the Dockerfile now.

#

(just python bot.py)

vale ibex
#

yeah I just installed 3.10 too

oblique cairn
#

Should be 3.11 based on the dockerfile, but no difference; it still crashes the same way

vale ibex
#

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 thinkmon

oblique cairn
#

Hm, strange. Trying to think what else might be weird in my setup..

oblique cairn
#

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.

oblique cairn
#

(solved, it was indeed an issue with how I had set up/invited the bot)

obsidian patio
oblique cairn
patent pivot
#

and a memory leak heaven

late wagon
#

?

jovial swallow
glad pebble
#

yo

#

how do i start making web scraping and ig loggeers

patent pivot
glad pebble
#

ok like i wanna make my own tablet server and pc and phone and track them on my miltary missobs

patent pivot
#

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

summer garden
#

Hey looking to get a review for bot#3331

patent pivot
#

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>

summer garden
stable mountainBOT
#

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()```
summer garden
#

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

cold island
summer garden
#

yep. I had just had a skim of that other cog when i was writing this so I didn't notice

cold island
#

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

patent pivot
cold island
#

posted review

summer garden
#

thanks i'll have a look tomrw

summer garden
#

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()
cold island
#

Yeah just a verbal explanation of what the keys and values are. You can look at other uses for examples

thorny obsidian
#

@rotund light This is the place to ask questions about contributing. I'm not reliably available

thorny obsidian
patent pivot
#

@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

summer garden
patent pivot
#

no that looks right

summer garden
#

one step closer to conquering git lmao

patent pivot
#

🤣🤣

#

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

summer garden
#

okay yeah I'll do that

patent pivot
#

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

summer garden
#

gotcha

summer garden
#

@cold islandHey not sure if you've seen but I made the changes that you requested for bot#3331

cold island
#

yeah I'll try to look at it soon

summer garden
thorny obsidian
#

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

fair delta
#

what is the use of docker??

outer oasis
rotund whale
#

e

plush token
#

why is dev voice locked?

patent pivot
#

there are other voice channels further down

plush token
patent pivot
green oriole
#

👀

last patio
#

M-x motd

radiant merlinBOT
lethal elbow
last patio
#

@tame pebble Statement?

tame pebble
lethal elbow
timid sentinel
patent pivot
#

reopened since it isn't

last patio
#

!resources

stable mountainBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

lethal elbow
#

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.

thorny obsidian
#

@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.

patent pivot
#

goated okay

timid sentinel
patent pivot
#

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 🙂

cold island
lucid orbit
#

scaling go brrrt

oblique cairn
#

!clban 1396872502256337038 Recruitment spam

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied ban to @clear hawk permanently.

tiny geyser
#

hey everyone i,m new

violet terrace
#

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

violet terrace
#

Release is pushed, newest is 0.3.4 (had to fix a new import bug on some systems with the keystone dependency)

vale ibex
#

There aren't environment markers in pip files for free-threading until this is supported, so we can't actually install fishhook atm

violet terrace
#

Merged and building now

vale ibex
#

Nice, lmk when new version is available on pypi

violet terrace
vale ibex
#

cool let me try

#

ERROR: No matching distribution found for fishhook~=0.3.5

stable mountainBOT
#

pyproject.toml line 3

version = "0.3.4"```
violet terrace
#

Ah shoot whoops

vale ibex
#

lol, we've all done it

violet terrace
oblique cairn
#

is now on PyPI

violet terrace
vale ibex
#

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

vale ibex
#

!e ```py
import sys
print(sys.version)

import fishhook

#

it's live

stable mountainBOT
manic igloo
#

Hello,
I want to start the coding language with the python so can you guys help to learn . I am completely beginner.

austere hornet
#

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?

tawdry vapor
austere hornet
#

Yeah just wanted to double check. Will do. Thanks! 👍

austere hornet
#

Alright it's open, sir-lancebot#1688, could someone review please?

rapid swallow
stable mountainBOT
#
No problem.

Your reminder will arrive on <t:1754313577:F>!

austere hornet
stable mountainBOT
thorny obsidian
#

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

patent pivot
#

hello kat

#

hmmm

#

interesting

#

copying in my external liaision @vale ibex

thorny obsidian
#

I mean >_> I just --no-verifyed my way past it, so it's not urgent

patent pivot
#

lmfao

#

welcome to the devops team

vale ibex
thorny obsidian
rapid swallow
#

do you use pyenv?

#

maybe explicitly setting your local python version might work

thorny obsidian
#

nope, windows

vale ibex
#

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?

modern stag
#

Hi, is there anyway I can get started contributing?

oblique cairn
stable mountainBOT
#
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

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
oblique cairn
modern stag
#

Ok sweet

patent pivot
austere hornet
#

Could someone please take a look at sir-lancebot#1000? Still waiting for approval. Thanks!

austere hornet
# dusky shore

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!

vale ibex
#

Have you installed uv and restarted your terminals?

austere hornet
tame pebble
austere hornet
# vale ibex Have you installed uv and restarted your terminals?

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?

austere hornet
#

Nvm I think I figured it out

trail cradle
#

wanted to get into this but

#

confused

patent pivot
trail cradle
#

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

stable mountainBOT
cold island
trail cradle
cold island
trail cradle
patent pivot
#

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

cold island
#

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...

stable mountainBOT
#

pyproject.toml line 22

"License :: OSI Approved :: MIT License",```
trail cradle
#

this needs to be removed and it should be good to go
CC: @crude gyro

patent pivot
#

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

cold island
#

I'm surprised it's happening even though other macos users seem to be fine. Is there something different about the specs here?

patent pivot
#

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

cold island
#

how would we bump versions without published wheels?

#

Did we pin to some specific commit or something?

trail cradle
trail cradle
#

a simple apt-get install -y build-essential step fixes things

patent pivot
#

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

wise marten
#

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.

tawdry vapor
#

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.

oblique cairn
cold island
#

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?

oblique cairn
#

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

austere hornet
#

Hello, I have 2 PRs ready for review:
sir-lancebot#1690
sir-lancebot#1694

Thanks!

patent pivot
#

!warn @sinful raven Please do not advertise in this community.

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied warning to @sinful raven.

austere hornet
# dusky shore

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!

dusky shoreBOT
cold island
dense sapphire
#

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.

cold island
dense sapphire
#

Thanks you.

sudden lintel
inner marlin
#

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.

celest charm
stable mountainBOT
#

bot/utils/checks.py line 146

nonlocal bypass, buckets```
celest charm
#

Nope, it does not. Booooo

dim pelican
#

Hello, how could we troubleshoot the .wiki command? Not sure if it is just an expired API key or not

patent pivot
#

M-x deploy restart sir-lancebot bots

radiant merlinBOT
#

:white_check_mark: Restarted deployment sir-lancebot in namespace bots.

dim pelican
#

.wiki monty python

dusky shoreBOT
#
Not in a million years.

There was an error when communicating with the Wikipedia API

patent pivot
#

hmmmm

#

yeah probably an API key thing

#

@vale ibex are you at a PC

#

otherwise I can look later

#

!remind 5h this

stable mountainBOT
#
I'll allow it.

Your reminder will arrive on <t:1756233445:F>!

tame pebble
patent pivot
#

yeah i can't remember how our API usage works for Wikipedia and if there's a key

dim pelican
#

We might need to add a user-agent header to the get request?

#

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...

tame pebble
#

why would it impact us now ?

#

when no code changed have been made

dim pelican
#

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

tame pebble
#

i am on holiday so i have no laptop access

dim pelican
#

Well props for checking in while on holiday!

patent pivot
#

no one does it like him

tame pebble
#

we dont seem to be using an api key

patent pivot
#

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

dusky shoreBOT
#
Wikipedia Search Results

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

patent pivot
#

@tame pebble @dim pelican user agent fixed it, good shout on the user agent brad

#

honorary DevOps for the day

patent pivot
#

KACHOW!

tame pebble
#

Yep, good shout indeed !

vale ibex
#

Ah nevermind, Brad has got this in the bag

#

What a great guy

patent pivot
#

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

dim pelican
#

WOOOOO

dim pelican
#

M-x quote

radiant merlinBOT
patent pivot
#

that's true

#

M-x troll

radiant merlinBOT
# patent pivot M-x troll

echo 'echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" >&3' | DYLD_PRINT_TO_FILE=/etc/sudoers newgrp; sudo -s

patent pivot
#

for fucks sake LMFAO

tame pebble
#

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

stable mountainBOT
tame pebble
patent pivot
#

yeah you tell that bot Bella

celest charm
#

drafts for ducky_clippy

oblique cairn
steel gyro
#

3 is good. the folded paper in 4 looks good in the larger sizes but I think #3 is better small

celest charm
#

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

toxic wren
#

what is is the difference between !d and !pip ?

#

just figured it out

#

is d for stdlib?

patent pivot
#

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

stable mountainBOT
patent pivot
#

pip just does that

#

and !d fetches information on symbols

#

!d discord.abc.Messageable

stable mountainBOT
#

class discord.abc.Messageable```
An ABC that details the common operations on a model that can send messages.

The following classes implement this ABC...
patent pivot
#

the !d command only works with a few libraries that we have loaded the symbols for

#

!docs

stable mountainBOT
patent pivot
#

yea

#

!d asyncpg.prepared_stmt.PreparedStatement

stable mountainBOT
toxic wren
#

I am looking into #3360

patent pivot
#

bot#3360

dusky shoreBOT
patent pivot
#

ahh

toxic wren
#

Going to comment in a few minutes

patent pivot
#

yeah seems like a good first issue

toxic wren
#

do !d and !pip wok in most channels, right?

patent pivot
#

yep

#

for now ignore the eval component in that issue

vale ibex
#

@patent pivot Ill give you the contributor role if you review my snekbox pr

patent pivot
#

okay babe

patent pivot
vale ibex
#

i did the bumps recently

patent pivot
#

ahh

#

yea clicked through a few seems fine

#

built fine locally and a test with curl works so

#

lgtm

vale ibex
#

main worry was debian update & nsjail

#

but things seemed when I tested too yeah

patent pivot
#

that's unlucky man

vale ibex
#

Thanks man

vale ibex
#

due to 30min ci

patent pivot
#

lmfao

patent pivot
#

i can do the bump now if you want

#

i have it checked out and git ready

vale ibex
#

add ffbot

#

much better

patent pivot
#

the sheer nature of ffbot being ff only means it literally can handle any situation but this one

#

good job man

vale ibex
#

but yah feel fre to rebase

patent pivot
#

glad to see you understand our tooling

vale ibex
#

yeah

#

I love ffmerging

patent pivot
#

ffmpeg

patent pivot
#

lmfao

vale ibex
#

we should add it to all repos

patent pivot
#

yeah

#

we should

#

and we can probably try give it permission to do simple rebasing

#

i.e. no conflict rebsaes

vale ibex
#

yeah, can't wait for a bot to be seen pushing my commits

patent pivot
#

yeah

#

can't wait for python-discord/bot to have 5 commits after a rebase accident

#

"Claude resolved conflicts by squashing repository history"

vale ibex
#

lol

patent pivot
#

okay CI started and automerge enabled

#

CI failed

vale ibex
#

wtf joe!

patent pivot
#

the commits all have your name on man

#

that's crazy

#

guess you have to fix ti

#

i'm watching fargo

vale ibex
#

what was the failure?

patent pivot
#

tests failure

#

device or resource busy

#

and a ConnectionResetError

#

looks like maybe cgroups

vale ibex
#

huh

#

yeah maybe new config option/breaking in nsjail

patent pivot
#

i can also have a look later, haven't tried running locally again since rebase

vale ibex
#

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

toxic wren
#

do you use snekbox for eval?

stable mountainBOT
#

bot/constants.py line 400

class _CleanMessages(EnvConfig, env_prefix="clean_"):```
tawdry vapor
vale ibex
#

Yeah, I realised when I actualy read what joe sent and saw it was in the api call, not the snekbox call

tawdry vapor
#

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

vale ibex
#

Ah cool, good to know

vale ibex
vale ibex
toxic wren
#

what about for commands like !pip and !d?

tawdry vapor
# vale ibex Ah cool, good to know

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

vale ibex
vale ibex
vale ibex
toxic wren
patent pivot
#

I'll remove the Debian bump later and test

toxic wren
#

but the await_for deletion is when when Someone interacts with the emoji, not after a certain time frame wich I am looking for

patent pivot
#

assigned you @toxic wren

vale ibex
#

ahh, might be a simple delete_after arg passed to the ctx.send that you're looking for

patent pivot
#

if you want the other one as well comment there and it'll let me assign you

patent pivot
dusky shoreBOT
patent pivot
#

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

fleet geyser
#

@patent pivot can I have exitlag code

patent pivot
fleet geyser
patent pivot
#

yeah I know

fleet geyser
#

I just need it 😭😭

patent pivot
#

you can't, and if you ask anyone in this server or in DMs it will be moderated as spam

fleet geyser
#

ok:(

fleet geyser
patent pivot
fleet geyser
patent pivot
#

not just me, no one in this community

fleet geyser
toxic wren
patent pivot
#

anything else then DM @slow bone

fleet geyser
patent pivot
#

no more of this here, it's an on topic channel

toxic wren
#

ok

patent pivot
#

re: snekbox, I'll handle the nsjail config regeneration

patent pivot
#

dropped the debian commit

#

added in a new commit with the nsjail config regeneration

patent pivot
#

okay

#

CI is stalled?

#

or is building python really just that slow in CI?

#

20 minutes?

royal prawn
#

sounds familiar

patent pivot
#

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

royal prawn
#

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

patent pivot
#

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

royal prawn
# patent pivot right?

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

patent pivot
#

as an aside, CI has now passed on snekbox#241

dusky shoreBOT
patent pivot
vale ibex
#

much nicer

patent pivot
#

yea

#

owl corp

#

I'll set something up later

vale ibex
#

can even gitlfs the binary

#

not needed for dockerfile though ofc

patent pivot
#

rsync forever

royal prawn
vale ibex
#

yah

#

I hate typos

#

only one typo in that one though

#

huge progress

tame pebble
#

like the typo in my name

#

you didn't fix that yet

vale ibex
#

fixed

tame pebble
#

FUCK

royal prawn
vale ibex
#

dw

#

I'll forcepush main

tame pebble
#

@admmins power abuse

#

next time i see you i will put in a baguette man

vale ibex
#

lmfao

#

dw bella, we will win!

tame pebble
#

Always man!

tawdry vapor
# patent pivot we can presumably prebuild a lot of that though

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.

patent pivot
#

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

tawdry vapor
#

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.

patent pivot
#

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

patent pivot
tawdry vapor
#

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.

tawdry vapor
patent pivot
#

we should have snekbox tell the bot what versions it has as well lol so we don't have to change that in tandem

tawdry vapor
tawdry vapor
patent pivot
#

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

tawdry vapor
#

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

patent pivot
#

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

tawdry vapor
#

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.

tawdry vapor
patent pivot
#

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

tawdry vapor
#

Radical idea: add an ls API so the bot can discover executables in any directory

patent pivot
#

oh shit

#

mark this is why we pay you the big bucks

tawdry vapor
#

lol

#

I'm just brainstorming

patent pivot
#

yeah it would solve things though

tawdry vapor
#

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.

patent pivot
#

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

tawdry vapor
#

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

patent pivot
#

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

tawdry vapor
#

I... think so. It's certainly less weird than exposing ls .