#dev-contrib
1 messages · Page 117 of 1
as with a few things, it's something that we can prolong until it is something that we have evidence to suggest it is necessary
github doesn't expose that in a nice way
umm yeah, but is it possible to implement that, haven't looked at how the current code is implemented
i mean yes but also no
it's possible, yes
that line
you need to use the GraphQL API though
can be restructured
https://github.com/Piston-CLI/piston-cli/blame/main/.github/pull_request_template.md#L27 -> https://github.com/Piston-CLI/piston-cli/tree/main/.github/pull_request_template.md#L27
nvm
query {
repositoryOwner(login: "github") {
repository(name: "linguist") {
object(expression: "master") {
... on Commit {
blame(path: "github-linguist.gemspec") {
ranges {
startingLine
endingLine
age
commit {
oid
author {
name
}
}
}
}
}
}
}
}
}
it's not worth the effort to implement I don't think, github will display it better than we could
lol wat
all that's done is look for blame in the url past a specific number of /
right, I thought the question was how to display blame lines inside github
.github/pull_request_template.md line 27
- [ ] Join the [**Piston CLI Discord Community**](https://discord.gg/c7dZ4zdGQT)?```
if we're rewriting, then yes, that's dead simple
.github/pull_request_template.md line 26
umm
.github/pull_request_template.md line 30
- [ ] Set the PR to **allow edits from contributors**?```
note: its maintainers
i just got it from pydis lol
yeah, we can add rewrite support from blame to blob
consider it approved? i can do that tomorrow
yeah for sure
it's not urgent though
if you have other stuff assigned, work on those first
it's very niche and we've not seen it used at all since the feature was released
fwiw whatever regex you use
it can't replace any blame in the file name
i wish we had a regex like pixels#1 but for file lines lmao
bot#1616 one line PR for review
yeah, we don't check for gg/invite/code
yes
And then obviously deletes every time
could people look at sir-lancebot#760 ?
me and xithrus had a slight discussion on this on twitch, I will add a comment as soon as I get time. It was to expand its functionality a bit more
yeah kosa was streaming and we two were there, I will comment it out soon, need to cook up something myself
Do you have your DMs turned on?
yes
Can you send me a link to the help channel open message that you didn't get a ping for?
wait i close open dm again it work sorry
Ok my mobile is dead for some reason and I cannot log onto GitHub, the thing is to have two separate sub commands called image and text. The image takes the pfp or the member mentioned(?, can be ignored too and just pfp). The text takes the nickname if nothing is specified or the text given
thats what ive done i get the pfp if there is no text given
Read it again, that’s not what I said
oh you want a command group?
Yes
and we could flip attachments as well
We can not sure since other image manipulation commands don’t
who should i ask?
Open an issue to discuss it
I don't think it should be added to this PR, since it's already different to what the original issue described.
if sir-lancebot#684 got closed then I don't think that this would work either
Um @vale ibex why is this happening
sure
@reverse.command(name="image")
async def image(self, ctx: commands.Context) -> None:
"""Sends a reversed version of the users profile picture."""
async with ctx.typing():
user = self._fetch_user(ctx.author.id)
if not user:
await ctx.send(f"{Emojis.cross_mark} Could not get user info.")
return
image_bytes = await user.avatar_url_as(size=1024).read()
filename = file_safe_name("reverse_avatar", ctx.author.display_name)
file = await in_executor(
PfpEffects.apply_effect,
image_bytes,
PfpEffects.flip_effect,
filename
)
embed = discord.Embed(
title="Your reversed avatar.",
description="Here is your reversed avatar. I think it is a spitting image of you."
)
embed.set_image(f"attachment://{filename}")
embed.set_footer(text=f"Made by {ctx.author.display_name}.", icon_url=user.avatar_url)
await ctx.send(embed=embed, file=file)
is reverse a commands.Group?
hmmmmm not sure how a sub group would work with a root alias
It should be fine
could you open a draft PR for these changes?
sure
for some reason without the root alias it just doesnt register
theres already a pr, 749 iirc
oh
sir-lancebot#756
sir-lancebot#756
sir-lancebot#759
sir-lancebot#758
sir-lancebot#760
there
yeah
Looking at your code, its because there's two functions called image in that cog now
so they're being redefined
It's also mentioned in the lint that it's an issue
do you have pre-commit setup locally?
@clever wraith
.latex does exist, it's just unloaded because it takes way too much ram
yea, it uses matplotlib in the background
even just having it loaded uses a lot of RAM? or calling it?
and uses a lot of memory to render
boo
at least the package we're using does
The next step is finding a good way to do a local and safe latex install and somoene checking it
We could pipe the command to a local install of latex, it's just finding a safe way to do that
oh lol yea what kat said
We could reuse a lot of logic from snekbox tbh
what if we did it in snekbox
I don't think it needs to be snekbox
there are latex install parameters you can use for a safe install
I just haven't had the time to personally test it
Can I ask a question about the pixels API implementation here?
for sure
I was looking through the codebase, specifically through the implementation of discord's OAuth2 , and I'm not sure what does the constants.client_id and constants.client_secret refer to, could you explain what those are?
they are credentials from discord
client_id is the identifier of the app we use on discord to sign you in, it generates the oauth2 screen when you browse to /authorize
when you authorize you then get redirected back to us with a code, we send that code to discord with our secret to get a temporary access token to access details on your account
oh, I see, so by the app you are referring to the application I can make on the discord developers portal?
yep
interesting, 1 more thing, what's constants.auth_uri? from the context I figured it's a url to discord authorization, but how would i obtain one? I noticed I can add those to the application in the dev portal, but I'm not really sure what it is at all
in the oauth2 tab of your application you can build the oauth uri by selecting a callback URL and the scopes you require for the URL (just identify in pixels' case)
so if say, I was hosting it on pixels.itsdrike.com, I'd put pixels.itsdrike.com/callback?
i cant remember the exact url the app uses, but i think so yeah
actually yeah im pretty sure its /callback
alright, thanks for the explanations, it makes much more sense now
@patent pivot bot#1616 merged.
@sleek steppe I've edited your comment since it showed as one quote block
ty
@short snow can you please tell what do you mean by that code is redundant? I'm not sure if i got it correctly.
Yep, updated the comment, should be pretty clear now
umm? got a ping
Some messages were purged, you were pinged in one of them
Hey @vale ibex and @short snow , you two have been most involved in my pr so i thought id tell you that the expansion is done. .reverse is a command group with the subcommands text and image. text takes a string and reverses it, image is special. If an image is given, it is flipped. Otherwise, it flips the users profile picture.
Perfect, I will try give it a review tomorrow!
okay, thanks
Hey! If anyone has a minute or two to spare, would you like to solve this? https://github.com/python-discord/sir-lancebot/issues/761
I... don't really see a need for it tbh. It feels odd why the standard rainbow wouldn't work
I thought we’d discussed that enough
I didn't really see a consensus to the discussion and my original comment still stands that it feels odd to include the straight/ally flag for the reasons I mentioned in the org channel.
I agree, there was no definitive conclusion to that conversation, and on review, if there was any inclination towards a consensus, it was that we should not add it.
I don’t quite see a reason to actively disapprove of including the ally flag, but since you have such a strong opinion on the topic, I’ll close the issue
However, I’d say the general consensus the discussion was leaning toward was “straight cis people aren’t part of the LGBTQ+ community, allies could just use the pride flag and it doesn’t hurt to include this flag in the command as well”
I mean, I'm probably going to be a bit too blunt but, showing support by saying that you're... a straight ally? It's weird to me, what's wrong with the rainbow? It really gives off the vibe of a visual "but no homo" type of comment
yeah, I think lemon mentioned that he wouldn't reject a PR, but later conversation after that didn't bring us any closer to consensus
I think that’s more of a question of wether or not the concept of “allies” should exist at all. If people would like to express their support that way, I don’t think we should discredit that because we might think they are afraid of being viewed as homosexual by showing support with the standard pride flag
I mean, it's not a question of if allies should exist. It's just odd that allies have their own flag when it isn't really necessary. I don't see the need for a straight/ally flag if there's the rainbow flag which is viewed as more supportive anyhow.
You originally prompted the question by saying that the flags available don't really fit and therefore there's a need for the straight ally flag. I'm very much disagreeing with that as the rainbow flag is the generic "I support you" flag.
can't see this link
if y'all here are staff and talking about a private conversation, what's the point to do so in a public channel?
Yeah, I get where you’re coming from. The thing that could be nice about having a ally flag (in a profile picture, this isn’t a pride parade) is that you show that yeah, you support the LGBTQ+ community, but you don’t necessarily have to be “a part of” the community yourself. Just showing that it’s not just LGBTQ+ people who are supporting it, but that’s it’s a much larger thing than that
well, it was primarily staff participating, I was just adding some context
well, what's the context? 😛
this
ah
Still, I see your point. I’d say that the ally flag serves a slightly different purpose than the other ones though. The bottom line is that I don’t think we should exclude allies from showing the fact that they’re allies if they want to
!ext r help_channels
:ok_hand: Extension successfully reloaded: bot.exts.help_channels.
There was only 2 active channels, I'm guessing related to the discord issue
yeah i agree
i don't see a reason to not include a flag if its part of the lgbtq community
adding all but this one flag just seems like leaving one out
Does the rainbow flag not show that enough?
To me, it does
My argument that there is that straight allies aren't LGBTQ+ so... why do they need a flag?
Something funky is going on with the help channels
Discord dying, no?
#❓|how-to-get-help doesn't seem to agree with what's active
Do we need to reload?
And opening a channel not in that list throws a key error the sentry
I've tried reloading the cog thrice, but hasn't solved it
I'm on mobile too, so can't investigate much more than that lol
I remember Xith maybe noticing this a previous time @vocal wolf ?
I might have fixed it now, but we should keep an eye
I reload the cog so 3 channels were available
Then reloaded it again to update the #❓|how-to-get-help message
Before someone claimed a channel
Deleting the message and restarting the bot should force everything to resync
Well Discord's API was being funky a bit ago
When this previously happened I deleted the message and reloaded the bot about 3 times, nothing worked.
tried claiming help channels as well to fix it up
didn't budge
@thorny obsidian @vale ibex I think it's fixed now...?
Yeah looks good now
noice
As a symbol to show support. But this is really just a discussion about whether it should exist or not. Now it does exist, and I think it’d be silly to disregard it completely
But there's the generic rainbow flag to show support?
But there's a flag for this specific part of the lgbtq community which isn't added.
The rainbow flag is for the whole community.
I think every other flag is added as well, except for this one flag
The ally flag isn’t really a part of the LGBTQ+ community
To myself, and a lot of other queer people, the straight ally flag is a weird cop out of support where you still feel the need to definitely indicate you're not queer. But you seem to feel rather strongly about it so feel free to PR it I guess.
Also, I do not consider cishet people part of the LGBTQ+ community. They're not LGBTQ+.
But it’s also a part of it
ig just ask in an offtopic channel
What's this about?
Ik some people will feel one way or another
The .prideavatar command?
whether or not to add the ally flag to the .prideavatar command.
Yeah. Possible addition of the ally flag
hmmmmm
@obsidian patio I don't know about that, I thought the .prideavatar command is specifically reserved for the pride flag, which support all (?)
I don't have that flag!
It does, you can specify other LGBT identity flags
• agender
• androgyne
• aromantic
• asexual
• bigender
• bisexual
• demiboy
• demigirl
• demisexual
• gay
• genderfluid
• genderqueer
• intersex
• lesbian
• nonbinary
• omnisexual
• pangender
• pansexual
• polyamory
• polysexual
• transgender
• trigender
.source prideavatar
All within the LGBTQ+ community
That docstring could also be updated LGBT -> LGBTQ+
According to my sources, the straight/ally flag is not a pride flag.
I know people who view that flag in a totally different way as well. Being an ally is built on the very concept of not being LGBTQ+ and still supporting the cause. Showing that you’re an ally rather than LGBTQ+ yourself is far from a “weird cop out of support”
I don’t really think it is either. I think it’s enough to have a rainbow in your profile picture, rather than explicitly making it clear ‘I am not part of this community but I support it.’ Just having a rainbow background is sufficient
I agree.
which flag is the rainbow itself?
I think it’s both gay and the community as a whole, but I could be mistaken
.prideavatar gay
Ngl the error messages on that command specifically seem weird
Fat Chance.
how's that weird?
It rotates between them
also it uses the same error messages as any other command
This
No, they meant what’s it represent
Yes, I see that flag is the rainbow itself, I don't see it in the list
Ah
Also regardless, where's my transparency
lgbt
lgtm*
I would use it but it doesn’t make it animated
Why is that borked in the center
if you find something like transparency missing, you can always open an issue :P
That's on me when making it, I think
Cool, I talk about stuff here before making issues 🙂
ah sorry, i must have mistook your talking for complaining
It’s a fine line
@thorny obsidian If you and some other people feel like the ally flag contributes negatively to the LGBTQ+ support, that’s not something I want to be a part of. I’ll use a standard pride flag to show my support instead. At the end of the day, that’s the reason I was considering using a flag in my profile picture at all. This event is about supporting the LGBTQ+ community, rather than unnecessary division over what flag you use to do so
that sounds good. I don't think I'm comfortable with us adding it anymore, seems like it's going to be controversial in a bad way.
so let's stick with rainbows for support.
@sleek steppe If you want to, you can go ahead and implement sir-lancebot#711.
Ooh speaking of GitHub
Can we get the issue linker to parse repo/(pulls|pull|issues)/number so you can just copy straight from GitHub
I’ve been meaning to make an issue to discuss that idea for a while, but never got around to it
how would it work? for like the gh cli?
Yes, we can do that
I’m assuming scale is talking about copy pasting the end of the url
So sir-lancebot/issues/711 for the above issue
would be neat if we posted a single url to an issue/PR we'd get an embed
The new embeds are quite neat
Yeah basically parse that like you’d parse sir-lancebot#xxx
@exotic ember this is fine?
uhh
To add more pride leaders you can PR to my source! 
or
Add more pride leaders [here](link to json file)

I don’t think you can create hyperlinks in the footer
yeah, i would keep it as a field
@short snow hello I had dinner then promptly forgot about the ping, maybe To add more pride leaders, feel free to open a pull request!
Does the bot have Unit Tests?
@stable mountain does
Does @dusky shore?
No
Can I add some to my contribution?
Don't think they'd fit in when there isn't a test suite in place. Maybe something that'd only be in the modules themselves? But that would be a bit out of place
Yeah that's what I was wondering
I just want to unit test a bit of my logic.
I'll just stick it in the file itself, I guess.
@patent pivot how much do you use olli?
Like, what does it stream?
No not experience, how much is it used.
Seems like one webhook every 30 minutes?
Does @high trout use it?
Asdf
.@stable mountain
Sorry skylark
And Lance?
yes
So how does it work through loki?
Since I don't see loki mentioned in the Lance repo
yes
because that's not how it works
lancebot and python are completely oblivious to olli
they are also oblivious to loki
they print logs to their standard output
loki accumulates and stores them
Hm, but how do you set them up with loki then?
olli then searches loki logs to post things to discord
Say if someone was running them locally, how is loki implemented?
by putting it in the olli config — loki picks up any container that starts on our stack
you don't run loki or olli locally
not while devving our projects at least
No, but if one was to set up loki, how is that done locally?
you install it and start tit
then configure the docker sink so that docker logs get shipped into it with promtail
one sec
nah it's fine here
I mean, I'm asking for modmail lol
Does granfana tie in with any of this?
it's not really a setup that works great locally
yes
Grafana queries Loki in the same way Olli queries Loki
Oh, loki is a portion of grafana
no it's not
Loki in Grafana Grafana ships with built-in support for Loki for versions greater than 6.0. Using 6.3 or later is highly recommended to take advantage of …
maintained by grafana, not part of grafana
Jason has confused me
Nvm
Ah
Why is this so long lmao
It just seems unnecessarily complicated
in development, you use docker logs
it's not
this is frankly a pretty simple production logging system
you'd pretty commonly see an ELK stack
I don't get why you are trying to fit Olli into Modmail
or Loki really
Are you hosting it?
Mind if I dm you that?
uh, I'd rather not? but sure
random Q: any reason some github features like issue embeds are on lance and some like showing lines from links are python bot?
i would assume thats just how it happened naturally but it can seem kinda random how such similar features are done by 2 separate bots
lance is supposed to have the "fun" stuff while Python has the things needed for the server to run smoothly, but it's not exactly a clear line so some things do get mixed up (like reddit that was moved). For the github links it's probably mostly because a direct pr was opened to the bot
hm, opinions on moving one or the other over?
I think it'd be good to have them together, but no idea which bot would be more fitting. For me the github commands fall into the category that fits into both about the same amount
I think moving the .issue command to @stable mountain would be nice. It’s a fairly important command for running the community smoothly
I wanted to obliterate the .issue command since we have the repo#12213521 thing
right but the repo#tag thing is also on lance, so moving that to python in the same step maybe?
Sounds feasible to me
I mean, I don't really consider the github repo stuff to be critical to the community, but I also don't care much either way
i dont care which bot gets em, but they should be on the same bot imo
I think @stable mountain didn't get any GitHub features in the first place because of its non-criticality, but it does seem like a utility and not as much of a fun-feature.
We should consider moving the entire cog over.
for things like the black channel gh features could be quite essential
yep
yeah, imo as a community based on open source and programming that stuff is pretty important :P
We should make some proper distinction to avoid this inevitably happening again in the future.
I think commands/features that are allowed outside of ot, bot commands or event specific channels should most probably be on Python instead
the .issue command gives much better information than the repo#number regex
.issue pixels#1
what additional information does it show?
.issue 1 pixels
literally none
I know Alec suggested it show more, but it was just a suggestion
^
no, it used to show more.
Find the git blame for me then?
i would love it if we could repurpose that command to just display info about 1 issue and display a bunch more yeah
i'll try
but here's some proof
and yes, they are aliases i see
.issue and repo#num are aliases for the same command, so i don't see a reason to remove the .issue portion
I think the prefixes were dropped as part of the rewrite to make the command and the listener the same
well, its an odd thing to drop
I'd like to see the prefixes return when there's more than one being output
Because it's redundant and less clear? .issue implies only look at an issue. The repo#number regex applies to PRs and issues.
bot#55 seasonalbot#15
yeah, i can't tell which of those goes to which lol
it has an alias, pr
Yeah, I think the prefixes should return
I also agree we should ditch the command
.gh should stay a command
hey, i have a question: what does the metricity bot actually do?
It records statistics about how you interact with the server
Think message frequency, channel usage, etc
for bot#1600 I think he made a PR without any issue because I can't seem to find any for it. So what should we do about that?
I personally don't mind the change but it's not gonna be consistent at all with the rest of the bot.
I think we wait for them to provide a proper reasoning for doing so and the core devs dicuss it ig
Xith asked them to two weeks ago
Yeah
At this point, it's not gonna happen
yeah, it would be inconsistent, it would probably be better to shift all the ping commands to reply if the PR is approved
Should we close it?
Prolly, but I'd leave that decision up to our triage lead
How I can ignore the specific lines of code?
is this related to python discord projects? Also could you explain the issue a bit more
Ya Actually I was unable to get token from env file
So I want to directly put the toke
For @dusky shore
where is your .env file? many things depend on your values in .env
you can get mention them manually in constants.py in bot/
but it should work ideally
yes
in Client class
my .env file is in the main directory.
yeah, well there are number of other places too which take in data from the .env
main directory meaning bot/ or the repository root
nope!
repository root https://github.com/python-discord/sir-lancebot
uhh add this to the top import dotenv; dotenv.load_dotenv() see if that helps
ya that's work
thanks
np, and also you don't need to ping me on every reply, I am here
Okay!
hey if any core dev/contributor is available, i'd like to discuss sir-lancebot #759
its irritating in a very small way but a small fix too.
sir-lancebot#759
yeah so current flow is
README => go to contri.md => go to website
new flow
README => go to website
(which is already done in python bot)
yeah sure.
thanks!
also i'd like to ask one more thing.
Also, very nice RPS PR, suggestions to discussion seem to be going pretty well.
Thanks 🙂
What else would you like to ask?
so I'm not sure if its possible or not, but im thinking that if we can have a command like !recent.
!recent <user_name:optional>
o/p: gives our last 10 messages with channel names
reason: a lot of times helpers are helping in hell of channels, and unless they are mentioned, they get loss of which channel needed the help so recent makes it easier to lets say give last 10 messages that way helper will get it easily.
there was this proposal of sending DM(optional) to person when they message in help channel to keep track but i feel this is a better way.
there is already a issue regarding the reason you proposed, it would show all the channels you are helping in currently in your DMs iirc
jake is doing that
but its related to DMing right?
If we're able to utilize self.bot.cached_messages then I wouldn't have a problem with it, since using .history would send a bunch of API traffic even with one user.
At the same time I don't think the cached_messages var would have all the messages that the user wants.
so doesn't .history have options like, last 10 messages or something like that? I'm sorry but I'm not greatly familiar with API.
It does
would it still send so much traffic? that's why i thought about just 10, y'know. because it gives a nice control over traffic.
bot#1567
@short snow this one right?
Would we scan all channels for their messages?
we can think about just help channels, i mean if you think about it, we can always see our recent matches from search bar.
So even if we don't have command normal users will not that have much to loose.
but at the same time things will be handy for helpers.
In the end, why not just use the discord search function?
oh we're thinking about specifically help channels
somehow I glossed over that, mb
I see where you said that previously now lol
yeah, and yes, as you said, discord search is always there, which makes a fair point.
What would make this useful is if it shows help channels you've talked in in the past 30 minutes. Discord search can be annoying if you're talking in multiple channels
I don't want a DM everytime I talk in a help channel but I would like a command I can run every so often
reasonable, considering the last 30 mins, if we show with messages, hella traffic possible.
if we just show help-channels, very less data to send however, helper may end up jumping from here to there to get the help channel he wants.
now more filtered channels to explore but still.
but again that can be put in by small control over sending max N messages from last M minutes.
@fervent sage have you worked on https://github.com/python-discord/bot/issues/1575, after joe assigned you?
wow it is there
What about only showing help sessions you've spoken in if they're still open
rather than tieing it to a time period
So you run the command and it lists all channel sessions that are still open that you have spoken in
can hook into the current help channel logic for it
yes
yeah that seems good, that filters down quite nicely.
ye ive worked on it a bit, but im mostly waiting on jake's similar thing since that's going to add in like 50% of the framework i need in redis to do mine, without duplicating a bunch of stuff
ty 4 update
if you want i can just forget that jake's doing one too and implement it all 
I think waiting for jake should be done, say that in issue, ye?
kk
yes uh im getting a haircut now but i will do so as soon as i get back
well 'now' is being used to mean in 10 minutes but near enough now 
do non-staff contributors's review count in staff approval?
the requirement is (staff | contrib) & core_dev
commiting while doing a haircut, multitasking 👀
ah so they do
You saw nothing.
The async tag is pretty large
but it does contain very useful information
i think its not even the beefiest tag which is slightly scary lol
yea lol, I think star-imports and mutable-default-args are the biggest atm
jeez
yep i regret that
tag to guide candidate
We should redirect tags that are over an amount of characters to another channel /s
could i pr the star-imports tag to remove a bunch of whitespace following codeblocks lol
please do
bot#1619 i made it fit onto my screen!
lmfao it's still massive
@clever wraith RPS command has been reviewed.
Thanks for the heads up!
@fervent sage star-tag shortening has been merged.
@sleek steppe time for you to review again. https://github.com/python-discord/bot/pull/1594
@clever wraith If you're using the commit in github with suggestions, you're able to change the message of the commit.
I thought we were moving it to the site
So please use something else besides "Update <some file>"
yeah just marked, i'll take care of it from now.
@exotic ember I cannot remember, are we migrating all tags to the site? If so, where is this location that we move everything to?
I'm not familiar with this situation.
@sleek steppe either way, it should be reviewed once again even if we do shove everything into the site.
I think that’s referring to these specific large tags
“Some tags are too large to make sense, so let’s make them into site articles”
ah
Paraphrasing, but you get the idea
I see
Should I make an issue somewhere?
Yes, but I'm not too sure where.
site came to mind for a page explaining it but that wouldn't really facilitate discussion about it
sir-lancebot#760 can take an attachment and reverse it, but i don't think any other image manipulation command supports that
Maybe meta?
there is one other that springs to mind, there might be more
namely the pride command allows you to use any image as a flag
@vale ibex would you mind checking if my resolving of conflicts on the talent-pool PR is correct?
Once this PR is merged, with my requested changes I'm planning to obliterate anything that allows arbitrary images to be parroted by the bot
do you have a link for the lazy? 😄
yeah, I'll provide the specific commit after I'm done resolving conflicts
👍
yup, lgtm
those default dict slices were a fun bug lol
mm so should we take attachments? it would be easier not to maintain consistency then change all of them imo
oh your next msg says that
nvm
Yea, I think my comment in the PR describes our stance on it
@sleek steppe @fervent sage async-await tag has been squash merged, co-authors assigned properly.
@stable mountain is now down to 13 PRs
that may be an all-time low
!async
Concurrency in Python
Python provides the ability to run multiple tasks and coroutines simultaneously with the use of the asyncio library, which is included in the Python standard library.
This works by running these coroutines in an event loop, where the context of which coroutine is being run is switches periodically to allow all of them to run, giving the appearance of running at the same time. This is different to using threads or processes in that all code is run in the main process and thread, although it is possible to run coroutines in threads.
To call an async function we can either await it, or run it in an event loop which we get from asyncio.
To create a coroutine that can be used with asyncio we need to define a function using the async keyword:
async def main():
await something_awaitable()
Which means we can call await something_awaitable() directly from within the function. If this were a non-async function this would have raised an exception like: SyntaxError: 'await' outside async function
To run the top level async function from outside of the event loop we can get an event loop from asyncio, and then use that loop to run the function:
from asyncio import get_event_loop
async def main():
await something_awaitable()
loop = get_event_loop()
loop.run_until_complete(main())
Note that in the run_until_complete() where we appear to be calling main(), this does not execute the code in main, rather it returns a coroutine object which is then handled and run by the event loop via run_until_complete().
To learn more about asyncio and its use, see the asyncio documentation.
yeah that's big
not compared to mutable-default-args 
I’ll happily take a force merge for my PR
I’m ~70% convinced that won’t be resolved before I’m 100% burned out on pydis
@gritty wind I may need help with bot#1487
Sure, what’s up
with testing
Ah
Your reminder will arrive in 7 hours!
we are not, we're trying to reduce bot-site coupling
roight
You know how if you call !docs and what you try to look up doesn't exist, the bot will eventually delete their response and the message in which you called !docs?
I think those are two wasted steps
it does this for other commands too
without looking at the code, there's no way to know if the user invoke will be deleted if you give the wrong stuff
and sometimes, its never deleted.
for docs it might be nice to have something like with eval, where you can edit and click refresh
I'm not even sure when its supposed to delete or not delete
pypi purges stuff, pep purges stuff, other commands don't purge stuff
it is so confusing
not really, sounds like its just the static info lookup commands which do
ah, its that the bots don't do the same behavior
when @stable mountain deletes an error message, it deletes the invoke.
When @dusky shore deletes its error messages, it leaves the invoke.
would be so so so so nice for that to be the same
true ;-;
perhaps an admin or owner can check that
(which is good, principle of least privilege)
lance should have manage messages perms if it's dealing with webhooks and pins, unless it's channel overwrites
yeah, its channel overwrites lol
It has manage message perms
That inconsistency seems so minor, it’s not worth fixing
That’s probably how they came to be in the first place
The people who wrote the feature and reviewed it didn’t think it’s important
Because it isn’t
Anyways if you want to PR go for it
as long as the diff isn’t > 5 lines, it’s 👍
https://github.com/python-discord/bot/pull/1587 here is a short PR if you wanna get the PR count down
This seems weird (just going off the title)
Why would you redirect someone where they can’t run the command
And if this added functionality to allow the command in DMs, I’ve got an even bigger problem with it
@vale ibex do you mean the site PR? (https://github.com/python-discord/bot/pull/1609#pullrequestreview-676473810)
hello
- What do you plan on eventually achieving with python?
- Is python your first programming language, if not, what is?
- What's your favourite aspect of python development? (Backend web dev/game dev/machine learning and ai ect)
- In what ways has python discord helped you with python?
- What part of python is currently dieing?
- Are you currently a student, or using python professionally?
- What is your process when you decide to start a project in python?
- Have you ever been unable to finish a python project? What is it and why?
- How often do you program in python?
- How would you learn a new library if needed to do so?
- Have you ever worked with a microcontroller or anything physical with python before?
- How good would you say you are at python so far, beginner/intermediate or advanced?
- Have you ever tried making your own programming language?
how do these sound?
there we go
wait a minute
i have to create an issue first??
;(
It is mandatory to link to an issue that has been approved by a Core Developer
;/
If it's just adding more questions to the topic file you have my explicit permission to not have an issue and can reference this message.
ayyy
glad people are adding topics.
i did it
thanks for that.
:D
@clever wraith you should probably add a description to the PR.
was just sad i got the same questions again and again
but you can remove the "relevant issues" section of it
i think i did 🤔
i said 'people feel repetetive questions so i added more'
:D
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
https://github.com/python-discord/sir-lancebot/pull/763 the PR shows no description
oh
oh no
now what
you can edit it
with the power of
oh
github
just click the 3 dots in the top right of the post
then click on edit
and do what you must
This doesn't seem right to me https://paste.pythondiscord.com/uyilubucix.apache?no_redirect
I've only got 1 infraction outstanding, and it's trying to reschedule it 4 times
done
twice under Infractions and twice under Superstarify
It's a mute so shouldn't touch superstarify, and not sure why it's getting schedulded twice normally
@clever wraith for future reference, here's how you can format posts in github: https://guides.github.com/features/mastering-markdown/
:0
This is testing bast's PR, but I'm going to downgrade and see if it's existing
aight i will read that
noice
@vale ibex did you break the talentpool thingy yet
if you have time, please test it really quick
I haven't touched it lol
ah
I'll have look see
understandable, have a nice day.
did you ping me somewhere? 😄
@clever wraith ignore my mess of title changing
I wish it didn't log all of those lol
:0
this title makes more sense tho haha
its more specific
should have thought of that
ahhh ok, scheduling twice makes sense now, since we schedule all the infractions then schedule the last again at the end.
Don't forget to lint!
whats this 
now to figure out why it's toucing startify
@clever wraith According to precommit, this is what it wants you to change.```diff
diff --git a/bot/resources/evergreen/py_topics.yaml b/bot/resources/evergreen/py_topics.yaml
index 05af49fe..6dc9947c 100644
--- a/bot/resources/evergreen/py_topics.yaml
+++ b/bot/resources/evergreen/py_topics.yaml
@@ -27,7 +27,7 @@
- Is python your first programming language, if not, what is?
- What's your favourite aspect of python development? (Backend web dev/game dev/machine learning and ai ect)
- In what ways has python discord helped you with python?
-
- What part of python is currently dieing?
-
- What part of python is currently dieing?
- Are you currently a student, or using python professionally?
- What is your process when you decide to start a project in python?
- Have you ever been unable to finish a python project? What is it and why?
:0
wait a minute
there's a trailing whitespace
i wrote it twice??
:0
it looks the same to me tho 🤔
it's tracking changes between the last commit, and your current local changes
oh
so now what
🤔
to lint, you want to run poetry run task lint
also the misspelling of dying
where
in your terminal
😞
in the project directory of sir-lancebot
oh okayokay
im not using version control tho because
looks like a very large file to download ☠️
will do it when
i get more into it
but... you are using version control
but..
how did you get your changes to github?
using github only..
file upload?
i forked it and..
i created a pr from my fork
did you edit the file in github?
so you didn't clone it to your computer?
nope
alright
cause
looked like a large file to clone
VS Code for python
pycharm sometimes, because of that pycharm font 
Doesn't vscode already have git built in?
pycharm def does
well yes, but that's not the best way of doing it
if you're going to edit stuff in the future it's better to do it on your computer and not in github
lancebot isn't a gig, pretty sure
let me see
yep
but i havent learnt disc.py yet 
maybe i can add a system that doesnt involve disc.py who knows 😄
Like maybe, a system that outputs everything to a json, or text file and
then it can be merged with discord.py by reading that file
sir-lance is 10mb
:0
thats the same as a venv
:0
hmmm
1000 mb is 1 gb right
yes
clone your fork, yes
mhm
xith regarding that .upper change. it was actually intentional. the upper case kinda gives a better view to what move did bot play. you still want the change?
and then when you're done with all, push changes, make that pr.
yep
ive used version control with other projects b4
and contributed to other open source but
Yeah, it was a bit too much imo. I think lower case would be fine.
alright no issues. I'll change it according.
ty
noice
indeed, cheers for first merge in sir-lancebot! 🍻
Anyone seen this before? https://paste.pythondiscord.com/alixoqaxuc.py
trying to build a docker image for sir lance
this diff solves it
it's been like this in lance for a while, guess no one has done a fresh build recently
Sounds right
<@&409416496733880320> bing bong, pls review sir-lancebot#765 at your earliest convenience
@vale ibex is there an easy way to reproduce that error so I can test it?
GitHub has a troll face emote
lol
I read into that trollface emote
as in this was your plan all along by committing that
see how long until someone noticed
also might have been from one of the changes to the deps that caused this too
we have bumped d.py and arrow since then
wait lmao
are github emotes site wide or do they need to be added?
i have never seen this mention before 👀
yes
alright thanks!
site wide
lol..... I have..... flashbacks to internal devops alerts
you still get them tho?
great! I've made respected changes.
wdym
hello
i'm trying to run tests locally but i get the following traceback:
Traceback (most recent call last):
File "~/workspace/pydis-site/pydis_site/apps/content/tests/test_utils.py", line 38, in test_get_root_categories
result = utils.get_categories(Path("."))
File "~/workspace/pydis-site/pydis_site/apps/content/utils.py", line 25, in get_categories
categories[item.name] = get_category(item)
File "~/workspace/pydis-site/pydis_site/apps/content/utils.py", line 16, in get_category
return yaml.safe_load(path.joinpath("_info.yml").read_text(encoding="utf-8"))
File "~/venv-packages/site-packages/pyfakefs/fake_pathlib.py", line 540, in read_text
with FakeFileOpen(self.filesystem)(self._path(), mode='r',
File "~/venv-packages/site-packages/pyfakefs/fake_filesystem.py", line 5202, in __call__
return self.call(*args, **kwargs)
File "~/venv-packages/site-packages/pyfakefs/fake_filesystem.py", line 5263, in call
file_object = self._init_file_object(file_object,
File "~/venv-packages/site-packages/pyfakefs/fake_filesystem.py", line 5318, in _init_file_object
self.filesystem.raise_os_error(errno.ENOENT, file_path)
File "~/venv-packages/site-packages/pyfakefs/fake_filesystem.py", line 1010, in raise_os_error
raise OSError(errno, message, filename)
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: 'var/_info.yml'
and i'm not entirely sure what to do with it. do i need to create the file somewhere?
(i simplified some paths because macos likes to do 500 layers of nesting)
No, you shouldn't need to create anything yourself. It should be self contained.
@gritty wind
Here's your reminder: Look @ bot 1487.
[Jump back to when you created the reminder](#dev-contrib message)
It might be a bug with the pyfakefs library on macOS
Or it somehow relies on a specific cwd to be used and you're using the wrong one?
Path(".") is kind of suspicious
yeah, that's a good point! i'll take a peek around
I think pyfakefs is supposed to patch out pathlib with a mock
(Pdb) tuple(Path(".").glob('*'))
(PosixPath('var'), PosixPath('_info.yml'), PosixPath('root.md'), PosixPath('root_without_metadata.md'), PosixPath('not_a_page.md'), PosixPath('category'), PosixPath('tmp'), PosixPath('tmp.md'))
in /var/, there's only folders
I don't think var is even used https://github.com/python-discord/site/blob/main/pydis_site/apps/content/tests/helpers.py#L67-L91
pythondiscord.com - A Django and Bulma web application. - python-discord/site
IDK why the error is trying to access it
i think i found it
get_categories iterates over folders in there, and get_category then tries to read the contents
now i just need to figure out why /var is a thing
smells like macos
any newly created fake file system will always have either a directory named /tmp when running on Linux or Unix systems, /var/folders/<hash>/T when running on MacOs, or C:\Users<user>\AppData\Local\Temp on Windows.
The way I see to fix it is to find which directory exists right after the fs is created
And then write the rest of the files into that rather than hard-coding /tmp
I guess we can't simply delete it since the docs say the dir is necessary for tempfile to work
do we need tempfile in the tests though?
Good point. I understood it differently - that pyfakefs relies on tempfile therefore it creates the dir.
But if it's only a matter of whether we need it, then we can probably delete it.
that said, a better solution would probably be putting test data in a sub directory, as the site would handle it
and then adjusting paths as needed
Yeah that's even better than my idea
i'll give it a shot real quick
wait no I actually missed something
# There is always a `tmp` directory in the filesystem, so make it a category
# for testing purposes.
# See: https://jmcgeheeiv.github.io/pyfakefs/release/usage.html#os-temporary-directories
self.fs.create_file("tmp/_info.yml", contents=CATEGORY_INFO)
self.fs.create_file("tmp.md", contents=MARKDOWN_WITH_METADATA)
self.fs.create_file("tmp/category/_info.yml", contents=CATEGORY_INFO)
self.fs.create_dir("tmp/category/subcategory_without_info")
i'll try to see whether i can kill that with the changes, otherwise i'll add /var
You can just move that into the subdirectory
The data itself is still useful, but its absolute path doesn't really matter, as long as it's all relatively the same.
it appears i have opened a can of worms.
okay, i have fixed it in the most painless way i could think of
ya
i thought there was a open issue about python not embedding blob github links, but i cant find it. am i mistaken or just blind?
gunicorn_conf.py line 6
import os```
doesn't it only embed blob links (for github and not gists)
wait
docker-compose.yml lines 29 to 39
tty: true
depends_on:
- postgres
- redis
env_file:
- .env
ports:
- "127.0.0.1:8000:80"
environment:
DATABASE_URL: postgres://pypixels:pypixels@postgres:5432/pypixels
REDIS_URL: redis://redis:6379```
aaaaa
i will just link to a example of it breaking, tho knowing that works makes it more confusing
#black-formatter message
It has a line count limit
well but a link with the same number of lines as that docekr compose link didnt work
let me try again https://github.com/psf/black/blob/main/setup.py#L29-L44
yep
oh hmm
If you specify past the end it just clamps it
Yes. I think it does the same if there are too many characters
maybe it should just show the first few lines?
bot/exts/info/code_snippets.py line 244
if 0 < len(message_to_send) <= 2000 and message_to_send.count('\n') <= 15:```
i think it not working like this is a bit confusing (example: me)
Maybe. I'm not sure what would be better
but at least i now know what the issue i should be making is
I mean, x#123 silently fails
imo if youre not explicitly invoking a command you shouldnt get an error message for it
right, but thats because there clearly is nothing there
for this github links i would embed the first few until the limit is reached
(which would not be a error message, just staying within reasonable limits)
say someone specifies L1-L100 it would only respond with the first like, 15 lines
same for the char limit, it would respond with the number of lines that are under the limit
btw, bot#1609 is now getting merged.
The concern is that the code may not make sense without all of the chosen lines. It may even be a detriment to the discussion. It could also be misleading. A reader may not realise that the author intended for them to see more than what was shown.
there are ways to make it clear, [...] is pretty accepted for "things were omitted"
well see what people think of the issue, im very obviously for showing at least a few lines
I dont know how users will like it in practice so I don't mind trying
discord shows "X more lines" in its file preview, it could be like
bot/exts/info/code_snippets.py line 244
if 0 < len(message_to_send) <= 2000 and message_to_send.count('\n') <= 15:
# some stuff
... # 17 More Lines
@sharp timber Both have been merged, thank you for the PRs!
https://github.com/python-discord/site/pull/510 and https://github.com/python-discord/bot/pull/1609.
\o/ hopefully it works
untested 👀
As far as I can tell from the tests on the test server, there shouldn't be anything wrong.
@vale ibex ty for testing m8
@eternal owl Just in case you didn't see this on GitHub:
https://github.com/python-discord/bot/pull/1269#issuecomment-854817387
@sharp timber would you mind reviewing a PR? If so, this one: https://github.com/python-discord/bot/pull/1487.
@tawdry vapor Do you think moving these functions into a _utils.py file would work out?
The refresh_cache function is called many times from different locations with different scopes afaik, I'm not sure if it's worth refactoring.
https://github.com/python-discord/bot/pull/1487#discussion_r605782782
IIRC the functions were basically identical but I didn't carefully look into the feasibility of detaching it from the class
As for the location, IDK. It's awkward since watch channels and talent pool are in different packages, but the utils are too niche to put in the utils package.
in my experiments with detaching them from the class, I think it would be better if both stayed as methods.
Whose jchrisgit?
Volcyy
Oh
regarding sir-lancebot#745 , the last comment where we would need to make load_extension an async function, should I do that since I think there are some places internally in dpy that call that function.
and it would require some changes in the extension cog too, where we can load extension
oh pride leaders got merged 🎉
#changelog maybe?
I think I'll do sir-lancebot#766 and sir-lancebot#767 since I'm the one who caused those errors lol
sure
for the site, isn't pipenv run pre-commit supposed to fix file new lines for you?
poetry run task lint
It is poetry now
I forget whether it just checks or modifies
pre-commit just installs and setups the hooks ig
yeah
oh, I'm on a branch that doesn't have poetry
guess I can deal with linting after I pull?
Is the branch on fork or main repo? You can update it
it's a branch of one of lemon's branches
so I'd rather pull from his branch when he's ready to get whatever changes are in main
Yeah
@trim cradle if you're on a pipenv branch, it's pipenv run precommit (note the lack of hyphen) to install the hook that fixes newlines on commit
it ends up saying
[INFO] Restored changes from /home/steele/.cache/pre-commit/patch1622908350-60658.
or, for all the context
(site) steele@steele-mint:~/projects/pydis/site$ pipenv run pre-commit
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.
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/steele/.cache/pre-commit/patch1622908350-60658.
Check for merge conflicts................................................Passed
Check Toml...........................................(no files to check)Skipped
Check Yaml...............................................................Passed
Fix End of Files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook
Fixing pydis_site/apps/resources/resources/thonny.yaml
Fixing pydis_site/apps/resources/resources/sololearn.yaml
Mixed line ending........................................................Passed
Trim Trailing Whitespace.................................................Passed
check blanket noqa...................................(no files to check)Skipped
Flake8...............................................(no files to check)Skipped
[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
[INFO] Restored changes from /home/steele/.cache/pre-commit/patch1622908350-60658.
Umm, delete the file from cache and then run it again
(site) steele@steele-mint:~/projects/pydis/site$ rm /home/steele/.cache/pre-commit/patch1622908350-60658
(site) steele@steele-mint:~/projects/pydis/site$ pipenv run pre-commit
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.
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/steele/.cache/pre-commit/patch1622908527-60866.
Check for merge conflicts................................................Passed
Check Toml...........................................(no files to check)Skipped
Check Yaml...............................................................Passed
Fix End of Files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook
Fixing pydis_site/apps/resources/resources/thonny.yaml
Fixing pydis_site/apps/resources/resources/sololearn.yaml
Mixed line ending........................................................Passed
Trim Trailing Whitespace.................................................Passed
check blanket noqa...................................(no files to check)Skipped
Flake8...............................................(no files to check)Skipped
[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
[INFO] Restored changes from /home/steele/.cache/pre-commit/patch1622908527-60866.
Doesn't appear to have mattered
I force committed it, we'll figure it out when we're ready to have poetry on that branch.
Uhh, interesting, maybe try deleting the virtual venv, and then make one again?
I'm good for now. Thanks!
Sure 👍
@trim cradle precommit is doing its job, lol
- files were modified by this hook
but it doesn't always actually fix the files
I'll figure it out before that content ends up in main. We're not even using pipenv anymore
unstage all of your files, pipenv run lint
well yes, but precommit is unaffected
its the same precommit we've had
the simplified difference is just the venv manager
🤷🏻♂️
Fwiw if you have unstaged changes, Pipenv will automatically stash them so it doesn't try to lint the changes that you aren't going to commit. That said, if the unstaged changes conflicts with automatic fixes from the hooks like end-of-line-fixer it will rollback the automatic changes and reapply your unstaged changes. You can see that by looking at the before last log line.
You can either fix them manually or do a manual stash when this happens
^ same goes for poetry
not pipenv, pre-commit itself does that lol
or maybe git does 🤔
@green oriole
Here's your reminder: Try again Akarys.
[Jump back to when you created the reminder](#dev-contrib message)
Bump
poetry run task precommit will install the pre-commit hook
poetry run pre-commit will run the pre-commit check (which only looks at files in the staging area)
poetry run task lint will lint all files in the project.
The end of file fixer doesn't automatically stage the files changed, so you'll need to stage those using git add <path> and then run the pre-commit hook again
Why do they have to use task?
It's taskipy
