#dev-contrib
1 messages · Page 58 of 1
suppose its good for bigger PR's then
@subtle kraken I will look into it (and into all other my pending PRs) when my PrestaShop PR is done.
sounds good to me
it's tempting to press that big juicy update branch button
but ideally we should just do it right before we're gonna merge
so a good rule of thumb is to not bother until you already got approvals.
I only have been updating just before merging so far
then why would there be two in a row?
To which PR are you referring ?
ask @tawdry vapor
2 in a row because the first merges master into feature, and the second merges feature into master
If the branch is out of date you cannot merge the PR without first updating the branch, unless you use admin overrides.
I'm saying to just use admin override most of the time
Worst that will happen is a test or lint will fail and it won't get deployed, which may take an extra commit to fix but you would have needed to do that commit anyway. Difference is you now have to do it after merging the PR rather than before.
So if you're willing to take on that responsibility instead of the PR author then force the merge 👿
can merge & run tests locally
but I always thought the double merge was something that was agreed we'd do
because it's safer
yeah I don't really like your suggestion, @tawdry vapor. there's a risk the CI will fail on the merge then, and that's messier to clean up.
Messier in what sense?
you'd need to push your fix to master or open another PR
How is a push to master messy?
and master would be in an unstable state.
until it was fixed.
an unstable master is just bad.
Point is it shouldn't happen anyway for these small PRs where only 1 string is changed
probably not. but I think it's nice merge an updated branch as a rule of thumb, and honestly the commit history is not something I ever worry about.
commits are for blame and search, not for browsing
and a merge commit doesnt show up in blame annotations
so it never really enters my world.
I sometimes search by browsing the log
It's not a big deal
Just a suggestion that you can use your discretion to do it. if you don't want to that's fine.
yeah. I sometimes would for a oneliner.
Why is Dependabot unable to open PRs for JS dependencies on the site
It just shits itself
Oh
It's cause we don't even have a package-lock.json
What the fuck?
What is it analysing then?
When you don't want "merge master into" commit then use rebase + force push.
I don't think we should be advocating for rebasing and force pushing as a rule of thumb
Would adding the pr # to commits be something conventional? Think I've seen it from someone here and realised it would've been handy the few times I was looking through the history
I don't mind either way
May be usefully locally, but GH already shows relevant PRs when looking at commits
Didn't notice that when looking through specific commits in the history, is that new or did I just miss it?
how did yall create a timed mute system on the python bot
Through a custom scheduler https://github.com/python-discord/bot/blob/master/bot/utils/scheduling.py
Combined with storing infractions in a database for persistence. They are re-scheduled when the bot restarts.
I have one question about modmail I mean when someone message modmail it creates threat I wnt to know when it will close threat
Like if any mod message user will user get the message through modmail
Can user can know who is messaging?
#python-discussion I suppose
ok thnx
@green mesa modmail isn't a pydis project, and I have no idea what you're asking anyway
@green mesa We've configured it that threads are closed by moderators on our end. I think ModMail has an option to allow the other party to close the threads too, but we're not using it. (As @crude gyro mentioned, it's not one of our projects; we're just using it.)
As for the identity of the mod who replied, we typically use a reply command that includes username of the author in the reply. It means that people should typically be able to see which mod replied to them. There's also an anonymous reply option that does not reveal the identity of the mod but rather says something like "Python Discord Moderators". This means the answer is "it depends", I guess, as it depends on which option we use to reply.
Ok ty ves for this answer I am looking for
mypy does have a way to be used programmatically https://mypy.readthedocs.io/en/stable/extending_mypy.html
Yeah, but is that completely safe?
We could do the same thing as for the regex command, format some code and send it to snekbox
I'll take a look around first
Good luck!
Thanks 😄
@brazen charm If I address your requests in https://github.com/python-discord/bot/pull/957 would you mind looking it over again soon for approval?
not at all, should have the time
excellent
@patent pivot how much of a non issue was the memory usage? Poking around I found out that just importing intersphinx eats up 10-20MB of memory and then fetching inventories seems to keep some unecessary references alive. If we copied the code and made it more suitable for the bot's use case we could at least drop that usage while getting rid of the big dependency and adjusting it for async instead of running in executors
Also more on the side of getting rid of sphinx when only 5 definitions from of the whole package are used through the inventory fetching
I've pushed those changes btw
Sorry about not addressing reviews, but I got extra requirements for paid PrestaShop module development and I have to finish this first.
No problem since it's mostly low priority
This just got bumped up since I need to add support for multiple code jam categories
And the jam is coming up
@tawdry vapor Why have you decided against the tests in the code block detection PR? Just wondering if it had something to do with parsing as I'm not quite sure how to tackle it for the doc html parsing
Because I don't feel I have an adequate understanding of software testing to write tests
Not really related to what was being tested
For testing HTML parsing you can have sample HTML documents and pass them to the parser, then assert the results
You've made some tests PRs to the bot before, what changed your mind about your abilities? I consider myself not very experienced with testing and sometimes it feels like I'm doing things the wrong way so would be nice to have some insight. Here it'd be useful because of all the checks I do after introducing a change and still miss things. The code is atomic enough to be tested with normal asserts at points but I feel like exact asserts, or without looking for some structure, on the end result would be too restrictive on changes to the code
I cannot reconcile the conundrum of precise tests vs. decoupled tests
just thought id throw this out there, i implemented the ability for my bot to print its own source and ive found it crazy useful on my server
I think we had that idea but it would easily flood the chat
Especially if some command takes many lines
ya it could prob be abused, tho the ability to specify lines is nice
i have just found personally i use it non stop when developing and helping others contribute
cuz they can show me what theyve written in the test server with just a command
source command of @stable mountain takes command/cog as input so you dont need to know files nor lines
ya mine defaults to the whole file if you dont give it lines
itll chunk it and send it all in the channel, which yes gets wordy lol
its more used for testing and contributing then as a real server command
idk ive found it useful, thought id suggest it
You could use := in that method
if (event := getattr(value, __event_listener__)):
messenger.subscribe(event, value)
And I have a suspicion you might be reinventing or overengineering something...
wrong channel, sorry
@celest charm I’m still on 3.7 or i would 😃
oh
Ya Big F ik lol
@shut aspen Sorry, my keyboard screwed up somehow, 3.7 is understandable
Anyway, you could use getattr(obj, name, None) to make it fall back to None
I would update but that requires the entire community to update and that’s a pain lol
true
And ahh ok, that’s the default overload i assume
anyway, this is off-topic here
I'm creating a second subclass now for doc parsing to change behaviour of the used modules, do you think it'd be worth it to place them in a separate module so only the relevant parsing parts are in the module that does parsing?
Taking around a 100 lines now because some of the code had to be copied over
Don't know what the code is exactly but separating them sounds good.
Any ideas on a good name for it? The subclasses are only marginally related, one is the MarkdownConverter subclass which is in the master code (+ some methods) and second is from one of bs4's objects to allow some extra behaviour
So one is for MD and one for HTML?
Yeah could look at it like that https://paste.fuelrats.com/bagevuvayo.py
So you could name one markdown and the other html
Is it feasible to make the Bot instance a global? Getting tired of having to pass it around or create classes to store it.
I'm imagining it to be pretty simple: create the instance in another module, then import that in __main__. That'll avoid circular imports.
seasonalbot instantiates it in the module where it's defined
then the instance is imported into __main__
I think it's probably a feasible approach
My concern is that it's not explicit, so it may be a gotcha if someone tries to use code that relies on the bot. It's a gotcha since obviously the bot has to be running in like 95% of the cases it'll be used for.
So there'll be static method or functions in modules that are ostensibly fine to call before the bot is running, but they aren't.
But the convenience of it being global outweighs that risk, I think.
the only time where I wanted to import the instance somewhere where I didn't have it already (so neither main nor within a cog instance) was when I was doing something that I probably shouldn't have been doing, it felt dirty and you talked me out of it iirc
and yeah you're right
hmm, what are you working on by the way?
Syncers 3.0
Rewriting it again cause I found the previous design too hard to work with
@tawdry vapor what you describe is why i originally had the seasonalbot instance bot within constants.py before we had a dedicated bot.py. Now that it's in it's own module, it can be imported from there instead, which should be fine enough of a setup in place of a global.
Wouldn't take much to set a similar setup in Python bot.
There's a couple of other methods that are slightly over-engineered for now that I've considered using in my own bots too, and was actively working on when I was more active on my own projects that allow for globally accessed commonly needed contextual variables via a proxy object.
No matter the setup though, I'm not a fan of plain globals
The IDE doesn't detect what it is without additional tweaking and typehints.
It's also not intuitive to new contributors
yeah I also think it's a bit implicit. but having the bot be some sort of singleton that you can import really easily seems alright. kind of like how flask does from flask import g
ye, that's pretty much what it would be
could make it top-level even
from bot import bot seems nicer than
from bot.bot import bot lol
so much bot
yeah, from bot import bot seems alright to me
it may require a proxy of sorts to do it, but i'm sure it'll be fine
mostly to avoid cyclic imports
I'd appreciate a review on this if anyone has time this weekend https://github.com/python-discord/bot/pull/835
If you're keen I also have 2 more PRs you can take a look at
I'm working on it. There are some interesting things in this PR
Speaking of reviews, the pr for truncating internal eval should be ready now
Yeah, we're getting a bit behind on reviews. But I suppose none are high priority
Anyway, thanks for having a look
I was skipping the more async heavy ones when reviewing before since I don't understand python async that well, but can look into it more later if it's needed
Do I have to use pipenv for the bot? I haven't used pipenv before and it's acting in a weird way for me. Would something like venv work as well?
you shouldn't really be directly using pipenv unless you're working on something for site as well that the bot depends on
have you seen the setup guide?
Yeah. I'm going through it right now
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.
It asks me to run the following two commands:
pipenv sync --dev
pipenv run precommit
ahh alright, what troubles is pipenv giving you?
RuntimeError: location not created nor specified is probably the main part of it. The traceback starts with the following though:
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
you can ignore that
I cloned the repo to an external SSD, which may have soemthing to do with it
what's the rest of it?
Failed to load paths: /bin/sh: /Users/X/.local/share/virtualenvs/bot-6jSLwY9f/bin/python: No such file or directory
Output:
Failed to load paths: /bin/sh: /Users/X/.local/share/virtualenvs/bot-6jSLwY9f/bin/python: No such file or directory
Output:
Failed to load paths: /bin/sh: /Users/X/.local/share/virtualenvs/bot-6jSLwY9f/bin/python: No such file or directory
And a really long traceback that ends with the RuntimeError I showed you earlier
right
i usually get that when using docker, but it works anyways
i guess you could try
pip install -U "pipenv==2018.11.26"
this probably isn't the issue, but can you comfirm that this does exist?
/Users/X/.local/share/virtualenvs/bot-6jSLwY9f/bin/python
I tried to run that pip install. It seems like it's not giving me any errors, yet
alright
I think it worked. Should I run pipenv shell to activate it, as it tells me that I can do, or can I leave the pipenv from now on?
What will that do?
Aah okay
or even better.. run the tests pipenv run test
Already running the lint now
Seems like it passed the lint
Thanks for the help :)
I'm a bit confused about this part. What do you actually want me to do?https://pythondiscord.com/pages/contributing/bot/#server-setup
This part:
Setup categories, channels, emojis, roles, and webhooks in your server. To see what needs to be added, please refer to the following sections in the config-default.yml file:
style.emojis
guild.categories
guild.channels
guild.roles
guild.webhooksWe understand this is tedious and are working on a better solution for setting up test servers.
you need to setup a test server for the bot following the config file in those specific sections
when i say server, i mean discord server
Should I setup everything and then update the IDs in the config file to match the server info?
So, I should create every channel and add every emoji manually?
you don’t have to add the emojis
as for the channels, you’ll need to add the ones in the config
no problem 👍
This feels like a silly thing to ask, but how do I add the emojis?
I can't seem to find any image files in the repo
erm, most of the emojis aren’t public
Is there a way to add them?
there is not
Okay
because @stable mountain reacts using the trashcan
the other custom emojis are in embeds afaik
Okay
so im looking into using snekbox for my own bots evaluation, does the container restart on every eval?
or is nsjail the primary sandboxing tool
It is nsjail
@velvet ether hey dude, thanks so much for the work you've been doing on django-simple-bulma, I really appreciate it.
are you keen to take on the rest of the submodule tasks? I guess maybe it's only extensions. I think the approach you suggested sounds good.
I've also been thinking about how we can do the same sort of thing for FontAwesome - it'd be really cool if it used the latest version of this as well, but I'm a little unsure how we could achieve that.
still, "always use the latest version of everything" is a very cool feature.
No problem :) I was working on a django project and needed a stylesheet that wasn't bootstrap, so i figured i might as well help out
I looked around for a fontawesome cdn that just provided the latest version, but couldn't find any. In my project i just ended up serving it myself
yeah, that's the problem.
we'd need some cleverness to solve that, I think
the latest versions of fontawesome expect you to make a user and use a custom CDN link for only you
if we make people add that to bulma_settings it would basically be the same as adding a <link> manually in some template
the right approach might be to have the user put their info in BULMA_SETTINGS
yeah
I mean, you're right
the template tag makes things a little more readable though, maybe.
but I agree that the feature is a little dumb
I wonder how much info they'd have to put into BULMA_SETTINGS for us to generate the CDN link
and if we can support Pro as well
there may be a little bit of convenience there, if they just need to put a token and we can support both Pro and Regular
i guess
alternatively we could remove the feature, but that's not backwards compatible and so it might be a hassle for existing users.
maybe we could make the token optional, and just do what we're currently doing (provide an older version) if no token is provided
i can generate an api token on their website, but can't quite figure out how to use it
so they have an API?
hm.
iunno, it just feels like they are going in a different direction
they want everyone signing up
and getting in the way of that is kinda stupid
maybe we should just remove the support.
don't get me wrong, font awesome is awesome, but damn is it fragmented. There seems to be a different website for every release and then some stragglers like github pages and some cdns. Also i can find no documentation for their api 🙄
yeah, agreed.
and yeah, the font_awesome tag really isn't that usefulanymore
font-awesome expects you to do one of three things
- Use their CDN and kits system (the user-specific links you mentioned)
- Download it and serve it statically from the site itself, but you can't put the pro icons in a git repo
- Use your credentials to get everything from an NPM repo at build time
that last one is probably your best bet for automation
but the issue then becomes, do you make django-simple-bulma/whatever django addon rely on npm or implement some custom download logic?
the API keys exist to allow one to configure kits programmatically btw, the wordpress plugin uses them for that
You could pull them in your setup.py file perhaps?
I mean it's certainly possible to configure a kit that way
in the settings.py
that's the absolute easiest option, but it doesn't solve the issue of people that want to serve the assets themselves
the API is documented, it's graphql, but it doesn't seem useful other than that
I'm leaning towards
- Allow users to specify their kit token or whatever in BULMA_SETTINGS, and use that if provided.
- Otherwise, use an older CDN like we're doing now.
Yeah, I think probably a whole download system is probably out of scope
I would be leaning towards just removing the feature, but I don't wanna break backwards compat
kits are going to be the most common use-case
but how much info would we need in the BULMA_SETTINGS to generate a kit CDN link?
is it just a single token?
and is it the same for pro and regular?
There are no free kits
you just use their CDN
the point of kits is that you can customize them in the font-awesome site's ui
okay, you're getting hung up on terminology
the CDN link for the free stuff still has a token in it
at least in recent versions
and you have to like sign up with your email and become a free member to get that token, right?
what I'd like to do here is
- put as little information as possible into BULMA_SETTINGS - maybe a single token?
- generate either a Pro or a Regular CDN link using this token
- If token is not provided, just put an older version CDN like we're doing now
alright, I just made a free kit and yeah it's the same
<script src="https://kit.fontawesome.com/IDENTIFIER.js" crossorigin="anonymous"></script>
hm, okay. so basically we just need that identifier
that's all there is to it
that seems pretty easy to implement then
since this is a free test kit, here's what the site shows
you just get that script tag
the settings are just things like, the version, whether to use web fonts/SVG, and a handful of misc options
they don't change the url
very cool
that suits us perfectly then
@velvet ether Hey dude, are you around?
just wanted to say, I've assigned you a Contributor role here on the server as thanks for the work you've put in. Enjoy the fancy green color. Also, if you'd like to handle this FontAwesome thing (see the conversation above) and the Bulma-Extensions submodulification, they're all yours. We'd be grateful for those changes. I think that would really modernize the whole app and make it more maintainable.
If not, I can probably handle them myself.
There'll be an official django plugin when FA 6 rolls around as well, so no need to overengineer
yup
huh.
so you won't need to worry about it after that
there's almost no info on it right now unfortunately, but
okay, cool.
guess we'll add some info about that in the readme at some point
when it comes out
I already obtained a pro license for it so you guys will be able to use it as soon as the beta rolls around, if that's your prerogative
I'll let you know
👍
oh right, I got an email the other day as well
apparently they're releasing a feature that will let you add your own icons to kits if you wanted a pydis icon or anything
should be.. "soon™️" ("very shortly")
well, I mean, it sorta already has the pydis icon
Oh yeah, they do have the python logo don't they
yep
just wanted to say, I've assigned you a Contributor role here on the server as thanks for the work you've put in. Enjoy the fancy green color. Also, if you'd like to handle this FontAwesome thing (see the conversation above) and the Bulma-Extensions submodulification, they're all yours. We'd be grateful for those changes. I think that would really modernize the whole app and make it more maintainable.
If not, I can probably handle them myself.
@crude gyro Thank you, I appreciate it. I'm not at home right now, but if be happy to look at it later today.
there's no rush, @velvet ether, I'd be happy even if you looked at it a week from now.
I'm just looking for a clarification on whether I should put it on my own agenda or leave it to you.
I don't think these changes are urgent, but I'd love to see them at some point.
I know, but I'm gonna work on it later today anyway
that's fine of course 
No, just adding one validator and setting up a normal environment instead of a static clone of the repo
Any way I could run the site tests through docker? Want to avoid messing with postgres on the host machine
should be able to by specifying a different command on launching the container
are you using compose?
Yes
docker-compose run web
is the same as if you'd do
docker-compose run web run --debug
which is eq to if you'd done
python manage.py run --debug if you were locally running it.
i'm like 80% sure on this anyhow lol
using that baseline, you're able to pass anything you want to manage.py instead of run
with django, to run tests, you'd normally do manage.py test
so i assume it's docker-compose run web test to get it to run tests
let me know if that's wrong though, in which case i should be able to dig up how i set it up previously
Yeah I was doing something similiar before but at first it seemed to not apply migrations at first and then it wasn't started in debug. This is a lot simpler and only needs the debug env var added, thanks
I just run the tests in PyCharm with the docker-compose for the site running
required minimal setup, and no local postgres
Pycharm didn't seem to like them much when I tried through it, how does your run config look?
well, I changed it so that the template for Django tests contains some environment variables
the database URL I'm using is DATABASE_URL=postgres://pysite:pysite@localhost:7777/pysite
other than that, nothing spceial
then I basically just right click the tests folder and run
and it works like a charm
Complains about something with the db config when I try that
For migration names, is it just just ####_change ?
yes.
lol why does the github bot send the introduction twice
guess it is treating ready to review as PR opened
oh
def handle_cast({:pull_request, :ready_for_review, payload}, state) do
handle_cast({:pull_request, :opened, payload}, state)
end
yeah okay
fixed
Does GitHub bot collect some statistics too?
no stats on the github bot, no
it's completely stateless
It could collect stats, but most of what it is sent is collectable by the GitHub API as well
Why this last revert?
!tempmute 731475449162760214 1H shh
:incoming_envelope: :ok_hand: applied mute to @clever wraith until 2020-08-05 16:43 (59 minutes and 59 seconds).
Oh
There was a bug that I didn't catch in testing
it was causing channels to not move out of available sometimes when spoken in
looking into it now
I think I wanna do some work on this cog. Clean it up a bit and investigate the 1 available channel bug
Would appreciate getting these merged first https://github.com/python-discord/bot/pulls?q=is%3Apr+is%3Aopen+label%3A"a%3A+help+channels"
Ah also 886 since it moves out some funcs to utils, but whatever, I'll take what i can get
When the code jam ends, I should be free to work on #dev-log message. Shouldn’t take too long
Review please
https://github.com/python-discord/bot/pull/886
Like I said earlier, It'd be nice to have the PRs that touch help channels out of the way so I can do some refactoring there
Got a WIP but working solution for https://github.com/python-discord/bot/pull/1014#issuecomment-663992753 at https://github.com/Numerlor/bot/pull/1/files, but I'm unsure on the design because of how the objects are linked; would be great if someone could look at the comments I've made on the PR in cog.py( and https://github.com/python-discord/bot/issues/1067) so I can get them commited and then I'll try looking at using lxml directly for some performance gains
Hey @crude gyro, did you see I my pr on django-simple-bulma? I got lots of other stuff to do, so it's no rush, but I still just wanted to make sure it didn't get lost in your feed :)
I think he's taking a break at the moment, at least from what I heard in the OT channels
I was on a bit of a vacation, yeah.
but I'm back now
thanks for the reminder, @velvet ether, my apologies, it got lost in my feed
coming back to work after a vacation turns out to be quite busy
Vac.. ations ? Like the owners of this server sometimes sleep? 
just took a vacation from working on Python Discord stuff and from my dayjob, and focused on a personal project for a bit.
even on my vacation, I still can't help but spend most days programming
I wish our API had more specific error codes
Cause doing this is annoying py if e.status == 400 and "already exists" in next(e.response_json.get("id", []), ""):
It gets even worse. I have to do iter() before next()
That does sound like a hassle
It may not be necessary, but IDK what I can and can't rely on from DRF's default error handler
I'm trying to think of a neat way to solve this.
Some APIs return a unique error code in the JSON
I can abstract it into a custom exception that subclasses ResponseCodeError for now
Yes, Discord's API does that
If I'm not mistaken, most of our current response will be {"field_name": "some reason in a long string"}
Django, API, REST, Exceptions
It doesn't explicitly state it will always have a list as the value for validation errors
"Any example validation error might look like this:" (emphasis mine)
Yeah
It's basically "it could be this, but, hey, no guarantees, and good luck"
Anyway, the custom exception part beneath that is indeed interesting
It'll probably be in a list so I'll simplify the code https://github.com/encode/django-rest-framework/blob/3d708ac7005e29ca75aa68b447edb8d9dc111637/rest_framework/exceptions.py#L152
What do you all think about my idea to prefix non-extension modules with an underscore? https://github.com/python-discord/bot/issues/160
This is so they can be distinguished from extensions by the !ext reload command and its friends
Doesn't sound like a bad idea to me
Well, I suppose that's enough for me to move forward
People are welcome to complain in the PR if they dislike that
the bot has complained about code block escape attempt twice to me
when I use !e
what's that about
It doesn't allow triple backticks or triple zero-width characters
I don't really know why the zero-width characters are disallowed but the backticks would obviously end the Markdown codeblock prematurely
I don't get it
so don;t have anything after closing ```?
how can I avoid triple backticks
both times I pasted the same thing again, and it accepted it, at least I think I didn;t change anything
If your input is in a code block and you put any text before or after it, the command will not be able to extract the code from the code block and will therefore treat the entire message as the code.
Why aren't we getting rid of the text before and after the codeblock btw?
It would allow us to place explanations before and after
And it is just a small regex change
No reason
need some help. Anybody Willing?
Is it related to our projects on github? If not, #❓|how-to-get-help would be a better place.
I'd like to contribute to the bot but I don't know how to set up the bot and the site. Is there a guide to get started?
I'm using Manjaro XFCE (a Linux distrubution)
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.
feel free to ask here if you get stuck at some point
in that page it only says what are contributors and what's the contributors role
The Bot and Site headers are clickable
https://pythondiscord.com/pages/contributing/bot/
https://pythondiscord.com/pages/contributing/site/
that probably says something about the UX though 
the link that says Github leads you to github
i should start setting up the site, right?
Yup, you'll need the site for the bot anyway
okay
git clone go brrr
damn i'm so excited to contribute 
hm, about the test server
there is a new feature called "server templates"
they're used to create a clone of the server, but they do not contain the members and messages
if anyone has already a test server they could share it here so people could set up their own one in just one click
how do i set up the big brother and the talent pool webhooks?
also, i'm getting this error because i'm not going to connect to pythondiscord.com for obvious reasons
You need to also run the site locally
No, that's the listen address, you connect to it at 127.0.0.1
But you need to add a hosts file entry really
Like api.localhost
hm
Or you could just configure it to not use a subdomain
i see
i got 3 pings lol
Rather than joining that list
I'm not sure I follow - did you do what I said already?
i didn't really understand you
i don't really know yaml
i think it doesn't work because api.0.0.0.0:8000 or api.127.0.0.1:8000 are not valid
Well, yes
look at the site_api line
&API is giving that entry a name, which can be referred to using *API later in the document
i see
after that, we're joining api. and the entry labelled DOMAIN together
okay
when really all you want there is *DOMAIN
however
now that I think about it
I think the django setup does require a subdomain
so, the DOMAIN should be set to localhost:8080
you can test whether that works, but if it doesn't, you need to edit your hosts file and add api.localhost
the hosts file is OS-specific and not part of the project
oh sheet
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.
that doesn't really matter
you can follow this guide, it defaults to non-docker instructions and tells you how to modify them if you're using docker
then you'll change the DOMAIN entry in your config to pythondiscord.local:8000
okay
ensure that you've followed the rest of this too https://pythondiscord.com/pages/contributing/site/
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.
pretty much exactly what it says
also, thanks :D
now everything works :D
No worries
All good
by the way i'd like to share my python discord server template :) https://discord.new/DtaKJqa7K2BA
note: verified role is developers role
where is the DUCK POND
There was already this one https://discordapp.com/channels/267624335836053506/635950537262759947/694868859865530418 although I reckon it's quite out of date now
This one https://discord.new/zmHtscpYN9E3
not really lol
btw, about this issue: https://github.com/python-discord/bot/issues/1047
is there anyone working on it? i could do it if there isn't people working on it
Ask Joseph, he wrote he was interested in implementing them
@patent pivot read above please
oh yeah, I have some stuff locally for that
so assigned to me, I'll PR it either today or tomorrow
okay
how do i add docs so the docs command will work?
You need the inventories of the individual docs pages e.g. http://docs.python.org/objects.inv and then add that with the base url through the set command or the admin panel on the site
!d
:o
The base url for the package is here, and you need to grab discordpy's inventory, python.org's only has symbols that are on docs.python.org
the inventories are almost always behind the base url + /objects.inv
huh, it seems that there's nothing on https://pypi.python.org/pypi/discord.py/objects.inv
maybe i'm not getting something or something's weird
The base url is what's hyperlinked in the inventories embed above
It's then used to construct the absolute urls when you fetch a doc symbol so it's the part that's shared between all of them in the package
You're missing the en/stable/ path
yay now there is one :D
btw, i finally made it, so i can finally test my changes for https://github.com/python-discord/bot/issues/1098
(can anyone assign me?)
You should wait for it to be discussed and approved, personally I don't think it's very impactful of a change but also don't see much use in deleting the doc embeds
(You can start that dicussion by weighing in to potentially speed it up)
As in like... adding any insights or comments you have about that particular issue
Something to help clarify why this particular issue should be carried out
guys
yes
i have a question about git
i got assigned for the issue #1098 and i commited, but, how do i push?
is git push enough?
sorry, but this is my first "big" contribution and i don't want things break
btw i linted beforehand :)
git push should be enough yeah, and it will probably ask you to run a longer command to set the upstream, you can do what gut says
Github will probably even respond with a link to directly open a PR
(all the lines starting with remote: are send by github)
also, for some reason the lint is successful but the azure pipelines lint is not successful
bruh
That's weird
guess i'll need to commit again with some fixes to satisfy azure
is there an easy way I could copy the !doc command to my own bot as a util?
sure, have you seen the source?
you would just need to implement the database persistence on your bot instead of on a separate site (unless you have a separate site)
the bot requests inventory info from the site api for the bot here, but it's trivial to do that from a local source or an another way
and what do you mean by a local source?
I haven't been doing programming like this for very long, so even though my skills have been steadily increasing over the last few months since I started making a bot, I have yet to learn about things and terms like this
local source -> something saved locally, for example a file
and, be aware that @stable mountain (bot) highly relies on https://pythondiscord.com/ (site)
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.
Infractions, emails, tokens, docs... everything is saved there, in a database
(with emails and tokens I don't mean your discord ones, with emails I mean your github email that is got when you link your github there)
Saving the inventories to a file or to a local database
You'd replace the calls to the API with some file reading/writing operations, or some SQL if you're using a database.
hahaha @velvet ether, Remove blasphemous whitespace is a pretty good commit message.
Thank you @crude gyro 😁 . Also, I'll try your suggestion about passing the element, give me a couple of minutes
@celest charm is our JS guru. could you have a look at https://github.com/python-discord/django-simple-bulma/pull/59/files, @celest charm, and see if you can suggest a way that we can do this without this horrible scope bleeding stuff?
it's so ugly to have the show and hide functions defined inside the loop and then have the other function, defined earlier, make use of them
it just.. doesn't feel very Pythonic
I think IIFEs can be replaced by simple scopes?
😄
oh, huh
no, functions bleed out
what a beautiful language
I know, but can't we solve this in a cleaner way? In my dream solution, we'd define all those functions outside the loop and then somehow still make it work on the right elements.
Maybe you can use .bind
Oh, wait. You can just define the functions outside of the loop, right?
and use this
(disclaimer: I am not really a JS guru 👀)
What do you think about this? (untested) https://hastebin.com/feneqabuko.js
alright, if you pass the menu_element to the wrapper, then this also works
Wait. How are you using show and hide in handle_event if they are defined outside of it?
scope bleed. that's the thing that sucks.
I think this is better, @velvet ether
what you showed there
if it works
it does
then I'd be happy with that
Wait. How are you using
showandhideinhandle_eventif they are defined outside of it?
i have no clue
gotta run now but I'll have a look tomorrow and probably do a 2.0 release
But handle_event will refer to the last defined function, right? Have you tested it with multiple elements?
as i also explained on the pr, i did not inted for this to happen
thank you so much for all the excellent work you've put towards 2.0
np
But
handle_eventwill refer to the last defined function, right? Have you tested it with multiple elements?
yikes you are right
I think it works exactly as it does in Python
If you don't want the functions to bleed out and you don't need to use/pass this inside, you can create an arrow function and bind it to a variable
oh, wait, you can bind normal functions to variables.
So instead of
function show() {
element.classList.add("is-active");
}
do
const show = function() {
element.classList.add("is-active");
}
or, if you don't need this inside the handler,
const show = () => {
element.classList.add("is-active");
}
and then you don't need an IIFE
can you explain IIFE?
Immediately-invoked function expression
ah yeah
so yes, probably the best way is to create a higher-order function outside the loop
as JonasUJ suggested
but it's not working rn 😳
hold on
why do you need menu_element?
You're attaching the event handler to element, not menu_element
oh, sorry
I somehow missed it
why are you removing the event listener after the element has been clicked?
i dont know actually
is just converted the original script away from using jquery
it works fine without so i guess there is no reason for it
no sorry, that is a wrong way to think about it
also, menu_element was actually just some leftover
I got it down to this now https://hastebin.com/genibebame.js. It work as far as i can tell, but I also said that the previous couple of times
maybe move show to the named function and pass in the element instead?
One question about bot/cogs/doc.py: is the doc_cleanup function I made OK or it's preferably to use the cleanup function from bot/utils/messages.py?
@neon phoenix use premade cleanup function
okay
new commit today afternoon if I can
for the pr #1106
BTW, the help cog does the same :p
It doesn't use the pre-made cleanup function
How does the docs work for the bot? do you write it or it is web-scraped from some place?
The docs command?
yes
I think it uses sphinx's indexing files from documentation sites generated with it
oh!
It uses those to get urls pointing to what you can request, then those are scraped for relevant contents and turned into markdown
One question: how actually the Azure Pipelines test the bot?
i have no idea how a program can test a bot lol
@neon phoenix This can be tested with Mocking
mocking????
well, i did it
i used wait_for_deletion from /bot/cogs/messages.py instead of using the original doc_cleanup
now it's time to wait for approval :|
@cold moon one thing about the comment you made
you also said to not specify client
wouldn't it break? in the wait_for_deletion's sources, the client parameter is: client: Optional[Client] = None
https://github.com/python-discord/bot/blob/master/bot/utils/messages.py#L39 this is optional parameter.
oh, i didn't see that
it seems i need to read all the bot's source code if i want to write cleaner code, at this point 
uh, wait a moment
This is in docstring too
if i don't set the client parameter to self.bot, this exception AttributeError: 'Member' object has no attribute 'wait_for' is raised
because discord.Member doesn't have wait_for, but discord.Client/discord.ext.commands.Bot/bot.Bot does
hm, i think i'll open an issue
@cold moon so, finally, what do you think it's cleaner?
await wait_for_deletion(await ctx.send(embed=doc_embed), (ctx.author.id,), client=self.bot)```
or
```py
doc_embed = await ctx.send(embed=doc_embed)
await wait_for_deletion(doc_embed, (ctx.author.id,), client=self.bot)```
IMO the first one is cleaner because there are no function calls inside the function call
¯_(ツ)_/¯
hey soo im kinda new here. I took an online basic python class and i would like to move forward with learning python. Where or how would i do that?
!resources @thorny fossil you can check this out
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
@velvet ether did you see the bug posted on django-simple-bulma today? https://github.com/python-discord/django-simple-bulma/issues/61
seems like the new release is pretty much unusable
the only thing I can think of is that sdist just doesn't have the submodules available to look inside of, it just sees, you know, a .git or whatever
but I don't know. it's a little hard to troubleshoot. I thought the release would've failed if something like that was true.
did you try to build it locally?
okay, yeah, the build does have some warnings but didn't fail
warning: no directories found matching 'django_simple_bulma/bulma/sass'
warning: no directories found matching 'django_simple_bulma/extensions/*/src'
no previously-included directories found matching 'django_simple_bulma/extensions/*/src/docs'
no previously-included directories found matching 'django_simple_bulma/extensions/*/src/demo'
warning: no directories found matching 'django_simple_bulma/extensions/bulma-coolcheckboxes/dist'
warning: no files found matching 'django_simple_bulma/extensions/bulma-megamenu/megamenu.css'
running python setup.py sdist bdist_wheel in my local repo gets me a build and dist folder. In the build folder i can see all the bulma files
did you run git submodule update?
probably not
it is required to pull them
might need to be added to the release workflow then.
here's the current workflow
basically all it does is check out the master branch, install python, install dependencies, and build
so I guess we need a step to do that submodule update then
so like this? yaml - name: Install build dependencies & build run: | git submodule update python -m pip install --upgrade pip pip install setuptools wheel python setup.py sdist bdist_wheel
maybe, but I'm not sure git will be available at that stage.
so we miiight have to install it first
maybe we can just add this
then we can just add this on the step before the build
steps:
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
I'm unfamiliar with github workflows so I wouldn't know
using marketplace actions is nice. someone else can go through the trouble of maintaining it.
anyway I can try to add this step
attempting a new release now.
it ain't there
the action failed
oh
is it trying to run the git command in .githib/workflows dir instead of the base dir?
hm, I found something
ah yes, okay
we should be able to use this for it https://github.com/actions/checkout
which, actually, we were already using. but submodules need to explicitly be set to True
Sorry for interrupting you guys, but, do you think a repository map will be a good idea on the site and bot repos?
recursive is probably a better value, just to be safe
Unless it would never make sense for one of your submodules to have a submodule it depends on for normal functionality
@neon phoenix What's that?
yeah I'm setting it to recursive
a markdown file, which inside there all folders and files are explained
We should probably do a better job of adding module docstrings rather than relying on a separate file then.
I suppose not every folder is a package though
Yes, but, there's a lot of files
The repo map could help contributors that are beginners, so they don't need to really dive in
idk
Tbh I didn't know bot/utils/messages.py was a thing
as someone who haven't contributed to either, I would say the site is at least decently understandable
@velvet ether I think it was resolved with that last release, although I'm still getting this warning in the build log:
warning: no files found matching 'django_simple_bulma/extensions/bulma-megamenu/megamenu.css'
not sure why, but I don't think it has anything to do with the release workflow at least
that should do it
okay, I'll do a quick release for that too
sorry about all this... It's quite a bummer of a v2 release
naw, it's fine. he was probably the only person who noticed :D
man
yeah it's fine. it's natural even for quite popular packages to have little bugfix releases on the same day as a new major release
little bugfix releases
granted, they're usually not as serious as "this package is now unusable" 
I guess one way to fix these build issues is to have a CI that uses the test PyPI which you can test before tagging an official release
but the megamenu thing is a small bugfix
Haha
I honestly don't think it's that major of a problem if it's broken for a few hours. it's nice that it has enough users that someone will report a bug
this is what you get when you don't specify a version in your requirements.txt xd
the only people who would've been affected by this are people who chose today as their day to update
Nah, but if you want to try a fix to the CI, having an actions file that pushes to the that test PyPI repository that only keeps your package around for a short while may work. It allows you to test the entire thing without actually pushing to PyPI proper.
seems to work now
nice.
Was that an issue that running a local pip install (pip install <path to the source>) wouldn't catch?
Basically, yes
The issue was that we needed to include a submodule during the build step
So, the files need to be there in the CI
And if you do have the files locally (which is probably because you need it to run/dev the package), it will look like it works locally
but then fail in the CI
I've just tried to local install the package without installing anything, using the v2.0.0 tag, and it seems to build without any warning, that's really weird
there are warnings in the build log
they just don't stop the build
I would've expected the build to fail
that's basically why this happened
but it's fixed now so it's all good
@green mesa inv files are fetched through the intersphinx fetch_inventory function, they have their own format
Ooo how can I start
I don't know much about this topic¯_(ツ)_/¯
Can u link me some useful link😅 easy one which I can understand
@brazen charm
There isn't much to it. You just install sphinx and use the sphinx.ext.intersphinx.fetch_inventory function
how will I know what all it takes?
you can look at its help() output or find it in the docs
Not there
It's not showing at docs
😐
it says fetch_inventory did not match any query
You can find the function and its docstring here https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/ext/intersphinx.py#L152. I've also just uploaded an async implementation for it at https://gist.github.com/Numerlor/e57096cedd06dd536cdddff86be2661f, but that's adjusted for the behaviour that's needed for @stable mountain
You can find the usage in @stable mountain's source, but you need the mock app (you can pass the uri to get the full links as output) and inv is the link to the inventory
config=SimpleNamespace(
intersphinx_timeout=3,
tls_verify=True,
user_agent="python3:python-discord/bot:1.0.0"```
this is mandatory
examples and explanation is not given
The inventory files only get you the link to the symbol, you have to parse it yourself from the site
writings tests sure does take a long time, or I suck
Also spent all morning fixing the code in that bottom commit, but rebased so it doesn't show.
It sure does
Apparently 22% of commits on bot's master are merge commits
That's a lot more than I'd expect
probably a good thing.
means we're good at keeping PRs small, basically.
it also probably means we're a bit too eager when it comes to clicking on Update Branch
Hello
!ask command is not working 🙂
I tried thrice !ask but py bot is not responding other commands are working except !ask
Ahh y that was very useful😐
Can we some command which explains what helpers need when someone ask for help
I think it was announced
Sorry but I aren't able to find any announcement for that🙂
You can find the discussion in #community-meta then from a few days ago
Ok ty mark🙂
https://github.com/python-discord/bot/issues/1114
very low hanging fruit issue here if someone wants an easy contribution.
@crude gyro About issue #6 https://github.com/python-discord/django-simple-bulma/issues/6
I agree that it should be kept at very low priority, but since it is a feature of Bulma (https://bulma.io/documentation/overview/modular/), I think we should at least keep it open.
Hey Contribs, could anyone take this? https://github.com/python-discord/bot/issues/1115
quite urgent
Can take a look at it in a bit
i wnt to particapte in hacktoberfest of pydis
how i need to participate 😄
i can work on issue with WIP tags but that issue also have approved tag
so its have been approved?
WIP on an issue most likely means that someone is already working on it
oo so on which issue i can work
If you don't see any activity in it though ask a core developer and we could reassign it
Otherwise the approved ones
one more question i am using python 3.7.7 will i need to download 3.8 or i can work with 3.7.7
For the bot, you should use 3.8 as that is its specified environment
Do we have a little guide somewhere about how to setup the SocialApp on a local website?
I'm seeing 3 fields in the social accounts tab of the admin panel
I somehow figured it out
.>
How do you store if a user has accepted the privacy police? I have a user entry with my id an the "In guild" checkbox checked
this just means you're not in the User table at all
so, if you're on the server you can usually just sync the users to solve it
although I'm not sure how well OAuth works locally?
For the reminders issue, should I expand the api to allow some fetching of reminders by id, or just figure out the result from the available author filter
I think my bot is currently broken, and I'm a bit too lazy tbh
For the reminders issue, should I expand the api to allow some fetching of reminders by id, or just figure out the result from the available author filter
@brazen charm
you can't fetch reminders by ID already?
But I am in the User table
You can delete them by id, but not fetch them by id iirc
filtering is restricted to active and author ids, and get is disallowed on the direct reminders/id path
what configuration should i have with flake8 before PRing
There's a configuration already in the repo
ok
pipenv run lint should do the trick
wow ty
So all auth now work, but I can't access the setting page
Access to fetch at 'http://pythondiscord.local:8000/accounts/settings' from origin 'http://0.0.0.0:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.```
what
where is how to setup bot is given
i arent able to find
i wnt to work on seasonal bot
https://pythondiscord.com/pages/contributing/ they are all on the contributing page
ty buddy
MONTH_OVERRIDE whats the use of this?
To make the bot think that we are in a particular month
oo so i have to give 8?
A crop like this would probably work
I would prefer not to cut off the hair on the side. That just makes it look weird
yes, that looks pretty good. would've been nice if we saw the whole drop maybe
could possibly make the drop a tiny bit smaller
I agree about wanting to see the whole drop. Making it smaller could make it less distinct, though
well, how about you make the drop a tiny bit smaller and the crop a tiny bit larger and sorta meet at the middle
maybe even move the drop down a few pixels
use all of these in combination to solve it, instead of just adjusting one of those factors
Yeah. I'm quite happy with how that looks
can you give me a png that has no whitespace
Sure

@crude gyro
😅
Hello 
Awesome, thanks
now make us a pull request 
👍 
Sure thing
Yay
Any preferred dimentions for the png?
just do what we've done for the other ones I guess?
Right, 128x128
github api token is http://api.github.com/users/{username}?
i wnt to contribute to seasonal bot so configuring env vars but i am stuck with github api
where to get
It's in your account settings, under developer on the left side
sounds like an xy problem to me
iirc
I don't see why you would need a github token to work on seasonalbot
just disable that extension if it's throwing up errors, or configure the env var to anything at all
unless you're working on a github API-related feature for seasonalbot, it's not relevant
ok
It only raises ratelimits
i am not doing anything related to github API
First PR
All feedback is appreciated
Loading .env environment variables…
Traceback (most recent call last):
File "__main__.py", line 6, in <module>
from bot.bot import bot
File "C:\Users\HP\Desktop\seasonalbot\bot\bot.py", line 13, in <module>
from bot.constants import Channels, Client, MODERATION_ROLES
ModuleNotFoundError: No module named 'bot.constants'; 'bot' is not a package
PS C:\Users\HP\Desktop\seasonalbot\bot>```
getting this annoying error
that's not how you run the bot
use pipenv run start, or if you're using some kind of an ide for it you have tu run it as a module
if you wanted to run it with a regular command, you'd use python -m bot, and that would run the __main__.py as a module
ooo
but, yeah, we have a run script so you should just do pipenv run start
How to run it etc. should all be in the contributing page for seasonalbot akarys linked
yes
github token is used by the branding manager
but it's not necessary, it only raises ratelimits for the API
unless you're working on the cog, you don't need it
Ok
@tawdry vapor Just so I'm sure I didn't misunderstand how something works, how would I get them by ids without the api change? filter_fields is defined with ('active', 'author__id') for the reminder viewset so passing in id: id_val through params didn't have any effect and returned the whole reminders list
I was probably misled then
I only tried with a single reminder active and it looked like it worked cause it returned something
can anyone close issue #1098?
btw, is anyone working on this? https://github.com/python-discord/bot/issues/796
I'd like to work on it, but this is still not approved
Shame that PyPi still doesn't have a search api
doooooes it not?
How does poetry search?
ah
https://github.com/python-poetry/poetry/blob/master/poetry/repositories/pypi_repository.py#L164-L194 lol
@hardy gorge why did you name this a sentinel? Is that really an appropriate name? https://github.com/python-discord/bot/pull/835#discussion_r463948061
That class basically looks like a mutex to me
Except it raises an error instead of blocking
I couldn't find any examples of that elsewhere
So I don't know what the proper name for it is
But surely it's some kind of mutex
Maybe it should just wait instead of raising an error. Chances are whatever operation happens 2nd will end up raising an error anyway.
Never mind. In the case of a scheduled task, we must abort it if e.g. the duration was modified, or the task itself would have to be responsible for checking if it's still valid somehow.
Hmm, I just called it that because it acts as a gatekeeper
So, like a sentinel (the soldier at the gate) who either lets you through or not
It's probably not the correct term from a compsci/programming point of view
You're probably more aware of that terminology than I am
Perhaps, but only since today
Was trying to research a better name for it
The closest I got was PTHREAD_MUTEX_ERRORCHECK but that's only for raising an error if the same thread tries to lock a mutex it already owns
Nothing came up for a "non-blocking" mutex
Any thoughts on this new Lemoji?
This is how it looks in a message (approximately):
Any feedback is appreciated
it's a little harder to identify as a lemon without the green hair, but
obviously the hair shouldn't be there
I don't hate it.
I think it's recognizable enough in the context of our server
Since we have a bunch of lemojis, this one will work
It won't do as well used externally, I think
As far as being recognizable as a lemoji
Yeah. I agree
Is there anything specific that you’d like to see changed with it before I create a pull request?
I don't hate it.
@crude gyro I must say that this really doesn’t sound too good
sorry
It won't do as well used externally, I think
@hardy gorge are the lemojis actually used externally? Of course they would be used to some extent, but would anyone who isn’t from this server know what a lemoji even is?
No worries. I need honest critique in order to improve it
I'm a little preoccupied. it really is rather good, I love the cloud particularly.
I'm just worried that the head looks like a yellow strawberry
No, I'm not too worried about external use. It's just that in context with the other lemoji, it's recognizable; outside of that context, you may not recognize it as a lemon
I do really like it apart from that
No, I'm not too worried about external use. It's just that in context with the other lemoji, it's recognizable; outside of that context, you may not recognize it as a lemon
I think the recognition of lemojis outside the community is questionable anyway, since most lemons do not have beards
the really good ones do
I’ll give it some minor tweaks tomorrow and push it to the branding repo
Sadly, it’ll have to be bald
we will just have to live with that
Sadly, yes. At least the beard survived the explosion
It's just lemon, but in 20 years.
Do you think processing commands on edited messages is a good idea?
.http_cat 418 doesn't exist and that makes me sad




