#dev-contrib
1 messages · Page 131 of 1
joe wouldnt let you
nope — docker-compose doesn't super closely mirror prod either. only code jam management accounts for the fact that none of our services cacn write to disk https://github.com/python-discord/code-jam-management/blob/main/docker-compose.yml#L15-L16
docker-compose.yml lines 15 to 16
read_only: true # Prod uses a read-only fs, override this locally if it helps with debugging
user: "1000" # Prod uses a non-root user, override this locally if it helps with debugging```
That part was more an example, it's just that mypy picked up that stub as the typing for import logging, so whenever you do it, it think's it's importing that stub, not the actual logging file
Kompose 🤡
we had plans to use it at some point to host a package — we don't now and I removed the service without removing DNS lol
Anyways, this was for the fun of playing with the typing system/mypy, not as practical as your solution lol
yeah lol
So for the actual solution I'd need to have a util get_logger and then the actual custom logger itself
That sounds about right
we could use https://github.com/kubernetes/kompose but don't
oh chris already mentioned it lol
a terrifying tool
You may also be able to use a find-and-replace on logging.getLogger(__name__) to migrate almost the entire code base
There are 19 instances of not that
hm, does pydis have S3 buckets from aws?
it's smart, but then people use it to deploy apps which is not what it's for
S3, yes, AWS, no
Didn't we have some for that quackstack nonsense
we uses Linode
kubernetes#53
nonsense
eXcuSe mE
yep
yeah
It's quacky
we backup to Frankfurt, Newark and Singapore
Redis, PostgreSQL and MongoDB
so how exactly is it a backup if its hosted by the same place wat
challenge?
More likely linode goes bankrupt before then
Or humanity loses electricity and we revert to the stone age
or humanity just goes
:tools: Pick a CronJob to trigger
🌬️ Spawned job blackbox-883105023993729054
the only one in the same DC as us is the frankfurt one
the other two are completely separate
ah
hm, how is it not possible for me to choose something from this dropdown without an edited tag
I mean, if y'all have the use application commands perm off in the server that might be why
components don't have an edited if only the view changes
ended up being pretty alright tbqh
arthur source
# bot/bot/log.py
import logging
TRACE_LEVEL = 5
class CustomLogger:
def trace(self: logging.Logger, msg: str, *args, **kwargs) -> None:
"""
Log 'msg % args' with severity 'TRACE'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.trace("Houston, we have an %s", "interesting problem", exc_info=1)
"""
if self.isEnabledFor(TRACE_LEVEL):
self._log(TRACE_LEVEL, msg, args, **kwargs)
logging.TRACE = TRACE_LEVEL
logging.addLevelName(logging.TRACE, "TRACE")
logging.setLoggerClass(CustomLogger)
... # log_file_format_stuff
_set_trace_loggers()
``````py
# bot/bot/utils/log.py
import logging
import typing as t
from bot.log import CustomLogger
def get_logger(name: str = None) -> CustomLogger:
return t.cast(CustomLogger, logger.getLogger(name))``````py
# bot/bot/exts/moderation/infraction.py
from bot.utils import get_logger
log = get_logger()
...
log.trace(...)
```does this seem right? @gritty wind
^ could this be a command, like lance and bot
arthur help
ah, not easily
since its a global check if core dev
It might not be necessary to set logging.TRACE = TRACE_LEVEL
arthur jsk source cj trigger
everything else looks right
I would add it but it's way easier if I just have a global devops check
perhaps keep it in the setup_loggers function though (the functional stuff)
yeah the logging.TRACE onwards for /log.py would be in setup()
lgtm then
It is since it's used elsewhere in the setup
I changed my name because I'm so fucking mad at king arthur.
Fair enough
Ah
self._log(...) this will have to change, presumably to logging.Logger._log(...)?
hey winner
self._log = bot.utils.get_logger(...)
Replace the dots with whatever is already there
The references toself._log don't need to change
And what about if self.isEnabledFor(TRACE_LEVEL):?
they have stuff in the works
cough if cough
they will release them but not soon enough
Since, 8 months until message content is privileged, and all bots need to use application commands [yes ik this server is not affected] and library devs have to implement it first and then bots can but whatever.
seriously discord is not that great on their management
githubpreview.dev?
What about it?
It should be fine as is I think
github codespaces port forwarding
Well CustomLogger isn't inheriting anything so isEnabledFor doesn't exist
@gritty wind ^
CustomLogger should be inheriting Logger
Yeah
I have that one from earlier up
class Logger(logging.Logger):
def trace(self: logging.Logger, msg: str, *args, **kwargs) -> None:
"""
...
"""
if self.isEnabledFor(5):
self._log(5, msg, args, **kwargs)
Just needs a renaming, and a new docstring for the class itself
So I don't need to redefine self._log?
^
You do still need to set it to utils.get_logger, but for something like self._log.trace() you can leave that
okay, changes made https://pythondiscord.com/metrics now 403s
Basically, self._log is the CustomLogger, which is returned by the utils function
i can yeah — I was going to implement first and add another PR in which introduces those things
But then isn't that just self? Because self._log is within CustomLogger
To rephrase from the begenning, the only thing you need to change is logging.getLogger(T) -> utils.get_logger(T)
Which self._log are you referring to
def _monkeypatch_trace(self: logging.Logger, msg: str, *args, **kwargs) -> None:
"""
Log 'msg % args' with severity 'TRACE'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.trace("Houston, we have an %s", "interesting problem", exc_info=1)
"""
if self.isEnabledFor(TRACE_LEVEL):
self._log(TRACE_LEVEL, msg, args, **kwargs)```I'm moving this into `CustomLogger`
Ah, I see
Yeah that one can stay as is
I was referring to the ones we use in our code (such as https://github.com/python-discord/bot/blob/c2122316e5a34a2b9776e5e965a9434e748ab601/bot/utils/scheduling.py#L44)
bot/utils/scheduling.py line 44
self._log.trace(f"Scheduling task #{task_id}...")```
Unrelated to the one in the CustomLogger class
Ah right
def _set_trace_loggers() -> None:
"""
Set loggers to the trace level according to the value from the BOT_TRACE_LOGGERS env var.
When the env var is a list of logger names delimited by a comma,
each of the listed loggers will be set to the trace level.
If this list is prefixed with a "!", all of the loggers except the listed ones will be set to the trace level.
Otherwise if the env var begins with a "*",
the root logger is set to the trace level and other contents are ignored.
"""
level_filter = constants.Bot.trace_loggers
if level_filter:
if level_filter.startswith("*"):
logging.getLogger().setLevel(logging.TRACE)
...
...
logging.getLogger(logger_name).setLevel(logging.DEBUG)
...
...
logging.getLogger(logger_name).setLevel(logging.TRACE)
```will I have to change each of these `logging.getLogger()` to `bot.utils.get_logger()`?
Does sir-lancebot currently accept new commands? Or is in in the process of restructuring?
I don't think so right? Since logging.getLogger() will return the CustomLogger?
what are you thinking of? I was planning on doing the restructure this weekend
voice chat shenanigans
oh, it can wait then
I wanted to propose a command for fetching info about a software license.
Like, you type .license mit, and you get an embed similar to this
https://github.com/python-discord/meta has issue forms
I'm not sure about Lance, we might have some ideas in terms of what we want on there so I'd hang fire for now
well, I thought way too much about LGPL and this idea came to me, yeah
could wrap github api
yeah
but many are missing, that's just 12
I'll check the api docs
we will not ship the command without WTFPL
yeah they list the most popular, but it has an API entry for it https://api.github.com/licenses/wtfpl
If that instance is going to be using trace, it needs to use the utils function (this is only for typehinting). To make things less confusing, I think it makes sense to always use it
(mypy can't pick up that getLogger won't return the default Logger argument, that's why we need the second function to tell it we're using CustomLogger)
Hm... how come there's no endpoint to fetch all of them? And if I can only fetch 12, how come the endpoint supports pagination?
because the root is for displaying ones github considers "featured"
lol, that's true actually
doesn't have agpl either
ahhh hold on
it does have them
it just versions them https://api.github.com/licenses/lgpl-2.1
The Github API is a wrapper around the licensee ruby gem, seems a bit strange to make a wrapper about the api lol
I get nine
Yeah, we can just take https://github.com/licensee/licensee/tree/master/vendor/choosealicense.com/_licenses
which is what github uses by proxy
and we'll convert it to JSON somehow
looks like github actually uses spdx
we can also rewrite the bot in Ruby so that it uses licensee
a nearly full list of licenses
oh, nice
but it doesn't have useful info
maybe we should hand-pick the most used licenses and just manually decsribe them
my chain: https://choosealicense.com/ -> edit on github -> submodule
license-list-XML @ b7470fc -> read readme and find https://spdx.org/licenses/
wait here's the machine readable licenses https://github.com/spdx/license-list-data
no
it does tho, but you have to make a request for it
Lovely
it will soon i hope
its all of the "detailsUrl": keys
So I'll have to randomly generate color values for now
github isnt loading for me so i cant link the pr
src/models.py line 49
variation: int```
ye
meta: why is this feature on @stable mountain when @dusky shore does pr linking?
these should be merged smh
create an issue on bot perhaps
also would merge issues.py and githubinfo.py into one cog as well
imo it should all go in the main Python bot, since it's less of a fun community thing and a fairly important server feature
my opinion on this last time it was brought up was that most of the things that re not event specific and have to be allowed outside of the normal lancebot channels should be implemented on @stable mountain but I had no idea where to make the issue and forgot about it
speaking of which, I have a large review to make on 778
ig meta
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/runpy.py", line 188, in _run_module_as_main
bot_1 | mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
bot_1 | File "/usr/local/lib/python3.9/runpy.py", line 147, in _get_module_details
bot_1 | return _get_module_details(pkg_main_name, error)
bot_1 | File "/usr/local/lib/python3.9/runpy.py", line 111, in _get_module_details
bot_1 | __import__(pkg_name)
bot_1 | File "/bot/bot/__init__.py", line 8, in <module>
bot_1 | from bot import log
bot_1 | File "/bot/bot/log.py", line 12, in <module>
bot_1 | from bot import constants
bot_1 | File "/bot/bot/constants.py", line 21, in <module>
bot_1 | from .utils.logging import get_logger
bot_1 | File "/bot/bot/utils/__init__.py", line 2, in <module>
bot_1 | from bot.utils.services import send_to_paste_service
bot_1 | File "/bot/bot/utils/services.py", line 6, in <module>
bot_1 | from bot.constants import URLs
bot_1 | ImportError: cannot import name 'URLs' from partially initialized module 'bot.constants' (most likely due to a circular import) (/bot/bot/constants.py)```I've now got this error I need to fix
A circular import issue
I'll have a pr ready for seeded ducks in an hour or two
bot.constants needs bot.utils.logging
bot.utils.logging needs bot.utils.services
bot.utils.services needs bot.constants
Messy
Not even
It's just the way the code is structured from before I made my adjustments
Actually there's no log.trace in bot.constants so it doesn't truly need bot.utils.logging
So I guess I'll just leave it
Mypy will detect the wrong thing but it won't matter because it only breaks on log.trace which doesn't appear in the file
Okie would appreciate reviews on quackstack#60 it adds suck seeds and also fixes a fuck up I made when not updating the dockerfile 
Restarting docker completely cause just the container didn't seem tow rok
Ty Alec, reviewed
ty
nvm this really just isn't working
oh
Either docker is running old code or I'm just blind and can't see the difference in the error
Right I think
bot.log imports bot.ext.utils.logging
bot.ext.utils.logging imports bot.log
i'll need to PR like
a lot of files after
every repo that clones k8s as a part of deployment needs a path update
@fervent sage 🤨
ERROR: Error loading ASGI app. Could not import module "main".
see second line of PR lol
Ugh this is such bs lol
ah lol
File "/bot/bot/constants.py", line 21, in <module>
bot_1 | from .utils.logging import get_logger
This line doesn't exist anymore so why is it in the error message? @clever wraith
Yes
This is what's actually L21
docker-compose up bot is the command I'm running
ping me when quackstack PR is ready for devops sign off
i'll rollback the deploy for now
this is nice
updated
merged
lmfao
Okay that seemed to work, thanks @clever wraith
seems to be back https://quackstack.pythondiscord.com/docs
lol
the duck with my user id as seed is https://quackstack.pydis.com/static/2c386ef22551eb34a3f793f2ad56c63abacf2756.png
lmao
So 11 concurrent prs (minimum) need to be merged?
thats awful
yes but I can override policy checks
Jeez
Ik but still
is there a way to switch to swagger? or is it not fastapi? (it is, it's in the title)
Right and if it breaks, it would be broken anyhow
it won't break, but yeah I guess lol
thx
I think swagger looks ugly as fuck so I made redoc the default

I had to override https://github.com/python-discord/site/pull/487 because it had 250 commits
/ugly_duck_docs
Why did that need an override?
So how would that limit policy bot
because it can't see the commits, lol
it has a bunch of checks that it runs on commit authors https://github.com/palantir/policy-bot#approval-rules
so it needs to see all commits
it doesn't work lol
works with everything but that
This is my user ID as seed
the best 23 bytes in the whole of python discord infrastructure
it's actually really cool that it follows HATEOAS
HATEOAS?
ah yeah
Im quite happy with it that way
it didnt feel right to return a raw image from that endpoint
wouldnt make sense
github does that as well
yeah i thought of that when i saw the wikipedia example
there's a massive object with stuff like repo_org: url, repo_stars: url, ...
yep
/duck?seed
oh crap im stupid
I added seed
into the place where seed will be ignored
if the duck config is provided the seed is provided
wait... it's ignored?
we should move qs to S3
Time to update review requirements for quackstack ig
I'd like to just let everyone know that my head right now
i will provision creds
because i don't want to serve images at scale from my infrastructure
time to make another pr...
joe: pydis, can we have scale?
pydis: we have scale at home
scale at home:
someone downloads a duck image once per minute
quackstack#61 
S3 is aioboto3 yes?
Ok, now it should work correctly
quackstack integration test when
😅
botocore nvm, i thought it only supported py2
we generate ducks in CI and attach them as build artefacts
@patent pivot could I have some s3 creds to test with
i think you mentioned in the past about that
Rick go to bed
yea one sec
It's like 12am where you are
i like how they both eat in sync
for some reason they autosynchronize on firefox
@brisk belfry inb4 dpy 2.0 won't ever be released
Also Guinevere wasn't a sir
A bit unrelated joe, but when will the code jam roles be taken away
it's named after Sir Bedevere
lancebot is on d.py 2.0 and python will be soon too, despite it not being officially released
good Q
Soon ™️ Waiting back on 1 more prize thing
Oh yay lancebot can use threads
Ah
lol, sure
what are you fixing
lol
some are
I'm considering moving our internal docs onto k8s
right now it's notion, but some stuff could be migrated
github
probably published through jekyll to github pages or something
something like https://python-discord.github.io/olli/
nope
yea
test
fuck s3 and fuck boto3
I will now go back to trying to make it work and screaming into the void
my internet connection
lol
trying to review a pr and had this channel open ¯_(ツ)_/¯
reviewed lance 778
left a second review since I missed some things lol
sir-lancebot#778
ty <3
np m8
@clever wraith What are your plans for https://github.com/python-discord/sir-lancebot/pull/699#pullrequestreview-739158725?
Working on bot#1765 - completed the first part. Could I have some feedback on the message:
My personal opinion:
- Can be made equivalent to the nitro message, i.e
<user> just became a tier 1 patron! - This can be posted as an embed, and then the second line can become a hyperlink.
Possibly with a preceding 🎉 on the first line
🎉
@cold island just became a tier 1 patron!
Support us on patreaon @ https://www.patreon.com/python_discord
"patreaon"
lol ofc spelt right tho 
we could make the colour the same as the role colour
I wonder if it would worth sorting out pydis.com/patreon as a link shorten
seems like a good idea
oh, it already is
lol
@patent pivot is always a step ahead
🎉 @vale ibex just became a tier 1 patron!
Support us on patreon
And with a capital P
!int e ```py
await ctx.send(
embed=discord.Embed(
title=":tada: @vale ibex just became a tier 1 patron!",
descritpion="Support us on Patreon",
colour=0x46e6e8
)
)
ah, no mentions in titles
that a bit big anyway
!int e ```py
await ctx.send(
content=":tada:",
embed=discord.Embed(
description="@vale ibex just became a tier 1 patron!\nSupport us on Patreon",
colour=0x46e6e8
)
)
:tada:
@vale ibex just became a tier 1 patron!
Support us on Patreon
ok!
also, my alternative message when someone already has a patreon role:
maybe something like:
@reef tinsel just changed to a tier 2 patron!
?
Hmm, I don't think we need to deal with that
X just became a tier 2 patron! still works imo
(the colour is black because that is the colour of my tier 1 role)
could you try it with the 🎉 on the same line as the next?
like this suggeiston
as in without the \n before the mention?
ye
(with a space tho)
yes
along with a monthly update too
which shows all of our current patrons
bot#1765 for reference
(I am sorting out something for school next week, so will do the on the next line now, but may take some time again for any other adjsutments
a comparison to the 2 locations for the 🎉
I think it looks better inline
@static canyon just became a tier 1 patron! 🎉
Support os on Patreon
🎉 @static canyon just became a tier 1 patron!
Support us on Patreon
🎉 @static canyon just became a Tier 1 patron!
Support us on Patreon
I think this one looks the best (2 messages up if the reply isn't loading for you)
CC @reef tinsel
no problem on the time scale thing btw, we all volunteers here, so we understand that life comes first 😄 Take your time.
yup, agreed
I am happy with this for now then, and will start working on the monthly post after going to the dentist!
nice 😄
its open to everyone
Only contribs+ can speak
I'm a little lost with why this test is failing, I'm not too familiar with django testing site#577
Is this because the timeout const doesn't exist during testing?
or is there something I need to do to the requests mock
it's easier to read in the list of 100s of branches lol
Maybe it’s coverage? I can’t check the exact error, just the tasks, so I’m just guessing by reading the code.
It's a failed test due to not returning the meta data
it seems to be hitting the except block and returning {}
Ah, I've sorted the tests
What was the issue?
The requests mock was expecting the url to be arg[0]
but I was explicitly passing it as the url kwarg
Ahh you made it too easy to test
"here is this keyword arg that is what you want"
"I'd rather the 0th index of a list please"
yea, this mock is very specific to the particular part I edited, so I'm just going to put it back as arg[0]
For little guys like me, what are the most helpful things to tackle? I've done two things for sir-lance but haven't touched on the bot or site yet
setting up the bot is a bit of a chore right now, so expect to spend a bit of time on that
We provide a template server in the contrib guides, but even then setting up all the channel, role and webhook ids in the config can take a while
but there are a bunch of issues on the repos if you're looking for something to do
You can talk cuz you are a contributor
Hi! Does anyone have any good ideas for testing bot#1765 part 2 (monthly message)?
By this I mean, I cannot test how it will handle going over embed limits in my guild of 2 members?
make 3 lists of names and output those, instead of role.members
If you just want to test it looks right
Right now, we also have no tier 3 patrons, so that list shouldn't appear at all
rather than showing a title with no one under it
ok
i will probably start by just having a title with no-one under it, to simplify the code to make it easier to debug
sure
fwiw, I would use Embed.add_field
to add the lists
and then just not add the field if there is no one with that role
like ```py
embed = discord.Embed(
title="Mothly Patreon update!",
description="Big thank you to this months patrons!\nSupport us on Patreon",
colour=some_colour
)
if patreon_role_1.members:
embed.add_field(name, value)
if patreon_role_2.members:
embed.add_field(name, value)
if patreon_role_3.members:
embed.add_field(name, value)
await ctx.send(embed=embed)
ofc this is super simplified
Plus- this may exhaust the embed limits
possibly, the limit is 4k right?
yes, thats why I need to be careful
is a mention worth the number of chars in id + 3 (<, @, >) or another number of chars?
ie, is it worth 19 chars or another number
I feel like it’d be easier to just swallow the bullet now and add splitting
I’d like the mentions personally
we could
When we bump to 2.0 we can send them all in one msg too
How?
i was going to do some calcs to work out the columns, but it would be a lot easier on the code to do separate embeds!
up to 10 embeds in a message
yea, api v9 (maybe added in v8
) supports up to 10 embeds per msg
discord.py 2.0 exposes this with an embeds kwarg on Messageable.send
which is a list of embeds
yep, v9
for this line continuation, how should I do the indentation/brackets? like this, or something else?
ok
Any PRs/issues I can work on? Need something to do.
uhhh possibly
might be worth asking joe in #dev-black-knight
since there might be some useful things to be done there
Could also use a third opinion on some of the unresolved conversations in bot#1663
Hey @dim pelican Can I partner with you on sir-lancebot#677 
I have a random collection of things if you want to take a look
sir-lancebot#833 should almost be good to go
I had an open question on whether or not sir-lancebot#834 was in the right place
site#574 might be a helpful thing as well
Sure thing!

Chris you’ve gotta add the reactions for us😔
I can never find that confetti cannon one
lol
Lol right? I was going crazy for a second :\tada:\
So there are a total of 10 contributors?
295488872404484098
#55cc6c
0.37 0.58 204
43
12
6442450944
43 in total
Ahh I see, dang that seems like a rare role to get
There's definitely rarer ones lol
There's a bunch with just 1 member
some with 0 too lol
super rare
Aren’t those all patreon colors 🤡
lol, out of the 3 with 0, tier 3 patreon is one of them
Ohh no some pretty cool ones
I should totally be given a role called 'Too Many Sideprojects' 
One day maybe I will have a colorful username
Smh Chris, copying my badly phrased "what I think a core dev is" =P
Also congrats to the new contribs! Very well deserved :D
congrats new contribs
I SEE SOMETHING BAD https://github.com/python-discord/bot/pull/1791/files
If someone wants something to work on that I can guarantee will be used this year and will be greatly appreciated by me if this is implemented: sir-lancebot#321
If anyone has got sometime, needs one more approval:
https://github.com/python-discord/sir-lancebot/pull/618
I'd be glad to implement this, however I need some time to familiarise myself with AoC first, if it's not a problem. (Haven't really participated before.)
I would ultra appreciate this :D
And that's totially fine, this feature doesn't need to be available until Dec 1 anyhow~
If you have any questions about it or want me to explain it and get you sample data let me know
It's called tada
Thanks everyone! Congratulations Wookie and the others 
What about it?
Qwerty you're the mod QoL fixer.
You: Why does this interface suck for mods?
Mods: I dunno, it's always been like that. Would be nice if it wasn't.
You: Well I fixed it!
Mods: :O
Doesn't follow the pydis style guide, isn't mentioned as an example there, but you get the idea about the brackets on a new line, see: https://pythondiscord.com/pages/guides/pydis-guides/contributing/style-guide/#bracket-and-item-arrangement
Coding conventions for our Open Source projects.
Oh yeah, I totally forgot I said I'd help with that 👀 I think when I first looked at it, it all went a bit over my head.
@molten perch So I'm going to go ahead and explain, broadly, AoC and specifically how we implement multiple leaderboards.
Advent of Code is a a Programming Challenge Advent Calendar. Each day, starting on Dec 1, for 25 (I think) days, a challenge is released. People are given input data, they must solve the challenge, and then submit their result. It starts off pretty alright and then quickly gets more difficult. There are also 2 parts to each challenge. So a total of 48 or 50 challenges to solve.
There is a global AoC leaderboard, which ranks people based on how many Stars (challenges completed) and how quickly they get the stars. The global leaderboard is very, very competitive.
The community can also create their own private leaderboards to compete against friends and coworkers. These are limited to 200 people per leaderboard. This is what we use. But, because of our community's size, we actually need to have multiple leaderboards. So last year, Seb had to rewrite our whole codebase for AoC to accommodate multiple leaderboards. We query each leaderboard, record in Redis the user ID, which days they completed, and how many stars they got on that day, and how quickly they got those stars.
From there, we re-rank the whole dataset and rescore to create our own PyDis Mega Leaderboard. So for the per-day AoC stats, this is actually the data you want to use. It just requires from thinking and shuffling and scoring, per-day to do so. It's also probably smart to store the day's results in some sort of cache so the computation doesn't have to be continually re-run.
... so that's my thoughts on it.
To help test the feature I can get you access to last year's multiple leaderboards with the cookie session tokens so you can query it directly yourself
Thank you for the explanation!
That'd be really helpful, thank you! 🙂
Hey what is your github user name? I'm going to give you access to my fork. I'm working on branch color-677 for this
it's CyberCitizen01
umm hey btw do we have to wait until the issue is assigned or it doesn't matter..
I'm probably jumping the gun a bit
I'll assign y'all now~
@elder belfry can you also comment on the issue so I can assign you to it as well?
okay i'll do it in just a min
Woo! Fastest assignor in the west
Also, I'm going to do a major restructure of lance's ext tomorrow evening. So either aim to have the PR merged by then or plan to have a gnarly conflict to resolve
Definitely going to be the latter
@patent pivot (and also others who know reviewbot well, fuck it @vale ibex you too)
Can we have wookie's core dev vote count retro-actively for like... the past 3 days or nah?
you can click the details button next to policy bot for it to reevaluate
I don't think I have that power anymore
looking specifically at sir-lancebot/833
ah, joe hasn't added wookie to core dev team yet
(joe/owners I mean)
The act of opening this page reevaluates
Wait he is a core dev now
My aim is to help merge as many open lance PRs as I can before I do the exts/ restructure
yea, there's a team in github that deals with the policy bot stuff
good idea
<@&267627879762755584> Could someone add wookie to https://github.com/orgs/python-discord/teams/core-developers
@vale ibex He is already added
that's their discord role
I added that
discord roles != github
Ohhh sorry I didn't know mb
General question: should I open a PR with an empty file and then build it out in collaboration or wait until there is a full file ready to go?
Thanks!
Okay, PRs I'm going to try to help move along this weekend:
- Teapot
- Wikiguess
- unloaded cogs preservation (I'll try my best for this one but no promises)
fwiw a draft PR is a special type of PR, it marks it as not ready for review, it's useful for people to see it's not ready
when you're creating a PR, there is an arrow next to the create PR button, you can click that to select draft PR instead
both my PRs on lance, 
or you can click this button to convert an open PR into a draft
I'd appreciate a core dev review on sir-lancebot#745 since I think kosa is still busy with hella life stuff
Whoops! Gonna have to fix that after lunch
Also kat I won't be able to mention the changes as of now due to school stuff atleast for 2 weeks, after that I can
so you could review some other PRs too if ou want
(unless they are a approval) lol
That's fine~ If they're ready though without major changes I'll do my best to get them merged to avoid an annoying conflict
👍
Just curious, what do these messages mean exactly? #dev-log message
the bot reconnected after it was deployed
Ohhh I see now
When we merge PRs, we re-deploy the bot so it has those new features. That's just letting us know when it's back online
Ahh I see now
Thanks
@cold island re:https://github.com/python-discord/bot/issues/1757 which endpoint would that be? I only see endpoints which accept a snowflake (GET /bot/users/snowflake)
I am getting a Error, while configuring sir-lance
(sir-lancebot-e4XN2zlu-py3.9) PS M:\ADMIN\Critical Data\Python-discord\sir-lancebot> poetry run task start
Found .env file, loading environment variables from it.
09/03/21 21:10:03 - root INFO: Logging initialization complete
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "M:\ADMIN\Critical Data\Python-discord\sir-lancebot\bot\__main__.py", line 7, in <module>
from bot.bot import bot
File "M:\ADMIN\Critical Data\Python-discord\sir-lancebot\bot\bot.py", line 202, in <module>
loop.run_until_complete(redis_session.connect())
File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\async_rediscache\session.py", line 138, in connect
self._pool = await pool_constructor
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\aioredis\commands\__init__.py", line 188, in create_redis_pool
pool = await create_pool(address, db=db,
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\aioredis\pool.py", line 58, in create_pool
await pool._fill_free(override_min=False)
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\aioredis\pool.py", line 383, in _fill_free
conn = await self._create_new_connection(self._address)
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\aioredis\connection.py", line 111, in create_connection
reader, writer = await asyncio.wait_for(open_connection(
File "c:\python39\lib\asyncio\tasks.py", line 442, in wait_for
return await fut
File "C:\Users\ADMIN\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-e4XN2zlu-py3.9\lib\site-packages\aioredis\stream.py", line 23, in open_connection
transport, _ = await get_event_loop().create_connection(
File "c:\python39\lib\asyncio\base_events.py", line 1017, in create_connection
infos = await self._ensure_resolved(
File "c:\python39\lib\asyncio\base_events.py", line 1396, in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
File "c:\python39\lib\asyncio\base_events.py", line 856, in getaddrinfo
return await self.run_in_executor(
File "c:\python39\lib\concurrent\futures\thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\python39\lib\socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
What should I do?
Either run redis or set the env var (name should be somewhere in the contributing guide) to false
The full environment variable reference for Sir-Lancebot.
In this
which one should I keep False?
set USE_FAKEREDIS to true
lemme check
That's Work
Thank you!
I believe the viewset will need to be changed
site#577 is a nice simple one to test if someone wants to review it
this fixes an issue that causes a worker to go unresponsive and abort
Hmm yeah I don't see anything in https://github.com/python-discord/site/blob/main/pydis_site/apps/api/viewsets/bot/user.py so it might need to be added
Could I get assigned this issue sir-lancebot#599
It’s been up for grabs and I don’t think anyone has interest in getting assigned that issue
bot.bot.Bot inherits commands.Bot
commands.Bot inherits discord.Client
discord.Client has a http attribute.
Mypy raises an error when you do bot.http, stating error: "Bot" has no attribute "http" even though it exists (in the superclass' superclass). Does anyone know how to fix this?
It doesn't seem to be inheritance that's the issue, since the following works fine:```py
class Ham:
x = 1
class Spam(Ham):
pass
class Foo(Spam):
pass
class Bar(Foo):
pass
b = Bar()
print(b.x)
Don't think this is the right channel for that
am just new here, not sure where shall i share projects for showcases
We don't allow showcasing of projects have a channel dedicated to showcasing projects anymore. We used to, but it became too much of a moderation burden with people sharing forkbombs etc.
That's not strictly true actually, you can still share in an off-topic channel as long as the project doesn't violate any of our rules (namely rule 5) and you're not just "advertising" it, but asking for feedback etc.
I'll open an issue for it then, it seems like there's no way to fetch that info from a username currently and we'd need to add something like this:
@action(
detail=False,
methods=["GET"],
url_path=r"username/(?P<name>[^#]{,32})#(?P<discriminator>[0-9]{4})"
)
def get_by_username(self, request, name, discriminator):
user = get_object_or_404(User, name=name, discriminator=discriminator)
return Response(UserSerializer(user).data, status=status.HTTP_200_OK)
This allows for GET bot/users/username/Qwerty#0001 but this is just what I came up with an hour of tinkering around and having no prior experience in Django, so there's probably a better way
class Spam():
x = 1
class Foo(Spam):
pass
class Bar(Foo):
pass
b = Bar()
print(b.x)```this code works just fine with mypy (and Pycharm) but for some reason `bot.http` gives an error saying `"Bot" has no attribute "http"`, where:
`bot.bot.Bot` inherits `commands.Bot`
`commands.Bot` inherits `discord.Client`
`discord.Client` has a `http` attribute.
Does anyone have any idea as to how to fix this?.
So it seems to stem down to the fact that neither Pycharm nor mypy recognises that discord.Client has a http attribute.
class Client:
r"""
...
Attributes
-----------
ws
The websocket gateway the client is currently connected to. Could be ``None``.
loop: :class:`asyncio.AbstractEventLoop`
The event loop that the client uses for HTTP requests and websocket operations.
"""
def __init__(self, *, loop=None, **options):
...
self.http = HTTPClient(connector, proxy=proxy, proxy_auth=proxy_auth, unsync_clock=unsync_clock, loop=self.loop)
...```why doesn't mypy/pycharm recognise that `Client().http` is valid?
So apparently the stubs are missing it
Which is why it doesn't work
Doesn't seem like a good idea to rely on stubs that don't properly reflect the current interface of the library
I added to the stubs and now it works perfectly
Tbf the stubs are still updated, I guess they just missed one?
I've made a PR to the library so maybe it'll get merged 🤷
which library
How active is the development on what you're using? My main concern here is that if there's a larger mistake like that then I'd expect more smaller for example from changing signatures
I mean discord.py is no longer getting updated (read-only repo) so there won't be any new missing items
It's just anything that's already missing, such as discord.Client().http
is this on lance or bot?
er, i mean this to reply
Locally for bot
You can't actually edit site-packages for the bots (files aren't tracked)
v2 is never coming though
which means if wait until bot is updated to v2 99% of the typing stubs for bot shall be gone
you know that @dusky shore is on v2 now, right?
is the non stable fully typed or only partially as it was being written?
I haven't encountered anything missing type hints while I've been using it
When bot is upgraded to the currently workable state of discord.py v2.0.0a (which while it is discontinued, has no major notable bugs), the library is almost entirely typehinted, which means that you don't have to worry about client.http being typed and needing stubs. If you wait, it will be less work to add whatever you're adding to bot.
Hmm I mean it just removes the need for a single dependency
And I don't need to add this stub
for context, we're planning to upgrade the bot this weekend/next
since lancebot hasn't had any issues so far
huh, when you upgrade, you can probably change !snf to type hinted with Object
because discord.Object has a converter in 2.0
Nice
I imagine in the PR that we upgrade we will just fix the breaking changes
but there is going to be plenty to upgrade over time 😄
yeah
I have a personal bot which translated: is sir-lance and bot melded together with the best usable commands between the two of them
but yea, hadn't seen that converter yet, it's good to know 😄
No, I'm not hiding where the sources of this bot are 😄
lol
but its extremely useful to have a meld of bot and lance
specifically pypi, pep, and the github commands
Ah cool 😄
yeppp
I'm on vacation, I'll get to this Sunday-ish
@fervent sage thanks for seeding ducks! Tested, works great
I'll get to .quack soon
Quack quack
Lol Ty python
Question, is it possible to temporarily ignore the pre-commit checks while working on a draft file? I am assuming I will be committing a bunch while the file is worked on between me and another, and I like to use # TODO tags which the flake8 catches.
Lmao
*Once the file is more workable I would probably squash the commits prior to review
Just add # noqa at the end?
This worked, thanks!
you can do poetry run task lint to lint everything
since pre-commit won't pick up the things you skipped now
Doesn't noqa fail precommit
Oh right, you need to specify a specific error too?
I get the T000 and F401 errors
(Todo note found and imported but not used)
Would I then do #noqa: T000 on the lines with the Todo note?
why are todos checked
¯_(ツ)_/¯
Also, the #noqa: T000 at the end of the comment does not suppress the error
Hey @fervent sage, noticed a visual bug with some quackstack duck I generated
erp-
don't do that
do not do that 🥺
SKIP=flake8 git commit
oh
setting the SKIP variable will skip that hook
meaning that you don't need to skip all of the hooks, just that hook in particular
not in windows 😦
oh
PS C:\Users\Chris\src\sir-lancebot> SKIP=flake8 git commit
SKIP=flake8: The term 'SKIP=flake8' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
you'd ned to do ```
$env:SKIP='flake8'; git commit
hurm...
at least on powershell
what's your ps version
7.1.4
oh good, not a 5 user
hah ye
I've configured 5 to look like this
old and outdated, so I know instantly if I'm using it
huh, oops
and aside
this just helped me find a problem with my pre-commit config
tldr Mixed line ending on windows goes boom
lol yup
yeah 😦
pretty sure on windows tho git actually saves them as one and converts them b4 commiting but idr
git config --global core.autoclrf "input"
from memory
so yea if it doesn't work, don't blame me

@vale ibex Would you mind taking a look at #dev-contrib message ? I am planning to work with Frontogenesis on that issue but nobody has assigned it to him yet. Could you please assign the issue to him? Thanks so much! (His username is Shom770)
Done 👌
Thanks!
ran this, my computer is now firing cls at me send help
hm, chris, can I report an easy way to get around filters to your dms?
probably best to @slow bone
eh.. it involves the 2.0 update
so not terribly important, but will be easy in the future
Sure, it likely won't be me who does the update, but the mods can relay the concerns to the core devs
Thank you!
Are you allowed to make a PR if you already have an issue assigned to you when your ready for it
You’re*
Yep
If it's been approved then just PR whenever it's ready
Sounds good
Pretty nervous for the code reviews for when my PR rolls around
My code is a bit messy
It's fine, we're here to help 👍
We also have linting which should help out
And any concerns you have you can ask here
While making a JSON file to store the combined data about common colour names and their hex values from https://xkcd.com/color/rgb/ and https://github.com/ryanzec/name-that-color/blob/master/lib/ntc.js#L116-L1681 , for the issue sir-lancebot#677, I found out that there's already 2 JSON files, xkcd_colours.json and html_colours.json in bot/resources/evergreen/ for the .decorateegg command.
What I propose is, we should combine all of them and also retain the fact it's from html or xkcd or ryanzec colour list, probably by making an object in JSON file with fields for html, xkcd, & ryanzec , so that we no longer require separate files for similar data and also make a helper function (probably at bots/utils/helpers.py) to find the best hex colour code for a colour name given by the user. As I believe it maybe used for other commands in the future.
Sounds good to me, have you been able to fork / clone my repo/branch?
yes I have cloned it.
You can try to do a test commit and add that JSON file to the branch
Details will need to be hashed out and
decided on with CyberCitizen01.
And btw, We can decide upon the required details either here or DMs
Should I make separate issue for this?
As some changes would be required in .decorateegg command also.
Sorry in advance for anyone watching #dev-log , sir-lancebot#842 will be failing the flake8/lint workflow for a little while
No worries
you can add [no ci] to your commit message and it won't run any workflows
will be useful while you're still developing
from discord import Embed, Emoji, Member, Message, NoMoreItems, PartialMessage, TextChannel
from bot.constants import Guild
...
@staticmethod
def _random_ducky(guild: Guild) -> Union[Emoji, str]:
"""Picks a random ducky emoji. If no duckies found returns :eyes:."""
duckies = [emoji for emoji in guild.emojis if emoji.name.startswith("ducky")]
...
```this gives an error because `bot.constants.Guild` doesn't have a `.emojis` attribute. What's the best way to solve this? I'm guessing doing something like```py
from discord import Embed, Emoji, Guild, Member, Message, NoMoreItems, PartialMessage, TextChannel # add `Guild` import
from bot.constants import Guild as PydisGuild # rename to `PydisGuild` so it doesn't override discord.Guild import```but want to know what others think
both of those feel like they'd benefit from being namespaced
namespaced?
As in ```py
import discord
from discord import ...
import bot.constants
from bot.constants import ...
discord.Guild
bot.constants.Guild```?
from bot import constants would probably be enough but yes
Right, yeah
Can anyone who is familiar with the dewikification redirects hmu in #843084396666945566?
or here if you can't see that channel.
It is super recent
...February
Well, then they changed something recently about it
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modpings.py#L116 is it safe to assume that moderators_role will never be None here?
bot/exts/moderation/modpings.py line 116
if mod in self.moderators_role.members:```
It gets set inside the task loop https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modpings.py#L38
bot/exts/moderation/modpings.py line 38
self.moderators_role = self.guild.get_role(Roles.moderators)```
Is there await until guild available call before it?
it's an on_command
@vale ibex wookie approved of talent pool, should we merge?
Ah, then yes
very cool
I'm not very knowledgeable with how discord.py works but that sounds like the guild should be available together with the role if the bot is accepting commands
Yea, on_messages don't fire until guild is ready
👍
Do we yeet whatever the talent pool is named right now?
merging now
Cool
Watch the github datacenter actually explode
Seems to be fine
Talent pool has almost 800k messages, kind of crazy
Now we need to write a mod announcement and archive the channel
Yep
Despite almost never looking at that channel, it feels weird knowing it is gone now
Like this channel has been here loooooong before I joined the staff, which will be almost a year ago now
Oh I know
Congrats Qwerty, Dorsan, Rick, and wookie! 🎉
How comes https://github.com/python-discord/bot/blob/main/bot/utils/time.py#L66 doesn't raise an error even though there's no args attribute?
bot/utils/time.py line 66
raise ValueError(f"Format can only be one of {', '.join(TimestampFormats.args)}, not {format}.")```
bot/utils/time.py lines 26 to 39
class TimestampFormats(Enum):
"""
Represents the different formats possible for Discord timestamps.
Examples are given in epoch time.
"""
DATE_TIME = "f" # January 1, 1970 1:00 AM
DAY_TIME = "F" # Thursday, January 1, 1970 1:00 AM
DATE_SHORT = "d" # 01/01/1970
DATE = "D" # January 1, 1970
TIME = "t" # 1:00 AM
TIME_SECONDS = "T" # 1:00:00 AM
RELATIVE = "R" # 52 years ago```
It is an attribute auto-generated by the enum metaclass
@gritty wind :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 6, in <module>
003 | File "/usr/local/lib/python3.9/enum.py", line 429, in __getattr__
004 | raise AttributeError(name) from None
005 | AttributeError: args
Uuhh idk it seemed to work haha
!e
import enum
class Test(enum.Enum):
abc = 42
Test.args
@green oriole :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 6, in <module>
003 | File "/usr/local/lib/python3.9/enum.py", line 429, in __getattr__
004 | raise AttributeError(name) from None
005 | AttributeError: args
I'm so confused right now

How did this even make it into main
Tests are failing
Oh no, that's just github funkiness
Alright, tests are not failing
Seems like __members__.values() is what we would want
I mean, I don't see any function that feeds user input into that
Why do we even need the check
Oh?
Because uuuhhh better checking than not checking?
@vale ibex fwiw I've gotten the bot down from 1.6k errors with mypy to 1,073
I don't know, I am really sorry for all the time related code I wrote it is hot garbage
Ah
I don't think I've seen a PR before with that few lines changed have that many files changed
The only thing I am still happy about is the use of the enum
Why is pydis trying to add mypy to Bot?
Because why not 🤷
I don't think we are adding mypy
bot#1773
At least I am strongly opposed to it
Just the amount of type changes and additional checks would be pain
Maybe if we do a rewrite one day
!remind 10h Wrote your thoughts on the issue
Your reminder will arrive on <t:1630742995:F>!
Am I allowed to make a PR if I was assigned to an issue already?
And does the issue need to be fully done or can it just be at a playable stage (i'm doing a hangman issue and it is mainly complete)
If it's not fully complete you can do a "Draft PR"
Opening before being done is even better, using a draft PR
I think it is doing everything it should be doing, so I'll just send it as a PR
You have to click the little drop-down next to the create pull request button
Though I didn't add the executioner version because I feel like that should be its own issue and separate from the overall game, it adds a bit too much
Not sure if I should though
The original issue creator wanted there to be a guesser/executioner, though executioner feels a bit too wide of a scope, so I don't know if I should add it
tldr the only limitation to making a pr is that you must have one commit
you cannot make a pr without having at least one commit
if its not ready to be merged, mark the pr as a draft upon creation
oh no
Executioner might be a bit morbid
it's just a fancy word for the user chooses the word in hangman and then can give hints or whatever
Flake8 is failing because of this, weird
Are you using poetry?
And do you have it installed globally (I.E somewhere on your path)
I do not have it installed, I presume I should do pip install -U poetry first?
Yeah
You may be better off starting with the getting started guide
It’ll walk you through all the things you need to do
Docker is fine for running
But for tests, or linting
You’ll kind of need to have poetry
You could do it on docker
But you’ll have to put in extra work
(Either install poetry inside docker, or run pre-commit skipping flake, and run flake manually)
You can use ‘SKIP=flake8 pre-commit’ to do the second approach
Thank you!
Yeah this keeps failing
Which is weird because flake8 locally does not show any errors
it just errors out from github actions
Oh is it cause the fixing end of files failed
you're missing a newline at the end
What’s the rest of the screenshot
That's it
No scrolling up?
The screenshot I replied to from earlier
weird that github doesn't show it, is that only for code files?
Probably, anyways I'll fix that
Sorry for the stupid questions
Just to make sure, did you check out that setup and contributing guide? I followed it without understanding and eventually got poetry and pre-commit working
Ah
Yep
I just never installed poetry... oops
I thought it was a separate thing haha
Also what would you all think of a possible challenge command on sir lancebot that gets a random kata from codewars?
Maybe just to send a link to a specific Kyu level
why do I not do that
thanks, this found a bug in my own ci
That's what happens all the time lmao
yepppppp
found like 3 from this
it takes about 1 second longer to run flake8 with poetry run flake8
even if I'm already in the venv
You must have write perms to the repository
which would at least have to be a staff contrib
well technically you can write your name on it but it just won't count for anything
So that's your dream rick?
I presume only core devs get on the codeowners file
no, no it is not
thinking of disabling it for my repo
currently blocks too many of prs since it was added hastly
from the prs I open it just seems to make auto reviews and then mostly people out of those that were auto requested review
A dream come true
I didn't say it was bad lol
i.. didn't say that either
I said no, in response to you saying "Being in CODEOWNERS is legendary"
hm, that would be a bit boring though since the user could just go themselves
Created: <t:1483877013:R>
Voice region: europe
Features: PARTNERED, NEWS, VANITY_URL, PREVIEW_ENABLED, ANIMATED_ICON, BANNER, DISCOVERABLE, SEVEN_DAY_THREAD_ARCHIVE, RELAY_ENABLED, ROLE_ICONS, COMMUNITY, PRIVATE_THREADS, VIP_REGIONS, INVITE_SPLASH, THREE_DAY_THREAD_ARCHIVE, THREADS_ENABLED, WELCOME_SCREEN_ENABLED, MEMBER_VERIFICATION_GATE_ENABLED, NEW_THREAD_PERMISSIONS
Roles: 90
Member status:
37,123
211,457
Helpers: 124
Moderation Team: 32
Admins: 14
Owners: 3
Contributors: 43
Leads: 14
Category: 32
News: 9
Staff: 59
Stage_Voice: 1
Text: 127
Voice: 9
Channels: 237
can @stable mountain see all of the channels in the server?
Huh, didn't know that
You don't need admin to count every channel either way
Maybe not right now.... ¯_(ツ)_/¯
Well I wish you'd need to read the channel to receive it, but I doubt it is changing anytime soon
perhaps....
Here's your reminder: Wrote your thoughts on the issue
[Jump back to when you created the reminder](#dev-contrib message)
Your reminder will arrive on <t:1630768221:F>!
I meant
but sure
hello, all deploys are off for now while I do a bunch of CI job migrations, expect a flurry of PRs





