#dev-contrib
1 messages · Page 136 of 1
Just write it to another file, dont display it ? would that work ?
Stop being big brain smh
Wait what does that mean?
I guess we want the dict format right
Or just a 1d list of all the anagrams put together?
dict format probably
was looking at some other resources, how they have worked with jsons
from what i understand of maxy's appraoch
I am so confused, for all I know you may be cooking drugs
It just means we then won't have a list of stuff to see if it's a valid anagram
I guess we just sort letters and get the values, nvm
What's the purpose of printing 5106 lines 😂
That'll be even better because only checking possible matching anagrams (same letters and same length) rather than every anagram in existance
I put the entire thing into a json easily
Wait shit that's the wrong one
Sec
this is the correct one @sour viper
There's just some words that are questionable as to whether they count
Like "aahed"
"aaby": [
"abay",
"baya",
"yaba"
],
"aa
wow
did u verify those words?
or just generated them
Neither
"aanst": [
"antas",
"nasat",
"santa",
"satan"
]
It's every word from https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt that's at least 3 chars @short snow
its working
ah okay i saw your script
i checked some random words, which i didnt think were words, they were words
So this will make the actual command part really easy now
but those words lol
Remember the keys aren't words, that's just the sorted letters
end product is gonna be like poor mans scrabble
yeah i know that
But yeah there is some questionable words
i was looking into teh values
I'll probably filter through it tbh
https://github.com/first20hours/google-10000-english maybe try this
just a small concern, other peoples resource files are around 36kb max then there's our file, around 2MB
That gives 1302 from 9868 words
28kb
Although that's including 2 letter words which I don't think we wanted
Here we go, 23kb
huh santa and satan not present
Because they're not top 1k words I guess
must've went on vacation
The file has 9474 words that are 3 letters or more
And santa and/or satan aren't a part of them
i see a potential problem not sure though, what if the word is anagram but not in the popular list ?
Then it wouldn't match
But it would fulfill the rules of anagram wouldnt it ?
Like sayjson "aemn": [ "name", "mean" ],another valid anagram would be "mane"
But it's not included
welp
Here's your reminder: look at it
[Jump back to when you created the reminder](#dev-contrib message)
I'm gonna filter through the massive file for a bit and see what comes of it
@sour viper if you fork the sir-lancebot repo, create a branch and add me to it I'll push the file when I'm done
Then I'll leave the rest of the issue to you
Sure i have it forked, im creating the branch right now
My GH is TizzySaurus / tizzysaurus@gmail.com fyi
Oh, no worries. The solution ended up to be StringIO
you must have the invitation to collaborate now
i won’t have time to work on anagrams anymore so i’m just gonna same day the current code i have
y’all feel free to adjust do whatever
yep, ty
My wifi just died but fyi I've filtered a fair amount
Thing is there's just so much
I've done >5k words but then there's a total of like >70k (so only ~7% in 2 hours)
So it's at this point I think we have to make a decision:
-
Use the smaller word list and accept that it's going to have missing anagrams
-
Use the bigger dataset without refining any further, and accept there may be some false-positives in terms of anagrams (means we may have "unwinnable" games)
-
Use the bigger dataset and keep refining, but instead of removing bad words, we keep things we know are right and remove everything else (will have missing anagrams, but less than option 1)
-
Use the bigger dataset and fully refine removing all bad (will probs take days to fully refine and don't think is worth it)
I personally would probably go for the third option but interested in your input @sour viper (and I guess @short snow & anyone else if you'd like)
Here's your reminder: do this if you haven't already
[Jump back to when you created the reminder](#dev-contrib message)
I am in need of a list of safe english words to use for other things, what we could do is create a quick & easy website that shows a word and a yes/no button give it to a bunch of people and it should be done fairly quick
Yeah I mean that's basically what I've got rn just locally so only me doing it
This word list would also have other uses tbf (like the hangman PR)
But then this is a list of anagrams, not a complete list of all safe words, so I suppose that's something to keep in mind
The full list of words is 369,646 words, whereas list of anagrams from those words is currently 72k ish (can't get exact number rn)
So to make a full list is 5x more work
It makes more sense to remove from the 370k list though and then just regenerate the anagrams since anagrams can be generated in <1sec
I was thinking a mix of option 1 and 2
We can have a list of missing anagrams, whenever someone enters the missing anagram we run through 2 checks same letters as scrambled and check if that word is present in original list of all words to see if it's valid?
Eh I don't think that's a good solution personally
We want to be minimising what we store, so not storing both
Especially when as you pointed out earlier it's like 4Mb
I think this is the best option in an ideal world but don't know how well it would really work
do as we do in minecraft@home
create 2 (or more) tasks for each word
give the tasks to different people
if the results match eachother accept it
else put the tasks back into the pool
Here's your reminder: fix this
[Jump back to when you created the reminder](#dev-contrib message)
Right, yeah. What do you mean by "tasks"? Just having at least two people verify it?
I guess, two different people
So it'll require two "votes" for accepting, and one for denying? @fervent sage
So basically you have a database (it can be sqlite, not important) of "tasks" which in this case will just be words, when a user visits the website an uncompleted task is selected and given to them, they send a result and the task is marked as validating, then that task is sent to another user to complete, and that also gets marked as validating. When both (3 may be more reliable actually) are marked as validating you check those results to see if all of them have the same completed result, if not you release the tasks back into the pool of tasks and they get sent out again. Repeat until that check returns true
That's what we do for validating mc@h results to make sure people dont just send in bullshit results
the db would look something like
CREATE TABLE Tasks (
word VARCHAR(255),
status INT, -- An enum for the status of the task, `uncomplete`, `validating`, `complete`
result BOOLEAN -- whether the word is good or not
);
Right, that makes sense
Hey @vale ibex , could you please review sir-lancebot#843 when you have a moment? I would greatly appreciate it. Thanks!
@cobalt sun tells me that there are python to js transpilers and I wonder if this is something we could use for our projects
In particular, it would give me a lot more ability to work on smarter resources.
I am new to hear about it as well, and I'll try to find out whether it's worth looking into seriously by tomorrow, unless anyone already has experience
Sounds like Joe and Alex aren't into it
Transcrypt is something we should avoid at all costs
it's just writing JS in python flavor, it's not Python stdlib at all
Well fuck
no stdlib packages, still got to use functions like addEventListener and so on, still got to use document
it actually makes it harder
not only do you need to write it in js format, but you have to forget certain things you'd normally do in python
i know this has been long and really annoying, but sir-lancebot#849 could use reviews
Does anyone know why the converters are classes and not simply functions
you can iterate over functions as well
What if…
geeksforgeeks command
That grabs an article from geeksforgeeks
I might make an issue for it on sir-lancebot once I’m done with one of my two current PRs
Sounds like a great idea, maybe we can combine other sites similar to geeksforgeeks for the command ? I guess there are a few more notable ones @trail pilot
A thing to consider is, does geeksforgeeks provide a rest API to interact with which is robust and convinient ?
there are concerns about the quality of some geeksforgeeks articles though
What
The python examples on geeks for geeks are embarrassing
What changes? We discussed what the MVP is in the staff meeting yesterday and I finished implementing it except for an issue with some redirects
That's not what mine looks like
🤷♂️ My branch is upto date, and i ran task start
I had that same problem when I checked the branch out a while ago (but I can't replicate right now because I'm getting warnings about the lockfile being out of date, and navigating to the page throws an error)
File "pydis_site\apps\resources\views\resources.py", line 11, in _parse_checkbox_options
return set(options.split(",")[:-1])
Exception Type: AttributeError at /resources/
Exception Value: 'NoneType' object has no attribute 'split'
Working around that bug, this doesn't seem to be a problem anymore
even i get lock file out of date
can anyone tell me how to setup snekbox inside my discord.py bot
Sure, you will need to run a local instance of snekbox. You can find some instructions there https://github.com/python-discord/snekbox#running-snekbox.
After that, you can add a cog to your bot calling the API. You can take inspiration or even copy our own implementation.
!source eval
Run Python code and get the results.
the thing is, i want to set it up inside heroku
Ah, I don't think that's possible. You should look at public evaluation API for that, I believe Piston is often suggested? Or something like that, I don't remember honestly
but will this work?
and will it use too much memory??
Snekbox is a totally different service, most probably incompatible with heroku
I love GeeksForGeeks but it looks like some are against it, so probably not worth making an issue for this one.
I agree that RP is much more specific but there are some very specific topics geeksforgeeks cover that doesn’t exist on RP
Any other article you'll find is usually better covered than geeks for geeks, sometimes it may be the only result
But at that point, a command isn't enough. You need to Google search with a bit more effort
Hm, what if realpython could be refactored to article, as a generic one, and G4G could be a fall back if RP doesnt exist
Yeah I wouldn't like a command for a learning resource we wouldn't show on our website
I really don't want to like to G4G, their "article" suck sooooo bad
They are badly formatted, outdated and sometimes even outright not working
Hm
I’ll look at some other resources on the website and see if there’s any alternative
Yeah g4g is sketchy
Is it possible to add a "practice" section to the resource page of the pydis website?
The resources section is being overhauled as part of site#582
Seems even worse to me
really? isn't w3schools like regularly updated and is maintained by a set group of people?
w3schools is pretty bad, lots of incorrect information and what not
tbh I'd prefer if we'd stay away from both g4g and w3, realpython will do.
Yea, I don't see a need to expand further than real python
Why the use of ] prefix?
#bot-commands message
It's a temporary bot and other common prefixes would collide
ah didn't notice the differnece
Don't get me wrong, I still sometimes use g4g and w3 for quick reference sometimes if they're in the first google results, but I wouldn't use it as a teaching aide
Lately though I just use the python docs more often than not
At what point do we have too many article grabbers? It would be interesting to have a generalized one, but at that point google is probably better and faster
(I did the realpython one, so I definitely see the potential to adding more, just raising the question)
Realpython is probably all we need imo
Hey! Could someone take a look at sir-lancebot#857 ? 🙂
sir-lancebot#849 could use your reviews
I'll check out both ¯_(ツ)_/¯
Why?
Discord py has the message intent already
no
the change discord's end is jsut making it privileged
that's different
no?
its really not lol
message content != messages
bot still can know that messages are being sent, but not see the contents
their support doc literally says When can I apply for the new intent?
Isn't that only for verified bots?
The way I read the announement is that you will be sent messages as normal via the gateway with the message intent, but if your bot doesn't have access to the privelidged intent, you just won't receive content, embeds, attachments, components in the message object
You still need to toggle on the privileged intents, it just bots in 100+ server need to apply for it to be enabled
possibly
just look in the ddevs server smh
its a new intent which has to be declared like any other
at the very top of that page:
So the bots in the repo are only used here right? Which is less than 100 servers and therefore unverified?
just like presence and guild member data.
eg. turn on in developer settings and declare intent when connecting
where have they clarified that content is becoming a new intent
enabling in settings does not necessarily mean that there is a new intent, it just means that message data comes through with messages
you are jumping to conclusions with pretty limited evidence, if there are links please send them, if there are messages in ddevs also feel free to link them, but as far as I can see this is just a toggle that attaches data already, you have it or you don't at the app level, not the session level
I could well be wrong, but as far as I've seen there is no evidence pointing towards your suggestions either
@vale ibex someone with your exact pfp, username, and ID has entered the chat where I asked 👀 is that u
yea
currently waiting for someone from discord to weigh in
rather than someone saying it's implied
Where is the code that implements the bot responding, when a user incorrectly enters python code? on the pybot github.....
!e Are you referring to this error? ```py
print(n)
@vale ibex :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'n' is not defined
or some other error?
when the above is incorrectly inputted
ahhh yea, that makes sense
thanks!
@brazen charm can the bot edit a user's previous post?
I'm curious if it's possible to "auto-correct" incorrectly pasted Python code
You could have the bot reply with what it thinks is correct
but then you have 2 messages with the code taking up a lot of screen space
discord itself prevents this?
if you delete the user's "incorrect" code, they then lost the ability to edit it
yes
it's quite a lot of effort to allow that, since if a user edit's another user's message, then you need to store the fact that the original author didn't type the new message, and have that visible in the client somewhere
otherwise a mod could change a user's message to say whatever they want, and possibly lead to the user being banned
I see...
and it's effort that Discord just hasn't deemed worth it so far
is the "python" tag used to paste python code, markdown?
both py and python can be used
I know but what supports them? is it markdown?
or part of the discord client itself..?
Yea, it's part of the client
Discord uses an internal fork of https://highlightjs.org/
interesting
Idea for lancebot because I'm on the bus and bored: a command to convert a sentence to pirate speech invoked with .arrgh
Hey I don't know why but why list methods are not in !d
letting people know about list methods is needed IMO.
the python docs do not expose them
you mean its coming from some api call of theirs?
The bot parses the html of the looked up symbol by going through the HTML tag's id, the base list methods don't have symbols associated with them so they don't have ids to look them up with
i can see list on html of their site.
oh
uhm
The list methods page people usually look at is a tutorial page, then the normal documentation would be https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
The source doesn't provide anchors for them, so the file we parse for symbols doesn't contain the methods and it's impossible to find them directly on the page without knowing their contents
oh so str works perfectly because they gave it out there!!
so I mean, if we can do a little bit of conditioning and parse that html for list, wouldn't it be worth?
reasoning: lists are the data structures which are anyways going to get used a lot. and !d helps in helping a lot. and it would not affect the speed since it just involves 1 static conditioning.
#dev-contrib message
Any tips or recommendations for this one?
Preview not rendering a created .md or .txt file
No, I don't think specialcasing this would be worth it. If the methods are necessary they can be looked up easily (or even explained with their simple behaviour)
wouldn't disagree with can be explained easily part, but seems worth to me.
should i make an issue or just ping Xith here? so that atleast we can see opinion on this. i kinda feel it may worth.
I am not sure if this is the best way, for many these do not render in the client (mobile users).
Right, I was just trying to implement it from Joe's suggestion
Yeah, neither options (Markdown file or embed) are perfect
I think the embed with a link to the section is ok for both mobile and desktop
But the original issue author reached out mentioning they wanted to add this additional feature
You can make an issue at any time (no need to ping Xith unless you explicitly want his opinion). Opening an issue is by no means an indication something is approved or will happen.
In terms of the idea itself... eh, I don't care much for it. There isn't a great place in that docs page to link to begin with. Like the main mention I'm seeing of it is under Mutable Sequence Types, and that's literally a single line among a list of other functions that will probably be more confusing than helpful to someone (espically if it's someone just starting out and needing to learn remove)
you mean this link?
https://docs.python.org/3/tutorial/datastructures.html
I was actually looking at this page lol
Still, not particularly convinced it's all that worthwhile
yeah that's where its currently referring to i think.
oh alright, thanks!
I'll leave this idea then.
(Are the tutorial pages actually included in the symbols?)
Thanks for suggesting the idea
Different opinions and creativity are what keep things alive
I just built it
I didn't pull the image, I built it locally
Since I needed to configure metricity to the test server
The metricity image?
yeah
are you able to exec into the metricity image and cat entry_point.sh
Because I'm on windows?
uhhh, not sure, I'm on windows and didn't have a similar issue
yyyeep
Ah
yes but it pulled the files from my local machine
oh I'm not sure where to look for for that, I'm new to /bot repo.
did look into ext/info/doc but couldn't find symbols
You can configure git to not add CRLF on it's own, but for whatever crazy reason that isn't the default, so it may not be the most viable
Ah, I'm guessing this isn't an issue for the image I built locally as I have autoclrf set in my global git conf
git config --global core.autocrlf input
The symbols are pulled dynamically from the website
!docs getdoc python
it could, if we had one
yeah ok, it doesn't go insane anymore
But from the docs command, it doesn't seem to pull them
wait that made me download this inv file
However it seems it failed to set up the database
i tried opening with vscode, didnt work lol
It's a compressed file
Sphinx inventory version 2
Project: Python
Version: 3.10
The remainder of this file is compressed using zlib.
I'll kill all the containers and try again
Resulted in
If you're still having issues in ~45 min I can debug over screenshare if you want
oh i see so python docs are created using this Sphinx thingy and that creates this compressed file where symbols(not sure what they are 100% tho) are, and you guys basically do crawling depending upon those symbols?
the inv file tells the bot what symbols (e.g. str etc.) are available and where they are, then it uses that information to scrape the doc pages and convert that to Markdown to show here
There are no symbols for the list methods in the tutorial page so the bot can't parse them as it would be impossible to find them. Then linking to it would be weird without an anchor too if it had something to accommodate them
Well considering we're trying to solve the problem so people don't need to run other things themselves 🤡
Basically, the thing Zig and Chris are working on is the fix for the issue, so manually running the sql is not an option
The plan is to have docker running it
oh i see, i really thought the process was straight forward when you mentioned html parsing.
my earlier assumption was that you guys were just fetching html from certain pages by some mapping and then with help of soup you'd filter content and then show.
I do partially understand this now.
did you pulled again though?
There probably is no way to know from context, I've just been following this for days lol
I'm not pulling anything, this is a local image
because if the child container hasn't been updated it will cause issues
oh
well
you are running the site, right?
The only thing I can think of is that metricity isn't speaking with the DB, which happened last time I set it up
but did you made a change to the compose to use a local image?
yes
Interesting
actually no, that shouldn't be the case, since I'm not starting it up separately
Yup, sorry that wasn't my intention 😅
.
work project
lol
it's a bot that integrates with slack
forgot I had it open tbh
just using vsc as a terminal rn lol
I never mute
I'm muting because I've got a terrible mic 🤡
Discord is having a day, and I can't watch the stream
Good luck you two
I'll be available in like 10 minutes
Ok I'm around
Don't have a mic 
Sec
Need to make sure I'm not streaming something I shouldn't
By the way
When I set up metricity
ok
could just build lol
time for me to go, cya 👋
bubye
Debugging nights with Chris and Zig, sounds like an event title to me
It is true
@vale ibex
# The guild ID that Metricity should be reporting about
guild_id = 476190141161930753
# This is the role ID of the role that should identify staff members, for Python Discord this is the helper ID
staff_role_id = 476190429960732672
# Channels that should be flagged as staff only by category ID
staff_categories = [
609529926366003201,
686646323985907808
]
# Don't report messages for the following categories
ignore_categories = [
609530625233387540
]
What I set ^
What is this code about?
We're working on setting up
I didn't follow from the start
Tl;Dr Docker being a whale needs to blow out water from it's nose-thingy
volumes:
- ./config.toml:/metricity/config.toml
join us
👀
for key, value in config.items():
if isinstance(value, dict):
if env_var := value.get("env"):
if env_value := environ.get(env_var):
config[key] = env_value
elif default := value.get("default") is not None:
config[key] = default
That's- what
yesyesyes
And you wrote most of it - I wrote the last two lines (the broken ones)
that's what we like to hear
tbf, works well
Lol
if env_value := environ.get(env_var):
if (key_type := value.get("type")) is not None:
if key_type == "int":
env_value = int(env_value)
config[key] = env_value
🤡
for key, value_type in dictionary["__annotations__"].items():
config[key] = value_type(config[key])
dictionary.update(config)
@patent pivot we need your opinion on a fix
_type = dictionary["__annotations__"][key]
if type(_type) is type:
config[key] = _type(config[key])
🤡
Wtf is this
Every day we stray further from God
lol
1 word
Go on 👀
# magic
_type = dictionary["__annotations__"][key]
if type(_type) is type:
config[key] = _type(config[key])
Thank you for your infinite wisdom good sir
does python refer to str int float etc as primitive types?
or does it use a different term
I don't think it uses that term anywhere around builtins
so i mean it's fine
but
I revised tihs config system in Olli to have type support with pydantic, so long term I could look at something like that
lul
the issue all came from wanting to run metricity via the bot compose
so we need to give it guild id etc
so env vars sounded good
but env vars are strings
🙃
imagine env vars
imagine a place
Tbh at that point giving the bot a toml file to override with in dev sounds ok
Putting it in an .env doesn't seem any better
Did you just push the dev config file? Lol
yup
No point in pushing the actual config-default, since this will never be used in prod
so might as well use our dev values lol
this is so webscale

Hmm. I'm not sure how I like it in the repo
i am also somewhat hmming it
yea, it doesn't feel right
I imagined we'd add it like config.yaml
the file needs to be present in order to mount a volume
But it doesn't need the file in prod
We use docker-compose to shove this file into the metricity container, since that's what needs it
docker-compose won't let you use a volume if the file doesn't exist
Right, but we don't want a volume in prod
Hmmmmmm
but yea, how do you see init scripts working joe?
we'd need to get the local config into the metricity container on bot somehow
And it only mounts a volume when you set use metricity to true?
it always mounts the volume
Hmmmm
there isn't a way to conditionally mount a volume as far as I could find
init script to pull the config from the repo, but thinking about it the values do need to get changed
yea, we need a way to overwrite with local values
maybe the pydantic approach with env vars is the best
yea, it's just a decent peice of work due to the number of env vars
so we'd need to write a bunch of validators
hmmm
actually, it's not so bad if we force the use of env vars
even in prod
rather than having config default and env vars
what other service did i write that does this
oh king arthur
hold on
this also works
if we force env vars, which I'm not opposed to
You lose the yaml structure though
lists in env vars are yikes too
grafana solve this by using _ as a .
csv isn't too bad tbh
would assume so, haven't tested though
METRICITY_BOT_TOKEN=X.Y.Z
METRICITY_PYTHON_LOG_LEVEL=INFO
METRICITY_DATABASE_URI=postgres://foo:bar@baz/qux
I will have to double check whether pydantic allows that
it certainly has sub-models in the config examples at https://pydantic-docs.helpmanual.io/usage/settings/
Data validation and settings management using python 3.6 type hinting
but doesn't show the env vars
ah
yeah it does
hm
export my_prefix_more_settings='{"foo": "x", "apple": 1}'
thta's not friendly
yeaa
there is parse_obj
which we could pass in the output of the current get_config()
which merges the toml files
so we could use a combination of toml and env vars
hmm, still not the best if you need to overwrite a value of a sub model via env var
hmmm
we could flatten the config into 1 class
and prefix certain things that need it
I'd prefer that to json encoded env vars
you don't need that lol
ah
nvm
Do you get the contrib role after making at least 1 contribution to one of the open-source projects or is there a set number of contributions that you have to reach to get it?
A guide to contributing to our open source projects.
Thx
Hey all, sir-lancebot#867 is ready for review!
@clever wraith https://pythondiscord.notion.site/Squashing-a-Pull-Request-191e8efa2fbb4d72840fd17ca37cf7fa

hmmmmm
I have some other things on 867 to review
i rebased
we can squash at PR level, which for a PR implementing a single feature isn't a bad bet
oh i already squashed :P
yea all good - just saying that's an option for those that don't want to get into deep git for really small PRs
kay
ah, i thought you had that turned off
which the guide above literally says 😛
Since squashing a Pull Request is an exceptional operation, we don't allow squash merge, you will have to do it from the command line, let's jump right into it!
probably written at a time where that was policy, for small PRs like this that modify a file or two I'm fine with it, I'll make a note to update our docs at some point
don't have notion on this machine
yet
uh
not to my knowledge
let me actually see where this page is hosted in terms of on notion
i'm not sure whether we set aside an area on notion for this
For what
hmmmm so
this document is part of a 3 page collection we have under our dev domain
code review guide, squashing and then I think an internal poetry vs pipenv page
code review guide got migrated to site, so I guess at some point the plan may be to convert this to a guide, it's not a part of anything else I think we just drafted it on notion to get things together quickly
I wrote that as an internal reference, but it will probably need some polish before becoming an article
Hey @cold island @vale ibex, so what was the issue?
Some file conflict that made the git pull not work well
But we're now trying to understand how to allow development with metricity on a different server. Since that's the whole point of the changes
The issue being that you need to change metricity's config from the bot
toml files
with a default & override
with some values being pulled from env vars
I think the consensus atm is to migrate metricity to pydantic
We still need to discuss it a little more, since we need to figure out a nice way to deal with it
see my conversation with joe last night
yea, scroll up like 2 pages
Why don't we bind mount a config file into the container?
Hmmm
What about mounting the current folder, since it will always exist? Then we will be able to look whenever there is a config file on that folder
Mount the bot folder in the metricity container?
Yeah
We could have the entry point try to move the config to the right place
So it is transparent for the app
Not sure how to do that. Maybe Chris knows
We could have compose mount . to /tmp/bot and add cp -f /tmp/bot/metricity-config.toml ./config.toml to the entry point
Well, at least that's the rough idea
cc @vale ibex
Eh the whole idea feels like a lot just to set one variable
I like the idea of pydantic (totally unbiased), so if we’re considering doing that anyways
Might as well save the extra effort
We’re in no rush either, things work as is, the only reason we need this is for people that want to run metricity
So basically only people who are working on very limited features
I'm not a pydantic pro, how will that help with configuration?
Well basically we already have it working cleanly with env vars
What Chris and I were working on was just getting that env var to the right data type since meta classes do not type casting at all
Pydantic on the other hand
Does
Unrelated, but it would actually be great if we could just drop the toml configuration. I dislike it in all projects we use it in.
For most of our projects it’s literally just forcing us to define the same content in two different spots. The only project it sort of makes sense for is bot, because it makes it easier for people to clone and change the variables they need
But even bot can just be completely circumvented if we have smart config
Which is, ya know, one day™️
I mean, we could roll smartconfig to more projects than the two bots
What other projects need it?
Isn’t smartconfig creating a server and setting the IDs?
I mean, any project that uses a large config file can benefit from it
The core of smartconfig is about having a modular config system
Then there will be an extra to add a discord integration
I don’t follow, what would a modular config look like
Don't mind me, I'll copy paste my message from the staff channel so it is publicly available
So, smartconfig. You might have heard that name here and there, the goal of this library is to make our whole configuration system easier to use.
Right now, we rely on this huge default-config.yml file, which has more than 500 lines or so. Additionally, all of those constants are repeated in a constants.py file for typehinting sakes. This is far from ideal, and we can do better.
Smartconfig will allow us, instead of having centralized constants, to move them to their parent cog if you will. Additionally, smartconfig will automatically parse your configuration file and allow you to override constants using the module path.
I know this is quite confusing at first, so here is an example: everyone's favorite cog, DuckPond ! It has a related constant, ducky_thresold
# file: bot/exts/fun/duck_pond
class Config(smartconfig.ConfigEntry):
ducky_thresold = 7
```and `Config.ducky_thresold` can be used like normal. But here is the cool part! Imagine I have a config file:
```yaml
# file: config.yaml
bot.exts:
fun:
duck_pond:
ducky_thresold: 1
```then the constant will be overridden.
The advantage of this are:
- It is clear what constants belongs to where
- You don't have a massive and daunting config file
- You only override what you need to override
- Pulling changes isn't a mess
And more importantly, we now have easy to parse configuration classes, which will allow us to create a test server and fill up the configuration file. All of that automagically with a single command! At least that's the plan 
There, so everyone can follow
So like here you have a small configuration entry for the duck pond cog
You could imagine having different entries (you could also call them units or modules) for the different parts of your app
Or even just have a single constants file, but you can override it out of the box
Anything is possible, really
I don’t think that’ll be too helpful for the other projects that use toml configs, but it seems cool for bot
Hmm how do the config classes help with creating a test server
It is a lot easier to attach metadata saying "this should be that emoji" for instance
It isn't required per se, but it will be much easier to do both at the same time
Yea we could mount the whole bot folder, it just felt wrong lol
Honestly for dev purposes it seems the simplest and most flexible solution
we also lose the ability to rename the file, IE we can't do ```yml
volumes:
- ./metricity-config.toml:/metricity/config.toml
so it would need to be named config.toml or config-default.toml
wdym?
^
If you have cp then I guess you can check if the file exists?
I guess we could wrap it in ```bash
if [ -e /tmp/bot/metricity-config.toml]
then cp -f /tmp/bot/metricity-config.toml ./config.toml
fi
lol ye
it seems less effort than migrating metricity to pydantic lol
haha
If the force flag is set it won't error out if the file doesn't exist
Don't ask me why
lol how odd
I used the if statement anyway so that I could echo something conditionally
ok that should be it @cold island
I've force pushed some changes, so I'm not sure if a git pull will be fine, or if you need to git reset
someone with more experience of git can answer that 😄
git pull --force should do the trick
nice
👍
Hey! Can I get a review on sir-lancebot#857 and maybe on api#16 ? 🙂
Hey @patent pivot https://jb3.dev seems to be offline
hmmm working for me?
what do you see
also this is for pydis projects lol, better pinging in off topic
Oop
sir-lancebot#867 needs reviews! Should be quick, it's a 7 line file 😄
Yeah
@cold island
Hmm our site uses django-simple-bulma, which says bulma-collapsible is available, but I can't seem to get it to work
For reference I tried copying this snippet into one of the pages https://bulma-collapsible.netlify.app/usage/#collapsible-card
Ahh, I think it's just not enabled
And with the extension it doesn't un-collpase
@crude gyro if you're available maybe it's something you're familiar with? I did see an open issue in the repo related to collapsible
@cold island make sure the extension is actually turned on in settings.py
there's a config dict where extensions must be added for them to be available.
Yeah, without the extension the card doesn't collapse, with the extension it doesn't un-collapse
It would be a dict move to not add it
Unable to convert 'this' to valid command, tag, or Cog.
!source [source_item]
Can also use: src
Display information and a GitHub link to the source code of a command, tag, or cog.
Hello github issues page
Include me in the screenshot
I don't think that's a good idea, if it's not a valid Cog or tag, the bot should give some feedback about it.
I see, but it's not a valid Cog or tag, regardless. 🙂
Hey @vocal wolf, could you please review sir-lancebot#843 when you have a moment? I will greatly appreciate it. Thanks so much!
Ok, what do you suggest instead?
json?
Can you link pls?
@vocal wolf could you please re-review sir-lancebot#849
@austere hornet @clever wraith I shall.
Thank you!
any recommendations for sir-lancebot#859? I tried the file preview thing with the .md and .txt file creation but that didn't work. Anything left to do for it?
Love the reasoning in your PR description @dim pelican lol
Lol, I took over the previous PR with this one
And copied their reasoning too
Lmao
btw this is a thing now
You know I cannot PR at that time of the day haha
true, true
But with some in-line html you can do some cool stuff
yea
isn't the logo enough?
!remind 10h get those swag points
Your reminder will arrive on <t:1631689679:F>!
I feel like having a banner would look cool
we could remove a bit of the blurb and add some action items
visit webpage, join discord, read contribution guides, etc
Huh, it isn't python-discord/python-discord
Ya ya
Buttons would be nice too
Lmfao @patent pivot github just published the changeling for the org readme
How fast did you added one
Oh really, was it not yet released back then
Aaaaah
Aaahhh, I have some "unpushed" comments for this one I think.
One sec
Ok
Tl;Dr it's all about capitalization today
Ah
Okay that should be submitted
lol
lol github revealed some things in that screenshot they probably weren't supposed to
Here's your reminder: get those swag points
[Jump back to when you created the reminder](#dev-contrib message)
Yeah? It's a big company
damn 1.8k teams
Hey @gritty wind was the idea of https://github.com/python-discord/sir-lancebot/pull/578/files#diff-2272f4f1bd8af0ac66cdd3a1c7e0428d97be9bc4d41fa5065a36d7251452be48R281 to bypass all checks entirely?
IE including the global check
Yeah?
I see this passes it through to the whitelist_check, which removes all the kwargs for when it hit in_whitelist_check
but since channels, categories and roles are all empty, that means that it'll always be denied right?
since the global check still applies
I don’t remember much of the code rn, I could look at it in a bit
It’s entirely possible I missed testing it
alr, just mentioning it since I was reviewing sir-lancebot#856
and saw that it's already pretty much implemented
Lol I was wondering why that issue was taking so long
!remind 6h 
Your reminder will arrive on <t:1631720996:F>!
Right, so now I remember. The idea was to allow you to block it even in the globally allowed channels
Not the other way around
Wording should be fixed
Well, maybe, but I think it would allow you to add a channel that isn’t in the whitelist, and only that channel
Same for roles
ah yea, it resets first, then iters
So I can enable this channel, but disable OT
Could also update it to have both behaviors
since I'm going to suggest we call the kwarg in sir-lancebot#856 bypass_all_checks rather than every
same 😄
how would that work?
fwiw bypass_defaults isn't used anywhere rn 😦
Actually yeah never mind I’m misunderstanding the intention here
Yeah, this was created as mainly a util I aim to port to bot-core at some point
So it has some redundancies
Is this being implemented on the wrapper or the actual check function
It should probably be implemented on the wrapper to avoid unnecessary overhead
ah yea seems like it's in the check
It doesn’t seem to be?
Actually I know what’s happening
Confusing wording again lol
Wrapper I'm referring to is whitelist_check
check is in_whitelist_check
I was referring to the wrapper whitelist_override
We could probably add it there too using a lambda or something
I think we implement it the same as bypass_defaults is
Yeah that's probably the most reasonable
have it a a kwarg on whitelist_override and then getattr in whitelist_check
This could actually be easier solved by using the everyone role, no?
No actual changes to the wrapper or anything lol
It also means we don't get DM invocs
@green oriole I've noticed that my bot is getting gateway events for messages even if the bot isn't in a thread
So doing that thread join for every new thread isn't needed
but could be useful to just have the bot in the member list
not sure how many api requests it'll end up being joining every single thread automatically
Huh, that's interesting
I use that on Python to keep track of what new thread we logged or not
In term of rate limits it is impossible we reach it unless we get raided
Yea, I don't think it's an issue, just pointing it out
That's good to know, yeah
Reviews on bot#1793? 
Also, does someone know of an easy way to create collapsible elements on the site without bulma?
sir-lancebot#843 needs reviews as well. At this point it would be best for contrib/core dev reviews since there weren't any yet. Thanks again to @clever wraith, @dry folio, @brisk brook, @dim pelican, and @vale ibex for your reviews!! They were really helpful to me and Fronto :)
Also sir-lancebot#860
@trail pilot would you like nitpicky comments as well?
Like # there are --> # There are (capital)
Just keeps your code consistent with the style of the bot
no problemo
Aight, I'll take a look soon™️
Just submitted 👍
Hey there everyone, does anyone have a gitpod account? I'd like someone to test the .gitpod.yml
If so, please test it at https://gitpod.io/#/github.com/kronifer/sir-lancebot/tree/gitpod
Are you the tooboredtocode person
No, TizzySaurus
Ah, it’s on Hangman?
Challenges
I may have fked up
Do you see it in #dev-log? @trail pilot
Try clicking on the link to it
Where? Because when I looked around lancebot there's basically none
Our style guidelines and PEP8
Trailing commas are a good practice to make sure the git blame is accurate
But basically nowhere uses them currently
Other than when it's making a datatype into a tuple e.g. aliases=("x",)
So? I don't think that's justification for not following good practice
I thought we had a thing of consistency was more important
I am honestly thinking about suggesting to remove that rule because of consistency
consistency is important, but commas aren't going to make things confusing on which to choose and there is an actual non style benefit to it
Wdym?
If it's an area where it might make sense in the future to expand on it, then I think trailing commas are a good practice. Sir-Lancebot is also a learning repo so I'm hesitant about opting for consistency over good practice to make it more "consistent" because that very well could mean making things consistent with bad practice
I'm not strongly against trailing commas myself, just thought we had a thing of not doing them
Maybe we do? But you'd have to point me to that discussion
just thought we had a thing of not doing them
By this I just mean "I've seen people say to remove them"
I think its not using trailing commas in a function definition right? Since they are usually not going to add additional arguments
e.g. here (this is just the first one I found)
Well, that makes sense because it's not correct usage of a trailing comma, if you're referring to the decorator
Well then what defines as "correct usage"?
Having a trailing comma on a single line does nothing to help with git blame. The trailing comma is used when you split it up on multiple lines, because adding an element will only assign you the blame for the single line you changed, not the line previous as well (when you have to add a comma)
So do you always add a trailing comma when it's over multiple lines, or would you leave it out p.e. in a function defintion since you're unlikely to get extra added arguments (what brad asked above)
When trailing commas are redundant, they are often helpful when a version control system is used, when a list of values, arguments or imported items is expected to be extended over time.
Now I'm questioning myself, what if there is a lot of args and split across newlines?
is expected to be extended over time.
So if it's not expected to be extended (like a function definition), it shouldn't have a trailing comma
For instance, let me pull an example from our AoC cog
Oh, confidence returned lol
There's nothing to lose if the comma is included, and even if you don't expect it at the time of writing, functions are commonly extended
I think in the case of this PR it makes sense for the list of valid languages, since that will change as codewars add more languages
But it doesn't make sense in the function definition because that won't change
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/events/advent_of_code/_cog.py#L167
This has a trailing comma because it's not unlikely that we'll add more information
The function definition is a single line, no?
bot/exts/events/advent_of_code/_cog.py lines 167 to 172
info_str = [
"To join our leaderboard, follow these steps:",
"• Log in on https://adventofcode.com",
"• Head over to https://adventofcode.com/leaderboard/private",
f"• Use this code `{join_code}` to join the Python Discord leaderboard!",
]```
One of the __init__ is multiple lines
aaaah, okay
And yeah, that makes sense. Just like the example I gave above of the languages that codewars supports
But I'm also with Numerlor in that it doesn't hurt much. So if it's there I'd leave it. If it's not *shrug*
I think if we're going to have a "rule" we should stick to it
If it's likely to be changed (or is being used to make a tuple), including a trailing comma, otherwise don't
Now, where the bike shedding enters: how do we determine likely?
Add black to the ci and try to survive?
Just a scenario where you can see it changing, like the supported languages etc.
But I don't have a horse in this race, I just like trailing commas and will generally advocate for them where they make sense~
will generally advocate for them where they make sense
Do you think it makes sense here?py def __init__( self, language_embed: Embed, tags_embed: Embed, other_info_embed: Embed, main_embed: Embed, ): ...
I'm assuming that wouldn't classify as a "logical" place to have it
bot#1773 is kinda this but went stale 🤷
you keep mypy out of lancebot
lol
But I don't have a horse in this race
lol
I haven't used mypy very much, is it a general formatter?
ooooh... hurmmm...
Okay, this is for the Information Dropdown, which I can imagine being changed if we want to add other embeds / more info in the future
static type checker
So @trail pilot I think my conclusion on this is that keep the trailing commas where you think it's likely to change in the future (e.g. the lists of supported languages) but remove elsewhere (such as the SelectOption calls)
give me true dynamic typing or give me death (not really, I just think mypy would be worse for 1st time contribs and lance is aimed for 1st time contribs it's not appropraite)
It may not be logical for the blame/diff reason, but like I said previously there's no downside to including it in there. I wouldn't introduce a commit to add the comma but I also definitely wouldn't introduce a commit to reverse it
I mean I don't think of it as adding a commit to reverse because I'd just squash it but yeah, I do agree
In that specific case of __init__, I can imagine that changing in the future since it's adding new/more embeds to the dropdown
I mean yeah, I guess I can see that potentially happening
SelectOption(
label="Main Information",
description="See the kata's difficulty, description, etc.",
emoji='🌎',
),```you wouldn't add a field to these though(?)
Yeah, doesn't look like it
Hey @brisk brook, I'll add the log.error after school. GitHub mobile is having a bad time at the moment so I'm responding here
@remote wigeon
Bad static type checker
yeah thats me
Pyright is better imo
Hmmm. What are the choices for type checkers? I guess I should do my own research but curious what the people think in this channel
Pyre, Pyright and Mypy
You can also use Cython, but that requires cythonizing your code
@thorny obsidian do we have plans to revert code jam on frontpage?
No because it totally slipped my mind. Will make a PR for it today
👍
What about pydantic
That's not a static type checker
It enforces types at runtime
Not statically, that's the difference 😉
Ah
Wait now that discord has released replies and threads, would it be a good idea to change spooknamerate game to use threads?
sir-lancebot#509
Now I realise that it is in serious need of updating
Here's your reminder: :partygopher:
[Jump back to when you created the reminder](#dev-contrib message)
I'd be down to see what that can look like with threads! (but also open an issue and get coredev approval >_>)
alr
Here to learn forms
So! Forms! I'd like to use forms for our upcoming esoteric challenges (cc: @placid ermine) and also get the full functionality for future code jams.
i will watch your progress with great interest
@gritty wind is our fearless leader for forms, but joe and Akarys also help out a bunch. I think we may have conned Blue into helping as well.
Interesting. I must say that I would be starting at 0% for TypeScript as well as Web Apps in general
I will also be starting at 0% as well, but I do plan on contributing to forms :D
But I believe we have a few issues to conquer regarding forms which should be ... fun? definitely intersting
Sounds a lot like my manager saying "We have a great opportunity for you"
Hey hey brad - you may be currently unable to contribute because the issue board and setup guides aren’t public yet (it’s on my agenda I swear), but in the mean time, it’s probably best to get familiarized with TS and react from a basics perspective
I do agree with that statement lol
The contributing guide may be public, my memory is not 100%
But looking to future contribution stuff, forms is going to be a top priority for me in the coming months
Sounds pretty neat, looks like I have a good bit of projects to learn with! Besides sir-lancebot I'm trying to help out the catcord peeps, and now forms
let me know if there's anything I can help with regarding that~ Code Jam is wrapped up so I've got some time before I refocus
!remind 23H Forms stuff ^
Your reminder will arrive on <t:1631804537:F>!
Now that you're talking about projects, may I ask what's the situation of the API migration? 🙂
I think that’s been a little slow because Ves was busy with real life (that makes two of us!)
But I’m not too sure
I honestly don't know. Uhhhh @last patio and @hardy gorge would know iirc
if you need help with frontend dev i can help as well
I’ll be making the entire repo public eventually, probably will put out a call to action then
Err, the repo is actually public, issues are not
(I think I'll be helping Scale do some of the converting)
I've unassigned myself from the one ticket on API I was assigned to, but if no one else has taken it in the mean time, I'm going to work on it again this weekend
The Alembic setup needs the models to be set up I believe. I've opened an issue regarding that matter. However, it hasn't been approved.
We can probably configure it with only the declarative base of SQLAlchemy, although that is not very useful in itself
I'll see if I can run the codegen for the models this weekend
Although I guess anyone with the Django site setup could do it
Also, would it be a good idea to migrate the pagination to use the new buttons feature instead of reactions?
You mean with SQLAcodegen, as suggested? I believe it has to be reviewed throughly though.
(Also I think I might be able to do it if it gets approved, just in case)
It will probably generate some bare Table definitions instead of Models as well
I'll approve the issue; I think it's an approach worth trying
? Isn't tomorrow Thursday ?
Yes, unless you are 12 hours ahead and it is already Thursday
Or their weekend is Thursday lol
I would joke that this isn't true and earth is flat and time is same everywhere, but people may actually take it seriously
Thank you, will you also assign me? 🙂
Weekends here start on Friday 😃
Yeah, this is in the discord docs lmao
The repos have always been public, we're working to migrate the guides & issues to the repos
Lmfao
we're working on making it open for contributions from non-staff
Because it was an internal project and we didn't see a need to at the start when it was first getting off the ground.
Why do you like dynamic typing?
sorry, I reread your message and understand the point
If we don't want beginners to care about the type hinting, why do the linting rules require type hints on all public functions? Beginners will (and do) use the wrong type hints, which will hurt readability, not assist. So maybe we drop this requirement from lancebot?
True, I'd be fine with not type hinting all public functions. But that's going to be a core dev and admin decision.



