#dev-contrib
1 messages ยท Page 72 of 1
.issue 65 meta
Right, you should mention that in #community-meta
Iโll add the meeting tag anyway
Feel free to claim a help channel or ask in #python-discussion @sweet comet. This channel is for the development of PyDis repos
also you don't need to put that in every chanel ๐
Any ideas for https://github.com/python-discord/bot/issues/447? Matching the dot separated names as mark suggested sounds like the best idea to me but not sure how viable that'd be with the amount of items to look into, then there's also the matter of not displaying all the various attributes of the name that's looked up
Was thinking of doing it in 1014 first but couldn't really think of an implementation I'd be satisfied with and it's starting to feel like it'd be better of in an another pr anyway
Can you have access to all valid symbols names without having to scrape individual pages?
Regarding not showing attributes, I'm not sure how the names are stored. It's not as simple as matching a term against the symbol's suffix, is it?
Maybe the inventory inspection here is helpful https://sphobjinv.readthedocs.io/en/latest/api_usage.html
We do have all the symbol names available after the inventories are fetched, the current way the wip pr stores them are symbol names that are used by users here pointing at tuples containing the URL, package it belongs to and its documentation group.
I'll have to think of the attributes more tomorrow, what exactly do you mean with matching the suffixes?
The important thing is that you can't rely on a cache for this. You have to have all pool of valid names available from the start
I mean if symbol = "module.Class.attribute", then if symbol.endswith(search_term") would fail given search_term = "Class", but it would pass if symbol = "module.Class"
#sir-lancebot-playground message isn't this a bug, anyone could add anyone's github to their usernmae
It's mostly a convenience feature, as you can poll for any GH username anyway
It does not have any other meaning than being able to see your stats more easily
Well, we can't easily verify the ownership of the account anyway
We could, using GitHub OAuth
but it's tedious and it would probably require someone to click on a link to open up a webpage
Yeah, that wouldn't be easy
Is this possible that bot take GH account from discord connected accounts?
Linking your GH account for hacktoberfest does not have any meaning, though
It only uses publicly available data and it's more a convenience for you
If you link yourself to another user's account, you're mainly just making it harder for yourself
And gain nothing, as you can already use the command to poll any GH account you like
that's true, but ppl can always do that, lemme see if there can be a way to do that
Why would you consider what you linked a bug in that case?
It does not grant you any sort of permissions, we don't take it as a proof of ownership for anything
It's just a way to let people poll their stats more easily; if they deliberately don't use it right, they only make things harder for themselves
You can now see joe's stats more easily than your own
yes, i get the point
^The code should be good here, but someone else with a seasonbot environment should do a test run of it
I will test it.
@nocturne hare When I look this this PR code, I find that this doesn't persist anything. All data will be overwritten after redeploy, but SeasonalBot already allows persisting JSON. What do you think, should this persist data? Also one thing I found that this run this task once per 24 hours, but when bot is redeployed multiple times per day, this may send multiple announcements.
Hey @neon garnet, gave your PR a review. Looks mostly good, but I found some bugs.
@nocturne hare When I look this this PR code, I find that this doesn't persist anything. All data will be overwritten after redeploy, but SeasonalBot already allows persisting JSON. What do you think, should this persist data? Also one thing I found that this run this task once per 24 hours, but when bot is redeployed multiple times per day, this may send multiple announcements.
@cold moon @surreal venture They raise valid points. Might be worth storing when the task was last run for when it should requeue the job on startup, and storing names from previous sessions.
@cold island Thanks, will address those once I have some free time
@nocturne hare @surreal venture I think better way should be running task in specific time every day, like Reddit in @stable mountain does.
I hope I can finish Dewikification resources app in this weekend
Sounds good. Thanks for the update. I'll tag appy so he sees this: @wild ridge
๐
@cold moon I should be free this weekend, can give it another look through whenever you'd like
I will soon finish migrating all resources YAMLs. I had to make some restructurings.
I also had to do things again and again differently because when I migrate some resources group, then current way just doesn't fit.
This channel is for discussing the servers open source projects, not really for recruitment, if you have an open source project feel free to discuss it in python general or our off topic channels, but remember recruitment is not allowed
Oh, I'm so sorry
all good!
Alr thx
Is recruitment not allowed as a whole
If you don't respond I'll assume it isn't to be safe
generally not
If you don't respond I'll assume it is to be safe
@chilly wind that's not how it works
WOAH I MEAN NOT
I MEANT NOT
THAT IS NOT WHAT I MEANT TO TYPE
userRamen = "STUPID"
if userRamen == "STUPID"
apologize()
all good ๐
At some point I practiced typing so much, I ended up with muscle memory of certain words, and I think that's what happened
Like when I was paying attention to it, I realized how much longer it took me to type something like muscle compared to something like that's
Anyways apologies and I'm going to go code python more
I was going to recruit because I have a WHOLE lot of boring work to do
I'm converting a dead project from bash into python
TL;DR cya
good luck ๐
what kind of insights stuff?
that makes sense
right now I think it'll just be the anti-spam stuff
and then storing a json object
schema validation can come slightly later
Is there a way to safely delete a bunch of redis keys? I was thinking of allowing manual deletion for the doc objects from 1014 in case of a lib update to force their refresh, but it doesn't look like there is a way to do it without iterating over them which could be interrupted by a redeploy
Tonight I was planning on trying to implement something Zig proposed in the staff repo
but now that I'm sitting here, I realize
that would be work.
Lol
@brazen charm You could do it with one redis command, but I don't know if a redeploy would cancel an ongoing operation in redis
It's HDEL
If you store all the fields you want to delete under the same key, then using DEL will clear all the fields
And you wouldn't even have to specify which fields to delete
Yeah, they are all separate keys and I couldn't find anything that'd just do it in one step (without a lua script) instead of scanning through all of them
https://github.com/python-discord/bot/pull/1269
https://github.com/python-discord/site/pull/410
Can anyone review these 2 PRs
closes #1172
This PR uses the new API endpoints and features implemented in python-discord/site#410
Hence, this PR should be merged only after the Site PR is merged and deployed.
Commands/Functiona...
@eternal owl Reviewed both PRs.
@wild ridge https://github.com/python-discord/site/pull/421 Resources PR is ready
Can anybody give second review on https://github.com/python-discord/site/pull/417, because then I can start working on migrating pages?
you don't sound well @patent pivot, are you sick?
hahaha yes, I just got up so I have a low voice
ahh okay
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
What are you discussing in voice?
devops
What are you discussing in voice?
@obsidian patio k8s migration
Ah, okay. About dewikification?
Okayy
we're moving away from saltstack as our orchistration toolkit
and moving to kubernetes
Ohh righty
it'll manage and deploy all our services for us
@patent pivot don't we have an env var for ALLOWED_HOSTS?
pythondiscord.com - A Django and Bulma web application. - python-discord/site
Nice, my internet dropped
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-redirectregex
spec:
redirectRegex:
regex: ^https://github.com/pythondiscord/(.*)
replacement: https://github.pythondiscord.com/${1}
as example roughly
I try to understand something about it, but Kubernetes looks so complex to me.
@cold moon https://youtu.be/PziYflu8cB8
Learn the basics of Kubernetes and how it's used to scale containers to massive workloads in the in cloud, in 100 seconds. https://fireship.io/tags/docker/
Docker in 100 Seconds https://youtu.be/Gjnup-PuquQ
Full docker Tutorial https://youtu.be/gAkwW2tuIqE
Official Kube docs...
Thanks
np
Very cool
It's very interesting how all these things in devops just work together (I can't remember the word)
things = microservices, I think?
If we use helmfiles, we are mostly relying on community content, right?
individual repos can be scary though
Contribs aren't gated by the maintainers
Oh, now I understand
smh scragly not sharing to dev contrib or dev ops
lol
more like sms. shaking my scragly.
I want to join, but sadly i can't
Is there any places that I can deploy my api free
!ot @clever wraith This channel if for discussing the development of PyDis repos. Feel free to ask in off-topic if you need somewhere to deploy your api
Off-topic channels
There are three off-topic channels:
โข #ot0-psvmโs-eternal-disapproval
โข #ot1-perplexing-regexing
โข #ot2-never-nesterโs-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Which one
@clever wraith Choose one of them where is not active talk about something currently.
About what devs are currently talking in dev voice?
One moment, I'll bring my AirPods and I'll join
Redis ops should be fairly cheap, right?
@brazen charm do they have to be separate keys? Do they each have their own fields?
Unrelated, I have a PR to update snekbox to 3.9 https://github.com/python-discord/snekbox/pull/78
Needs a review
They're separate keys so expires can be set on them
So that's not possible with fields?
No, those can only store values without being full redis objects
could technically move them to a hset with handling the expires in python now that idletime is not checked if a single redis op would be ensured to run completely
Currently we aren't sure if that an ongoing operation will complete
We're also moving stuff to kubernetes so the behaviour may change ๐คท
Opened up https://github.com/python-discord/bot/pull/1014 for reviews
May I ask why the migration to kubernetes was done and what was previously used? 
what was previously used
"where was it migrated from"
We previously used (currently use?) SaltStack. From what Iโve heard, thatโs just a nightmare in a lot of ways, so weโre trying to move away from it
Oh, alright. Thank you for the response. Now I guess I have to look up what SaltStack is.
Hahah yeah. Iโm not that involved in the CI/CD here, so there may be someone else who could give you a better answer
Can I submit PR that changes @stable mountain docker-compose.yml site image to GHCR or this is already planned?
Also, http://pythondiscord.com is not working. Says 404
This doesn't redirect to HTTPS
When I try to access to this with HTTPS then I can see it
works for me
Huh, looks like some weird Safari thing
it redirects me to https on chrome
I know, in Firefox this is working too, but not in Safari
oh u are right
One thing that is currently broken on site: OAuth. I know that this will be removed, but should be fixed until that. In Discord login I get Invalid OAuth2 redirect_uri.
I... can reproduce
And I can reproduce in firefox if I strip the https to http manually
it seems the https redirect isn't working, but a lot of browsers start with https
๐
it seems the https redirect isn't working, but a lot of browsers start with https
@sharp timber
fixed.
๐ is working
Can I submit PR that changes @stable mountain docker-compose.yml site image to GHCR or this is already planned?
@cold moon comment on the open PR I think
@patent pivot Python bot doesn't have PR yet
yes there is @cold moon
Oh
Looks like my browser used cache from previous session
Change is already made there
@wild ridge Will you have time today to review dewikification PRs?
Can do @cold moon
Thanks
Would appreciate some feedback on https://github.com/python-discord/bot/issues/998#issuecomment-721477072 so work can be started on it
Why @stable mountain docker-compose have such low Redis version? Can I use higher for @dusky shore ?
I'd use the same version as we're using in production to avoid problems
There's no reason to test things locally with a different version of Redis that's not actually being used
No plan to push production from 5 to 6?
That's just docker-compose
that's not used in production
Our production deploys with redis:latest
I think that we should indeed have that same version in the compose then
Unless @patent pivot knows of reasons why we shouldn't
Okay, I will use latest then for @dusky shore
I have to say, the kubernetes thing makes checking this easy
yeees
Everything is in one place
kubernetes is so smooth
I want to take it out for a drink
buy it dinner
make it my wife
Where you check this stuff? Some dashboard?
probably just in the manifest files in our k8 repo
Oh
(which is private right now)
Some Kubernetes users use some sort of dashboard
Yes, although we're going to control access based on a need-to-know basis
joe was looking into access control groups and such
well, maybe. I'm not 100% sure the kubernetes repo can't be public.
yeah, that's true, I was talking about the dashboard thing joe discussed
I think so
But, anyway, we're indeed running 6.0.9 in the cluster
1:C 15 Nov 2020 14:19:45.099 # Redis version=6.0.9, bits=64,
kubectl is neat
What I should use for Redis host?
For local development, it's easy: redis, but what for production?
These are the configurations we use for bot:
redis:
host: "redis"
port: 6379
password: !ENV "REDIS_PASSWORD"
use_fakeredis: false
Okay, thanks
How did you find that?
ah, it's also in the readme
but default.svc.cluster.local is basically always gonna be in every host inside our cluster
and the first bit is the hostname we've set in the manifest
I'm looking for the kubectl way of getting the info
I'm not that familiar yet with navigating the vast ocean of information you can fetch
well you could do kubectl describe service/redis
and it'll give you the name and the namespace
not the whole host, though
yeah, I got that far
but it's gonna be <name>.<namespace>.svc.cluster.local
yeah
if it was exposed to the world it would have a domain in the end or something like that I think
I'm not sure how that would look
but that's not really a thing for us
because we're not using services like that
actually disregard all of that, I don't know what I'm talking about
but at least the local bit, it's possible that this can be something else in other contexts
just not inside the context of how we're using services.
I have a bot PR open
the dashboard isn't the traefik one, there is a Kubernetes one, but I need to see how that will play into Teleport
wow aperture our here approving draft PRs
"I approve!"
"but I haven't start-"
"I approve!"
blocked by snekbox right now
๐
Maybe I can strip down on the custom build options that are there to speed up the build for now
And just get it running
We can tinker with manually caching containers/layers later, if we want
that sounds reasonable
once we have auto-deploy and everything setup we are free to tinker
Maybe teh --cache-from will work as well in the future
Most of our dockerfiles can be optimized to be honest
Because that should do (about) the same
to be honest going by the auto-deploy on site right now things do seem faster
but maybe it's a fallacy because I proposed k8s and hate salt lol
haha
We have runtimes we can compare
There are still some azure runs up
but you need to be quick; they're auto-deleted in x days
because we don't pay monies
4m 41s on site for last azure build to add notion to sponsors
2m 55s on github actions
can't complain about that
a linting + pre-commit run without dependency changes is also lightning fast
caching works very well
Actions is reaaaally fast
docker.errors.APIError: 500 Server Error: Internal Server Error ("b'Mounts denied: \nThe path /opt/pythondiscord/seasonalbot/log is not shared from the host and is not known to Docker.\nYou can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.\nSee https://docs.docker.com/docker-for-mac for more info.'")
get this when trying to run SeasonalBot in Docker.
Looks like that Docker don't like /opt/
Seems like youโre using docker-compose to use the bot, but we donโt really seem to use this method
I think after adding Redis, docker-compose may be easier way
Yeah
Added /opt to file sharing
What are you working on?
Alright, how are you running redis for now?
I added it to docker-compose.yml
Alright
What does it need redis for?
It seems like this compose setup needs to be redone
What does it need redis for?
@brazen charm persistence
JSON doesn't work with Kubernetes anymore
We are stripping out the json files because of the migration to k8s
Wouldn't a normal db be more suited for proper persistence?
if we want to provision storage we have to provision a minimum 10 GB volume
Redis is setup in a safely persistent manner
I donโt think we need a fully featured db for seasonal
Well, we could use PostgreSQL, but that's much more work
we use both RDB and AOF persistence
root@redis-b9c7d96f8-qqrj6:/data# du -ah
4.5M ./appendonly.aof
16K ./lost+found
4.5M ./dump.rdb
8.9M .
It works, but it's not really what it's intended for, is it? I'm not familiar with the devops but why aren't the json files feasible anymore?
well, we don't want to provision a 10GB volume for 3 or 4 JSON files
And redis avoids that with sharing the service with the bot?
What if the JSON files were that large
Yeah, with Redis we can provision one volume that bot, seasonalbot and hastebin can all use
What if the JSON files were that large
we shouldn't be using JSON anymore then ๐ฝ
Well sure, but what IF
We would run into OOMs lol
I wonder how many users thatโd be to fill 10Gb in github handles haha
Only 9,300,000 users
Afaik the Hacktoberstats cog persists somewhat tabular data
but I guess it can still be done with Redis ๐คท
hmmmm
I think branding is a boolean for whether the daemon is enabled. Candy collection I thought was now a uid => candies mapping an github links can be uid => github name
yea it's probably fine
I was initially planning to persist more than just the bool for Branding, but eventually decided not to because of no good persistence options
but I don't remember what it was
I never really liked JSON file persistance anyway
redis seems far cleaner
especially now that we have the async-rediscache package
yes, but I think only having the ability to map to simple values can promote bad designs where you rely on multiple caches to represent the same "object"
and they can go out of sync if it's not done properly
so it may not be the most beginner-friendly setup
you can always serialize more complex types, but you have to (de)serialize them yourself
I just don't see us running into that problem a lot
yea it's fine, just trying to think ahead
I appreciate that
it's definitely cool that seasonalbot gets redis
if there really was a need, I guess we could grant seasonalbot access to postgres or even mongodb
but I'd really rather not
So, why not postgres? The setup complexity through docker should be pretty much the same
I wouldnโt think that this is a good idea (to add a db), since seasonal is supposly our entry level project
We already try to not except contribs to know docker
Not going to be much different with redis
sure it is
Knowing how to setup a database locally and use it seems harder
async-rediscache supports fakeredis so you don't actually have to set up redis
it just won't persist the data while using fakeredis
but it'll work
@hardy gorge you wrote the fakeredis implementation into async-rediscache, how easy is that to set up so that our contribs can have it using fakeredis locally but we can use real redis in production?
trivial
It's a kwarg you pass to session
Just make sure to include the fakeredis install option
so, we'd hook that up to an environment variable or something
Yeah
We can even use fakeredis if no env var for the redis address is provided
yeah
that's what we want for seasonalbot too, fakeredis for local dev and real redis only in production
that way there's no added complexity at all
@green oriole Yeah, we can. The only downside for bot was the hierarchical nature of the configs, meaning that there was always a host available
In seasonalbot, we can solve it that way
WEll
maybe
It may hide configuration mistakes in production
Let's not do that
Let's make the option explicit
i.e., we don't want production to fall back to fakeredis if we somehow mess up configurations and don't set a host
We couuuuld print a warning if we fallback to fakeredis, this will create a sentry issue if something is misconfigured
no, we should just fail
Yeah
hard
use_fakeredis = environ.get("USE_FAKEREDIS", "false").lower() == "true"
if (no host configured AND not USE_FAKEREDIS), just crash the bot.
it's the safest way
sys.nope()
basically that
check it at bot startup and crash hard. sys exit or something
with a clear reason
log critical errors
basically 
So in __main__.py?
I'll leave the implementation details to you, you can figure it out
just don't let it run in that state
It'll probably come crashing down during start-up if the redis session can't connect, but we should not rely on that I think
I'm never exactly sure when discord.py starts hiding errors (this is during the bot's start up)
@cold moon donโt forget to mention on your PR that you added a config entry, so the merger will add it to the contrib guide
Quick question: What I need to do in docker-compose.yml to automatically sync files?
I don't want rebuild every time
And to where?
Thatโs it
Oh
the . means current folder
Okay, thanks
I will make changes in docker compose too to make development easier
One thing is like relaying environment variables from .env
yeah that's nice
Ah, redis can be made optional easily, guess it's worth the tradeoff then. Just make sure to clearly note it in the contrib guide as there have been a few people here asking for help with redis setup for the bot while they didn't need it at all for the features they were developing
Question about AsyncCache increment: Does this create key when key don't exist?
No
Okay
hmm, quick thought <@&587606783669829632>
Why should the branding manager even be in seasonalbot? maybe we take this opportunity to move it into Python?
it's core community functionality, not some fun entry level toy
it doesn't really fit seasonalbot anymore.
and then we wouldn't need to introduce rediscache in seasonalbot yet.
branding manager?
The โswitch logo every 3 daysโ thing, I assume
But I'm already doing this. Basic setup is ready, now migrating extensions...
ah right. yeah it's not a "fun" thing anymore, and seasonalbot isn't primary for events management anymore
i don't think we're in a rush to move it though
we could probably better plan things later in the future
I may not be a core developer, but I think that sounds smart. In some sense, it would be nice to leave the more permission heavy things like that in @stable mountain. SeasonalBot is more of a fun learning bot nowadays, so it doesnโt really make sense to keep it there. I also agree that the functionality of changing the icon every 3 days isnโt some quick and fun thing anymore, but actually a more central part of the server setup. Those things should be handlers in @stable mountain
we could probably better plan things later in the future
@glass pecan
@ks123 is rewriting the branding manager right now. perfect time to move it.
I say move it
How will we (will we?) change SeasonalBot icon?
Default? For now
Why hackstats is storing date_added for linked names?
I say don't change it for now
We're planning to rename seasonalbot anyway
Have the branding manager do community branding
How will we (will we?) change SeasonalBot icon?
Think y'all can make @stable mountain talk to @dusky shore ?
Maybe add a change_pfp command to seasonal bot and make @stable mountain invoke it (janky, I know)
there must be some way for @stable mountain to talk to @dusky shore
no thanks.
lol ok
Looks like hackstats command doesn't even use date_added for links. I will remove it, as this will make storing it in Redis easier.
let's not add even tighter coupling between our services.
the seasonalbot avatar does not need changing.
not its nickname either
oh, btw
@dusky shore still has the Diwali icon
yes.
@cold moon do you mind moving the code over to Python and stripping it from SB then?
If we are going to use a static pfp for seasonal, yeah, letโs move it
shouldn't affect the code you already wrote much.
Okay, I need to find all places then where things take place, as they are not all together.
very good.
.uptime
I started up a day ago.
Just wanted to get a feel for it
Let name it FunBot
We are going to use snake name iirc
Why did SeasonalBotjust get the name @dusky shore?
bots get snake names
it's something that was discussed a fair while back, seems ves has finally actioned seasonalbots at least
Discussed where?
Iโve seen it in #organisation and #dev-core
Hmm, ok
Branding has ties to the seasonal system that Seasonalbot has, although its less prevalent now
It used to make more sense
Should be detachable now
You may want to check out the month override env var, it may or may not need to be duplicated
Im not sure if Branding uses it or not
Can I currently leave MonsterSurvey not migrated, as this have static data and votes in same file?
This need major refactor
Please review ๐ฅบ I was hoping to get this through quickly but it's been 1 month https://github.com/python-discord/bot/pull/1245
!remind 1H review that
Your reminder will arrive in 1 hour!
i got you
@tawdry vapor Should https://github.com/python-discord/bot/pull/1275#pullrequestreview-531592895 use tldextract for checking, as this do more parsing?
I don't think that will be adequate
It lumps all subdomains into one attribute
I think you need to split by a . and compare the tuples from right to left
For example, if a filter is on foo.bar.com then www.foo.bar.com needs to be matched
multi-level subdomains seem rare but I believe they do exist
they defs exist ๐
@crude gyro
Here's your reminder: review that.
[Jump back to when you created the reminder](#dev-contrib message)
@tawdry vapor looks good, just missing conflict resolution then on https://github.com/python-discord/bot/pull/1245#pullrequestreview-531639134
and you can merge it
Any opinions on the name @crude gyro ? It was the main reason I avoided giving it a more thorough look and approving, and the other reviewers seem to prefer bot_instance
I don't have a strong opinion.
doesn't really matter to me what it's called
getting the PR merged seems more important than bikeshedding a variable name
As long as the instance isn't stored as bot.bot.bot haha
Why isn't CI running
Never mind, it did
But there's one expected check that didn't run
Is it the old Azure check?
Adding branding manager to @stable mountain is almost ready, only few small things left. Tomorrow I'm gonna remove all branding stuff from @dusky shore
Nice!
nice work, @cold moon
I really appreciate all the work you've been putting into our services recently
it's been noticed.
Thanks
you're making a very positive impact on Python Discord.
and I genuinely appreciate that.
๐ฅฐ
how is this? on the wiki command , a bit improving it
and this, a stackoverflow command
(haven't added a thumbnail)
looks cool!
Can I use pickle to serialize and deserialize data (for the seasonalbot)? I need to store the Member object to make the data persist. ks123 suggested only storing the ID, but then I will need to change wherever I reference the member to bot.fetch_member the Member object every time.
what kind of information about the user do you want to persist?
pickling the object sounds like a bad idea
if you're working with a Member instance, you want to be using the one from the bot's cache
that way it's an accurate representation of the Member at the current time
and how can I access the cache? (and I just need to store the Member instance to ping the person later-on)
if it's cached then get_member https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.get_member
if not then you need to fetch a fresh one https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.fetch_member
you can construct the ping from the ID
from the user's id?
ah okay thanks for your help!
no worry
Iโm looking to access an emoji by a URL to the GitHub repo. Where should I store this? I assume it should be in a variable/config file
I think both Python and Seasonal have an Emoji config class
though if it's a URL then maybe that wouldn't be the best place to put it
Python also has Icons, that sounds like a better place for it
it's currently full of CDN URLs
Are they referenced by URLs their?
yes
Ah, perfect
Lovely. Thatโs exactly what Iโm looking for

Iโll be using the GitHub link if thatโs fine?
I don't see why not, although you could just upload it to Discord and use the CDN link
Yeah. The issue with Discord is that they may change to require discord.com in the future, they compress it and itโll be hard to modify
Perfect. Thanks
we might be thinking of just moving it to @stable mountain, but i'm not 100% sure on that
i think you said something about this @crude gyro
I think that is what they mean with "branding moving"
#dev-contrib message any feedback on these?
Whatโs up with the navigation?
I think it is for the data
Yes, I assumed that. I meant why there was a thing in the middle
the stop symbol? โน๏ธ ๐คทโโ๏ธ
ah yes, i had made my own paginator, i am almost done shifting to the utils one
Oh? You made a pagination for it?
Also, do we have an issue on the repo about this?
yes
, i was doing it separately first, but then it came out well, so thught putting it here too
idts
not for stack
Ok. Wanna link it?
there are no issues for them
Oh? I thought you meant that there were for the first one
I think something similar to the first one could be cool. However, Iโd appreciate seeing an issue on it first. That way, we wonโt be multiple people working on the same thing that accident and we can discuss if itโs really something we want to do
ok! will open a issue tomorrow, need to go! thanks
@crude gyro https://github.com/python-discord/seasonalbot/pull/521 and https://github.com/python-discord/bot/pull/1289 , these are branding manager moving PRs.
Relevant Issues
All these things got approved in server.
Description
Redis storage
Implemented async_rediscache to bot in order to allow replace JSON with Redis. Added following env variables: R...
This should be ready to merge after one more review. It's a quite short but significant PR, so I'd love to get it merged soon (we already have one approval)
How do you guys use docker on windows? Using wsl or install docker desktop with hyper v enabled ?
Using the WSL back-end
alright
I already had docker desktop set up so I just continue using it
I rarely use Windows for doing pydis stuff, but when I did that recently, the WSL installation was a breeze. I probably wouldn't have switched if I were to have had a working setup, but installing and running docker with a WSL back-end is now so trivial, it's amazing.
yeah, that's what I hear, so if you don't have something set up it's probably better to go with that nowadays
#bot-commands message why is this happening?
OOM somehow
#bot-commands message hmmmm, new
I got a new pc (windows), my usb wifi adaptor does not support linux so I gotta stick in windows.
I could use a VM but I think WSL will be better and easier for docker.
Just don't use pipenv run lint, it's broken on Windows because of line endings. Let the precommit run during the commit itself.
okay
do you guys use wsl.exe as terminal or cmd? basically, where do you keep your virtualenvs, in the wsl or windows itself?
It should work fine after changing the line endings in your git config
.issue 521
.issue 1289 bot
Can we get these merged pretty fast to make branding daemon working again?
We're currently pretty busy with the migration, which needs to move forward quickly
Okay
Where are @dusky shore and @stable mountain hosted?
Linode
ah okay thanks ๐
That's right
Hey so when I was getting my env ready for Seasonal Bot I was getting the pipenv ready but I don't know what file to point it to
What do you mean by "what file to point it to"? If you follow the setup guide we've got for the bot, it should all work out
In general, you need open something like a cmd/terminal window, navigate to the folder that contains the cloned repository, and then run pipenv sync --dev. That will automatically detect the Pipfile.lock that's there and install the correct dependencies.
It's not a file you should run yourself. Rather, you run pipenv and it will pick up on the file being there.
Are you following our guide?
Yes
I have a window open and it's asking for a pipenv excutable
I have no idea where that exe is though
Did you install pipenv?
What do you mean?
pipenv is a Python package that you need to install
It's listed in the requirements here: https://pythondiscord.com/pages/contributing/seasonalbot/#requirements
Ahh should I put Python\Python38\Scripts on path or leave it how it was installed?
Yeah, it is a good idea
Okay I got everything working and I was wondering if there was a way to run from PyCharm as pipenv isn't registering
sorry if this a dumb question but can someone send the file on github where the @stable mountain detects token leaks
I had actually just pulled it up: https://github.com/python-discord/bot/blob/master/bot/exts/filters/token_remover.py
lol thanks
I'm on windows and currently failing the precommit hook due to mixed-line-endings Flake8? It's just telling me it's failing on the Flake8 hook and not much else.
try setting core.eol to lf and core.autocrlf to input in your git config
It's fixing the mixed line endings but just failing flake8 because it's not a recognized command. Which I don't know how to fix in a pipenv environment
Are you using pycharm @thorny obsidian ?
Ah, not sure then, pycharm has a problem where you have to manually edit the precommit to activate the venv but don't know anything about vscode
What type of edit is required for the precommit in that case?
I replaced the block of the code that ran the commands for pre-commit with raise SystemExit(subprocess.run([INSTALL_PYTHON.replace('python.exe', 'activate.bat'), '&&', *CMD]).returncode)
(Or something along those lines)
sorry, managed to delete a prenthesis when copying it over from the file I was trying it out in; should be fine now
So looking at the lint-build-deploy.yaml, the flake8 is run separately from the other pre-commit hooks. So that was replace in... the flake8 hook or the other precommit hook? Or somewhere else entirely and I'm looking at the wrong file?
In the pre-commit file under .git/hooks, there's an if block at the bottom that's checking platforms and running system commands
Don't know if it'll help you but of it's wrong reinstalling the pre commit will get the original back up
@brazen charm YOU ARE MAGIC THANK YOU
pre-commit run --all-files how do i run this for a specific file?
pre-commit run file_name.py?
(seasonalbot) jason@devlab:~/PycharmProjects/seasonalbot$ pre-commit run extra_wikipedia.py
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/jason/.cache/pre-commit/patch1605770446.
No hook with id `extra_wikipedia.py` in stage `commit`
[INFO] Restored changes from /home/jason/.cache/pre-commit/patch1605770446.
I guess you haven't staged the file
It's saying that it doesn't recognize that name as a pre-commit
If you want to specify individual files, you have to use the --files option
This will try to find a pre-commit "hook" (checker) called extra_wikipedia.py, which we don't have
pre-commit run --files extra_wikipedia.py should work, @short snow
thanks!
What Kubernetes stuff PyDis uses? I mean like deployment tools etc.
k8s does deployments
Oh, true. I looked wrong section in K8S docs, that covered special setups for some providers, what need deployment tools.
Why staff will have their own AoC leaderboard?
Just the way we've decided to run the event this year. We may offer a small prize of some sort to the staff leaderboard. We can't really do the same for the public board since we've experienced issues of cheating in the past.
Oh, so other users will get nothing from public leaderboard?
We'll see, I guess we could look into doing a cosmetic prize of some sort
I'm not the events lead though, so it's up to kutie for how we run things :)
Okay, I remember how I tried to get this IDE license last year...
old good times... lol
I was debating whether there should be a small or cosmetic prize for the PyDis leaderboard. Right now I'm hesitant due to the prior cheating issues, but I'm willing to re-evaluate depending on how the event goes.
But the staff board was something that was requested, so I'm happy to comply and set it up
@valid quest Just wanting to check in with you on this PR: https://github.com/python-discord/bot/pull/760 Are you able to work on this? If not I completely understand. We can always have someone pick up the torch if real life has you caught for a loop. (This isn't me trying to be pushy, just checking on you)
Does RedisCache not support __class_getitem__?
do you mean __getitem__?
it's not possible because that method cannot be asynchronous
similarly with __setitem__
like, type aliases
# why is it like this?
# RedisCache[discord.TextChannel.id, UtcPosixTimestamp]
claim_times = RedisCache()
# and not this?
claim_times: RedisCache[discord.TextChannel.id, UtcPosixTimestamp] = RedisCache()
ohhh, that makes more sense
not sure
@hardy gorge would be the one to ask
also, is __class_getitem__ a dunder that exists?
wouldn't it be __getitem__ on a metaclass
"But the language reference explicitly reserves all undocumented dunder names, and allows "breakage without warning""
interesting tidbit from that pep
>>> class FooMeta(type):
... def __getitem__(cls, key):
... print(key)
...
>>> class Foo(metaclass=FooMeta): pass
...
>>> class Foo2:
... def __class_getitem__(cls, key):
... print(key)
...
>>> Foo[str, list]
(<class 'str'>, <class 'list'>)
>>> Foo2[str, list]
(<class 'str'>, <class 'list'>)
dev-esoteric-python-contrib
hahahah
anyway my goal is to solve the !close bug that we uncovered a few weeks ago, and it looks like I just need to understand the rediscache api and then it should be a trivial fix
for some reason pycharm thinks rediscache isn't installed
@sullen phoenix I forgot what change I had to make to what file for warnings and such to work in a test environment
I think I had to stash it to switch branches and that was a few days ago
Those type hints you're now trying to give don't look like type hints.
Whatever emulates the infraction database locally
One is just documentation of the attribute used, not a type
true
Whatever emulates the infraction database locally
@trim cradle you need to run the actual API
ahh i gave you my config, right?
if so, in the docker-compose.yml, change the site aliases from subdomain.web:8000 to subdomain.pythondiscord.local:8000
Is there currently something to do in https://github.com/python-discord/forms-backend ?
hmmmm
not yet really
it's been blocked until the k8s migrate @cold moon
so I've only just started working on it again
soon I'll be setting up api.forms.PythonDiscord.com
Oh, yeah, this don't even have any CI.
@mellow hare Are you working on https://github.com/python-discord/bot/issues/1292 ? As you got assigned and unassigned there.
It will have CI soonโข๏ธ, I'll just steal from Ves ๐
<@&295488872404484098> <@&778378647618453545>
A fun idea that was suggested in a staff channel just now: Whenever says "seasonalbot", <@&518742000514891776> can respond by pinging that person and explaining that actually their name is Sir Lancebot.
The bot would pick one of 10+ random responses so it doesn't feel repetitive, and we write all the responses in old timey medieval English.
Anyone wanna write it? Or does anyone have suggestions for fun medieval responses the bot can give?
one request: a cooldown
Feels like a common enough phrase now that it could become annoying
No I'm not working on it. I had Bast write up the issue and he assigned me to it. I was just trying to organize it. If you want it, it's all yours
The responses should also happen in the commands channel imo to not pollute topical/help channels
I don't see a context where seasonalbot would come up in conversation in topical or help channels
Unless it's someone suggesting "Hey, if you want to learn about disocord.py" blah blah
well I hate the idea to put responses in bot commands. I'd rather scrap the whole feature than go for that implementation
But it is a bit more obtrusive than like the Halloween one where it's just a reaction
I'm not super keen on it actually sending a message
A reaction doesn't indicate much
We could otherwise just react with
to the messages
I'm not suggesting it as an alternative
We should probably look into rebranding the code and repo before we add this feature though
Just that I don't like the idea of the bot interrupting help
seasonalbot has been mentioned less than once a day in #python-discussion and that is when it was called seasonalbot
"Come on, that's not my name! I'm Sir Lancebot"
Something simple like this (one line) could be fun
I'm just really really against anything that interrupts help channel stuff at all
I kind of see those as sacred places
If someone says "Check out SeasonalBot", how helpful is that, to be fair, if they can't find a repo or bot with that name?
you could have it as a message that deletes after a certain number of seconds
interrupts is a strong word. it implies anyone would ever see this as anything except a bit if fun.
I guess it not that bad with the frequency it may occur in general channels, but k don't see the need for it to be active outside of the bot's channels as hemlock said
I do wonder what contexts seasonalbot would come up in a help conversation, or even a #python-discussion conversation..
Fine, interrupt might be the wrong word, but my point is that a bit of fun shouldn't disrupt, bother, intrude, whatever adjective properly describes it, a help channel. That's why the server exists
like, once we rebrand the repo it will just be "check out sir lancebots source code" as an example in py-gen and maybe d.py
I'm really firm on this
"No no no, don't be silly, I'm Sir Lancebot" something like this?
I don't see it coming up in a help conversation ever
I think it could come up as a "here's something you could try contributing to". But in that case, isn't it better to tell them that it's not called SeasonalBot and that you won't find anything with that name? They may not actually know how it is
Who is Contributor Lead?
(I will sometimes reference Seasonal Lancebot in help channels as an example if someone is stuck on a d.py feature)
@cold moon I am
hemlock
Okay, is this Leads thing new?
It is yeah
sounds like you're defending a very fine principle, even though it doesn't really work for this implementation. if someone mentions seasonalbot and sir Lancebot corrects them, that's not gonna disrupt, interrupt, or intrude. I think the helper will say oh right we changed the name and probably call it Sir Lancebot next time.
in all of the active help channels right now there has been 5 mentions of seasonalbot
ever
2 of them are links to source, 3 of them are people working on seasonalbot, lol
or it wld only work in dpy, pygen and help channels?
I think in the few contexts "seasonalbot" will come up, clarifying what the bot's actual name is is not a bad thing. But like joe said maybe it should wait until we rebrand the repo
Fair enough
yeah, we should go ahead with the repo rebrand before we do this
I agree that we should rebrand first.
@cold island Yeah, that's my point exactly
I concur ๐
@cold moon All yours
Gonna fix it now.
Appreciate it. Let me know when you need a review
what is the state of this PR?
I'm not sure
It's probably something we need to think about and we now have an Event Lead.
We typically don't have a lot of dates far in advance, not currently anyway
so the event lead decides the dates/upcoming events ?
but it's nice to have a good overview of future (and past) events
I have a tentative event calendar on notion, but I don't think I have anything firm enough to put up at the moment. We could at least put AoC and backfill the previous year's events.
I'm not sure what the calendar might look like with dewikification though.
No, but their opinion and vision is important for features like this. We typically discuss events very broadly with staff and in the admin team.
I think the past events are displayed in the timeline
future integration possible probably
we don't anymore, lol
but yeah, it used to run our linting CI flow and deploy to salt as CD
then, is this still required?
https://github.com/python-discord/site/issues/338
No
oh yeah that's irrelevant
alright
The problem is that we don't really have such a link now
I've been thinking about creating a GitHub action for custom webhooks for our runs
Because, currently, a merge could trigger up to three separate check webhooks and none of them have links
yeah, there is a slight downside to the workflow_run in that it isn't attached to a commit
I think we could make one with a bit more info that only sends one for the final workflow that runs.
So, either a failing one (which stops the worflow sequence) or the terminating one for that trigger.
Anyway, this issue can be closed for now
yep
https://github.com/python-discord/site/issues/210
this is also an old issue, asking for a web based repl on our website
The features mentioned by the author are already present in https://repl.it/
So, do we still need that issue?
Can I use non-async emoji library to de-unicode emojis to such :emoji: format to catch emojis?
How does this library work?
Looks like that this is built to re library.
No, as some emojis is collection of multiple unicode emojis. They are managing list of these: https://github.com/carpedm20/emoji/blob/master/emoji/unicode_codes.py
I see
It wouldn't make sense for a library like that to have an async API, so yeah, go ahead
Can you mention it on the issue?
How would using that library work for custom emojis? As they can have any name
We would use the current regex for that
I will still use Regex to do final parse
I use demojize function to convert unicode to :emoji: format, then I can use findall
@mellow hare https://github.com/python-discord/bot/pull/1293 Here is PR
Damn that is some fast work
There isn't any major changes, so this don't take much time.
I can't read it without seeing demo jizz
Lmao
lol
Hahaha
<@&295488872404484098> https://github.com/python-discord/bot/pull/1293 Can we get one more review on this?
I already reviewed it
Or you want a 3rd review?
Haha no worries
Nice, so fast merge
.issue 1287 bot
Could we get a second review on this? Itโs a very short change
Discussing the k8s migration in Voice?
Alrighty
@tranquil topaz When you have time, can you wrap up https://github.com/python-discord/bot/pull/1152 ? No rush, just want to remind you of it.
oh right, i have forgotten. thanks.
@commands.command(name="close", aliases=["dormant", "solved"], enabled=False)
async def close_command(self, ctx: commands.Context) -> None:
log.trace("close command invoked; checking if the channel is in-use.")
if ctx.channel.category != self.in_use_category:
log.debug(f"{ctx.author} invoked command 'dormant' outside an in-use help channel")
return
if not await self.dormant_check(ctx):
return
claimant = await self.help_channel_claimants.get(ctx.channel.id)
await self.move_to_dormant(ctx.channel, "command")
await self.remove_cooldown_role(claimant)
...
Still working on the close command; it looks like claimant still isn't the right data type.
oh I think I know
self.bot.get_guild(constants.Guild.id) gets called a lot--why isn't the guild an attribute?
Yeah it may be a good QoL to add it as an attribute
I mean, as an attribute of the bot
But it's just to shorten code
Getting the guild isn't an expensive operation as far as I know
It just looks it up in a dictionary by ID
@tawdry vapor can you go here and type >close? #704362672644423840 message
class SeasonalBot(commands.Bot):
def __init__(self, **kwargs):
# ...
self.loop.create_task(self.send_log("SeasonalBot", "Connected!"))
This is how it currently looks when starting the bot. Do you know how I could get the username of the bot instance in this function? This is part of bot/bot.py
You have to do it in a coroutine, since you must wait for the guild to be available
Then you need to fetch the bot's Member from the guild
Cause I don't believe ClientUser has nickname info
If you need it's name rather than nickname then ClientUser is fine
And you wouldn't need a coroutine/waiting for the guild
I purely need the username of the bot. The nick name doesn't matter
Then bot.user.name
Ah well
bot.user is None if the bot isn't logged in yet
And cogs are loaded before running the bot
So... maybe you do need to wait for the guild after all
So, it's logging that it has connected before actually starting the bot?
I'm not as familiar with seasonal bot
But it is possible to load extensions and cogs before the bot logs into discord
can't you use bot.user in on_ready?
Yeah I suppose that's fine
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.http_session = ClientSession(
connector=TCPConnector(resolver=AsyncResolver(), family=socket.AF_INET)
)
self._guild_available = asyncio.Event()
self.loop.create_task(self.send_log("SeasonalBot", "Connected!"))
For reference, this is the full __init__
Cause you don't need the guild for a username
Is it possible that other bots online in the test server are interfering?
there's an issue in my code for sure, I'm just wondering what else might be in play
Yes, looks like ves's bot is online
you can figure out his bots prefix and unload the cog
how
@obsidian patio
can I ask what you're working on?
!ext unload help_channels but IDK his bot's prefix
okay. this will be caught by what I'm working on right now, so I'm not sure you need to fix it
What are you working on? For SeasonalBot
rebranding it to Sir Lancebot
Right, okay. Is there an issue for that, so I can mention that in mine?
not really, but I suppose I can make one?
And I assume you mean that you're looking to make it dynamic as well
That would probably be nice
not sure it matters?
seasonalbot is mentioned in a million places in the bot. I'd be changing all of those, changing the repo name, the deployment on kubernetes, everything.
and yeah sure, dynamic would be better design but it's not like we're going to be renaming it every six months.
at most, I'd make it a config variable
I'd be fine with a config variable like bot_name or something similar. That would make it quite dynamic
yeah. but I can't put that config variable into class names or comments
so it's still going to be hardcoded some places.
is all I'm saying
Of course
class attribute for the Bot class, maybe.
@tawdry vapor regarding your refactor, I won't make any changes other restructuring changes for now. Though it looks like the configuration I'm working with removes the cooldown role and times out a help channel much faster than the real bot.
We should try to call things Bot instead of SeasonalBot or SirLancebot as well when possible. If you're currently converting it, that would be a welcome change if it isn't too much trouble
that's already what I'm doing
What do you think about putting it in a config file and using that to set the class attribute name?
although I think I'll probably move the name into constants, because it turns out the bot instance isn't always available everywhere that I need it
I don't really love Bot but oh well
it's the best I got
I think it's quite good. It's the Bot and we give it the attributes later. It's almost like having a Human class and giving it attributes like name = "lemon"
@obsidian patio gave your PR a review
@tawdry vapor do you need your bot to be managing help channels rn?
alright, thanks
Can someone review this?
@crude gyro https://pythondiscord.com/pages/contributing/sir-lancebot/ doesn't exist though
yep, but it will soon
right now the whole site is down
because I renamed the seasonalbot repo. we're fixing that now :D
Was sitting on this code for a while but it's actually ready https://github.com/python-discord/bot/pull/1294
@cold island https://pythondiscord.com/pages/contributing/sir-lancebot/ now exists
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
tsk tsk, force merging eh? and I was about to approve too
Mark's approval counts for two
It appears that async-rediscache is our own project? should we add a values() method?
Looks like my fix for the !close command is working, except that when the bot starts, it thinks that two help channels are already claimed (by me and Zig, if it matters) even if no channels are in use.
feel free to open an issue on that repo, or a pull request.
and yeah, it's something me and ves cooked up.
where is the link for the redis that u guys use?
we use totally ordinary normal redis
oh,
what stel was talking about is https://pypi.org/project/async-rediscache/
thx
but this isn't a replacement for redis, just a utility for it
an async API for redis in Python, more or less.
Why use redis when u have a db,???
well, first of all, the bot does not have a db
@stable mountain does not?
nope. it just sends its requests to our API
oh
and the API has a database.
so if we want to store something, we'd have to write a new endpoint for the API
that's inconvenient, and storing transient data in postgres is a waste anyway
so it's usually better to use a simpler, document database for this kind of data
hm?
@patent pivot Can I Dockerize (Dockerfile, docker-compose.yml for development) forms-backend and add CI to it or you want to do this yourself?
what is CI?
oh i see
I plan linting for everything, build and deployment for main pushes. I will make config based on other deployment.yaml files. There isn't any tests currently, so no point to test.
No, this don't show me option to create branch.
should have write access now
Yes, thanks
@patent pivot What Python version forms-backend uses?
it does actually @cold moon
[tool.poetry.dependencies]
python = "^3.8"
first entry in the dependencies
I think we can safely bump that to 3.9
Oh, this is there! I never used Poetry before.
It's a nifty tool, I primarily use it because pipenv is pretty broken for me.
If you haven't figured out a nice way to run the app yet @cold moon, poetry run uvicorn --reload backend:app is the way to go
soon enough I'll add an entrypoint to the application so you can do poetry run start or whatnot
Okay
in the container we'll do some poetry things like ```
poetry config settings.virtualenvs.create false
poetry install --no-dev
uvicorn --workers 2 backend:app
I push Python to 3.9 then
๐
Should be --workers hard-coded to 2 or should be dynamic? @patent pivot
@cold moon hm, we'll go 2 for now, if we need to scale we'll probably scale at the kubernetes level
If we make RedisCache a subclass of typing.Mapping, that implicitly gives us type annotation support, yes?
might be a bit more to it given that we have named method rather than using the dunder methods
It doesn't implement the mapping protocol so it shouldn't be that, but should be able to make it a custom generic
Not sure how much that'd help though, the types are already fairly constrained so things like autocompletion are already provided by the current hinting, and specifying what the caches actually hold in a comment around them (user id: timestamp for example) gives you much more valuable information
@eternal owl About bot's User Events system PR, you should mark reviews as resolved after you resolve them. When there is a lot of reviews, this will make finding not addressed reviews easier. I resolved old ones myself now.
oh right, will do, thanks for letting me know ๐