#dev-contrib
1 messages ยท Page 33 of 1
If you change the line?
yes, if you commit to the referenced lines the comment is on
it'll show as changed
if it's a suggested change, it'll autoresolve
if it's not, it may not resolve itself and need to be resolved by the PR author
Yeah but it show as outdated not as resolved
yep, so you'd resolve it
Okay got it
if the implementation though is different to the suggested change
i would probably not resolve it
really one should have discussed that though in the comments first
Commenting on it and asking for a re-review of that line would be better
Or yeah, ideally discussing first
If I go with another solution that the reviewer submitted, I don't resolve the conversation, since the reviewer may want to look at it
The reviewer can then dismiss it or not depending on if they're satisfied with the change I've made
but yeah if it's already committed but slightly different, comment saying so yes
resolving should only occur with exact suggested changes really
or simple pokes like this paragraph needs to be spellchecked
spellchecking is important 
I occasionally mark comments with tiny changes resolved as I make the changes locally
as in, before pushing
i think that's fine. the main thing is so long as it's in the correct state by the time you rerequest a review, do whatever
That seems fair
if you're mid-reviews though, avoid force pushing
that throws all the comments out of wack
and can be super annoying
yeah most do avoid it
i use it only when cleaning up before ready for review
once it's review, those commits stay
I pretty much only use it for murdering commits
yep
like happened with the github allauth branch
I had like 3 commits and then the discussion changed to another idea
haha
there technically is cases where it can be unavoidable too
that's true, yeah
git nobodysawthat
haha yeah
we did discuss these things though in the past, it's probably worth putting somewhere easy to find
contrib guide maybe
Yeah, maybe
found what i was looking for. we discussed PR review guidelines back in July. I'll try get that going again to settle them and put them into public resources.
\o/ okay
!remind 1d PR review guidelines.
Your reminder will arrive in 1 day!
!remind new <expiration> <content>
Can also use: add, create
*Set yourself a simple reminder.
Expiration is parsed per: http://strftime.org/*
Something about your input seems off. Check the arguments:
well I think most users use !remind instead of !remind new
New isn't mandatory
!help remind
!remind <expiration> <content>
Can also use: reminder, reminders
Commands for managing your reminders.
Subcommands:
delete <id_>
Delete one of your active reminders.
edit
Commands for modifying your current reminders.
list
View a paginated embed of all reminders for your user.
new <expiration> <content>
Set yourself a simple reminder.
Would longer docstring be displayed here?
Or does it only capture the first line?
Anyway, I think "Expiration is parsed per: http://strftime.org/" is not detailed enough
The infraction commands outline the durations better so that could be copied over for reminders too
That the docstring of the converter
That is interesting that it only shows that first line, though
I don't know if it does that
I was asking
Maybe the docstring is only 1 line currently
!help remind new
!remind new <expiration> <content>
Can also use: add, create
*Set yourself a simple reminder.
Expiration is parsed per: http://strftime.org/*
On the more specific command it'll show it all
But in the summary of all the available ones, only the first
Yeah, for the group it appears to only do the first line
But in retrospect it would not make sense to place it there anyway
Correct. It'd make the embed massive
Well that and it'd only be relevant for one of the subcommands
Something about your input seems off. Check the arguments:
!tempmute <user> <duration> [reason]
Can also use: mute
*Temporarily mute a user for the given reason and duration.
A unit of time should be appended to the duration.
Units (โcase-sensitive):
โy - years
โm - monthsโ
โw - weeks
โd - days
โh - hours
โM - minutesโ
โs - seconds
Alternatively, an ISO 8601 timestamp can be provided for the duration.*
Does it have the same parsing?
Probably yes
Yep they use the same converter
I... don't think it actually does
Hold on
Yeah, it's different
Reminders uses the bot.converters.Duration, where as the infractions uses dateutil.parser.isoparse(infraction["expires_at"]).replace(tzinfo=None)
Unless I'm over looking something
The infractions.py doesn't even import from bot.converters
I mean I'm looking at the file right now and unless it's going some arbitrary way to it, I'm not finding it
I made a union of the duration and a timestamp converter I believe
Ahhhh, okay I see
It's in time
So it's likely that we never made the change to the reminder time conversion that we did with the infractions
We use the same converter for both, the Duration converter
For infractions, we just have the exact ISODate converter in addition to that
Gotcha, my mistake
What about adding a warning when the time looks unusual ? for example 15m looks awkward, since it's 1y3m
It shows the resulting time afterwards so I don't think that's necessary
If it's wrong you can go back and edit it
@long garnet after that change, your PR fails to lint due to these problems:
./bot/cogs/site.py:6:1: F401 'bot.constants.Channels' imported but unused
./bot/cogs/site.py:6:1: F401 'bot.constants.STAFF_ROLES' imported but unused
./bot/cogs/site.py:7:1: F401 'bot.decorators.redirect_output' imported but unused
you might want to set up the pre-commit so that it won't let you commit until lint passes
no problem. here's the relevant guide: https://pythondiscord.com/pages/contributing/bot/
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.
I read it wrong anyway
but I still should I guess
I'll fix it when I'm back, I don't have my actual editor here
I amended and force-pushed since it's just an unapproved PR
Maybe I'm the only person who uses mobile, but to me this looks a bit yuck
- Until discord fixes formatting for mobile do we need the bold link?
- I don't see use for r/python below the link since it's in the webhook name
- Is the /u/ necessary?
I care about the features we have ยฏ_(ใ)_/ยฏ
I mean, the day when there will be only one post per days of the most commented topic, I will care about it (I think I saw an issue about it) :)
That's not what I mean. Even if I'm not interested in the feature myself (although I do look at it personally), that's not an excuse for not caring about a feature we have in our projects.
If we think it's broken, we should fix it
Someone is already working on it I think
In this case, it's an easy fix, add the bolding inside of the link rather than outside
The feature has recently seen an update, these are the daily top posts instead of a daily feed
Oh yeah it has been already merged
So now I care about it :)
The words "upvote" and "comment" can also be replaced by emoji
And the r/python was because the reddit cog is configurable
I think upvote and comment emojis, fixing the bolded URLs (like ves said, it's just a matter of placing the asterisk in the right places and it will look fine on mobile), the u/ before the username and whether or not we need to have the subreddit there are all things that could be interesting.
I wouldn't mind if someone wanted to work on making that presentation a bit better
The r/python is already in the Webhook name, I think we can remove that.
text separated by pipes isn't exactly very hot
I'm working on it, I want to do something mindless for a minute
good
maybe lift upvote and comment graphics straight from reddit?
and then stick'em on an emoji server?
I think reddit has a comment icon in the redesign, not sure about the copyright on that one
maybe fontawesome has great analogues
Someone of us has that font pack
I'm thinking more like
instead of | 16 upvotes | 10 comments | u/funlovingdadguy | r/python we could maybe do something like
16 ๐จ 10 ๐ funlovingdadguy
except with the right emojis.
probably needs a bit of workshopping
and might look better on 3 lines
but maybe not
Hmm, if we are talking about footer you can't use custom emoji there
reddit has these muted gray icons
probably not talking footer, it's not a footer currently I think?
Ah yes it is not footer atm
I'm saying essentially we do these icons, with their respective data, I'm sure we can make that look good.
anyway, just a thought
ves is on the job so I'm sure it'll be good.
ves never half asses anything.
It's not a footer, because we have multiple posts in one embed
Oh, right, those icons are from the redesign of reddit
also not sure about the copyright on reddit logos but while we're throwing ideas out i think it might look nicer with a reddit icon in the username (I'm not sure if this should be a code thing or just changing it in the webhook settings, I think I mentioned it in PR but nothing ever happened)
pretty sure using these logos and icons to literally link reddit posts is absolutely within allowed use.
I agree, by the way, that might be a nice improvement too. @hardy gorge, maybe you wanna include that in your PR
๐
@crude gyro I think we should just set it as the Webhook's default avatar. In fact, done.
yep cool
Can't get it quite right. Feedback would be welcome.
I like that
Not sure how it would look on mobile, but miles better than now already. What does it look like with user on a newline?
i like em on one line..
well.. the username could get very long.. whats the limit?
It used to be 20 chars, but I'm not sure if that still holds
I like 'em below honestly
Potentially better on mobile too since you shouldn't ever have the user icon on a different line to the username
I don't hate that but the alignment is annoying me
But doing a code block like 001 is probably a bad idea too
Think the alignment is something we need to work with; we don't have much control over it
Yeah, you're right
i like the later version. with all in one line and just icons.
people get emojis ๐
It's definitely better I think :>
There are some unicode whitespace characters we could use, but it's just text + emojis in a non-fixed width font
I'm not even sure how to even try to align it
Can't think of a proper way without calculating the spacing from the font
Hmm, removing text? Like removing that comments text
Yeah I like the removed version
I might have a few ideas, but not sure how i could replicate the problem.
I don't think we are going to get it consistent across devices anyway
well.. it uses web-tech. so im thinking to use tab. not sure if that works though
This is with tab characters; they appear as a single space, but are still there if you inspect the raw embed.
how useless
I don't think that looks very bad.
I do wish we could align all the user icons and stuff like that but it's probably impossible to pull off.
can you embed it in a codeblock?
can't put emojis in a code block
@hardy gorge imo it's probably as good as it gets, and a huge step in the right direction compared to how it looks today.
The only thing you can do is what @molten bough suggested, put the numbers in a codeblock between the icons
I can try, but I'm not sure how that will look
Yep, short of finding weird unicode, that's all I can think of
I can think of one highly creative way
nope
never mind
yeah no I think it looks pretty decent though
Inline codeblocks won't work
It will strip whitespace inside of them within embeds
!embed 1 + 33 = 44
1 + 33 = 44
Okay, I think this is as good as it gets
that's hot
!reddit daily
Here are today's top r/Python posts!
Flask Webserver for Google Poly models in AR
18
4
professormunchies
Do you use virtualenv often? I think I might be OVERdoing it.
I create a virtualenv for every single project I start. I like the idea of having a python installation completely isolated...
15
36
I_AM_ALWAYS_ANGRY
Mentoring in programming
Hi fellow programmers, if you're interested in being (obviously totally free) mentored in any programming language or...
7
4
GCProgrammer
I half-scientifically calculated that "r" is indeed the most...
6
0
i-am-qix
Python 3.5.8 final is finally out!
5
1
ExoticMandibles
Very nice
Webhook can't use custom emotes? Hrm
They probably can, just bot those added to other servers I think
I guess that makes sense when you think about it
Yes, I'll try it with "local" emojis manually to see if it works
No, I know that works, because I tested that on the test server
Okay
We have enough emoji slots here for these three
Okay, that fixed it for now.
Sweet
nice!
Would there be any interest in a PR to simple-bulma to add support for buefy?
I'm likely gonna need it in a project anyway, it's basically a combination of bulma and vue.js
as it adds components though, it'd have to be a separate "mode"
@crude gyro You're probably the only one who can say something useful about 
I'd be fine with doing a separate project as well if not
probably fork it to comect and handle the lifecycle myself
iunno, it might sound a bit out of scope
I could see that, yeah
although the stack is interesting
I'm a bit confused as to how this "mode" would work
wanna elaborate?
Essentially buefy is a fork of bulma
it provides its own sass and a whole bunch of JS, of course
it also covers a bunch of stuff we use extensions for, like toggles
sounds like a lot of code then
so I call it a "mode" because it would need to provide those assets instead
yeah, it could well be
maybe you should just do a django-simple-buefy :P
How do you even pronounce buefy
bew-fee
wat
how would you possibly pronounce it like that
Well actually, if dew and due are said the same....
and vue is said "view"
Okay, fair enough
Buefy (pronounced /หbyoอoหfฤซ/, like beau-fy)
I mean unless you'd say that "voo" I guess
okay, I guess so
I think deep down I was hoping for beefy
haha
that's interesting
I could see that
The joy of the Manjaro update dump
bedazzle your website with buefy
bueefy
Yeeesssssss
That wasn't as hard as I thought it'd be
Haha
@glass pecan
Here's your reminder: PR review guidelines..
Jump back to when you created the reminder
So guys what you want me to do for this one? https://github.com/python-discord/site/pull/303
Hi, this PR show the attachments along with the original message in staff logs (https://staff.pythondiscord.com/bot/logs/...). python-discord/bot#630 need to be merged after this one for the featur...
links?
nor on the package registry for us
nvm
we are open source
its at the bottom
not too bad
that is under privatet repos right?
right okay
free for oss
selfhosted: coming soon 
that's just their runners
it's not hosted?
huh
glad they're keeping oss free entirely though
i haven't figured out why we would do it yet but we could do it
Snekbox is a handy one to have a public container for to be fair
so even if gh was an option, it's not likely any different from dockerhub
hm
one thought is
might be nicer if we switch to actions ever to go down the all-on-github route
yeah it's not bad
i use it elsewhere
it's not as ... what's the word
familiar i guess as azure atm
also a lot of helper tasks just don't exist in gh actions
I have a feeling it isn't quite as all encompassing, yeah
but i guess that just comes from being so green
gh actions does get the benefit of being able to reference formulas other people made though
mm maybe
they switched to json syntax now didn't they
You'd sure hope it wasn't json only..
lol
It feels more designed for humans than a lot of stuff
yeah i like yaml
i'm not a fan of some things, like their terminology for things
Yeah, although I only ever see it used for build tools
And sponge plugins, I suppose
oh i like toml as well forgot about that one
Pipfile is toml but you barely should ever touch it
yeah
rust uses toml
yeah iirc pyproject was inspired by rusts usage of it
would be nice if more things supported pyproject
technically anything that's already toml styled you can append to the end of pyproject and it'll work fine
but it's kinda .. not dodgy/hacky
just kinda unclean
because it's not following the actual pyproject syntax
so instead of doing ```toml
[tools.flake8]
blah = foo
you'd just put
```toml
[flake8]
blah = foo
just the same as normal configs for it
and then point flake8 to process pyproject.toml as the config file
@molten bough you use salt right?
Yup
do you also use nginx
Yup!
do you manage your sites-available via salt
ah right
makes sense actually
we do use sites-available
i've got it sorted atm
but i was trying to think of a way to cleanup dangling symlinks in sites-enabled
I don't really see the point when you're already managing everything via salt
If you're not doing that, well.. Never too late!
it's managed via salt, yeah
All my nginx configs are in the same git repo as my salt states
So it's just a case of copy over and reload if changed
But it doesn't handle removing them right now because I just didn't take the time to do that
right, nah i've got the removals set for available
cleanup sites available:
file.directory:
- name: /etc/nginx/sites-available
- clean: true
and the nginx configs are file.managed
with ```yml
- require_in:
- cleanup sites available
Mine are just file.recurse
Although I wrote all this stuff when I was still just learning salt
I still get confused trying to navigate the mess of docs..
i could technically skip the symlinks
and just change the above to enabled
not 100% sure what i'd lose by doing so
Tbh even when doing it myself I still don't use sites-available
If I did I wouldn't symlink it
Primarily because mv is easier to remember the argument order for
Haha
as far as i can see it's only useful if you want to be able to preserve configs while disabling individual sites
our configs are generated
that's not a problem for us
Even better
Mine are not, I should totally do it though since I have like 30 of them
that's actually what i've been working on for the past two days
altering our nginx config generation
testing changes to salt is painful
even more fun is preserving correct yml whitespace with a ton of jinja in between things
worked out ok in the end i think
I'm sure you managed it amicably
too much swearing involved to use that word
Haha
All my salt stuff is here anyway in case there's anything you might want to look at https://gitlab.com/gserv.me/salt/
It's likely way more basic than yours though
It's late anyway so I'm gonna head off
o/ for now
thanks, catcha
removed your message because it sort of exposes a way to circumvent filters
Aha, okay
I did the same thing for the ProtocolSupport server RE JAR files
Have you had a lot of instances of people posting stuff they shouldn't, by the way?
Must be more common here than most places with the size
not a ton, but there's been the rare occasion and recently someone posted a malicious exe
Yikes
yeah, they were banned
it was found really quickly ofc
and then our lovely people added the filter
nods
wonder if they were trying to exploit that recent Discord issue
Discord can't fix that by the way, Squirrel updater doesn't support installation as admin
nah, they just wanted to share what they made for some reason
Huh, okay
well that was.. smart..
haha
Anyway, all good, makes sense to have a filter I think
was something like a forkbomb?
well, we know all about the dangers of forkbombs here
the topic over on #the-pydis-mass-layoffs-lounge still says ABSOLUTELY NO FORKBOMBS
haha
It was a forkbomb!
!otn a absolutely-no-forkbombs
:ok_hand: Added absolutely-no-forkbombs to the names list.
the legacy lives on
what's the story?
A silly one. Once we removed the .exe. they just posted the sourcecode and urged people to use it to prank others
someone posted a link to a PHP shell they were running on their server
and said "BREAK IT IF YOU CAN"
so I broke it
oh
that seems silly
especially considering it's php
which has the security level of a wet paper towel
it was like, a web shell, you could run anything you wanted on the host
php = pretty hostile (to) programmers
no auth
gdude forkbombed a user and the staff got upset because owners probably shouldn't be forkbombing members of the server, even if they were begging for it.
so g had to apologize for his forkbombage
and I changed the topic of staff-lounge to match
People are still trying to break snekbox, but I haven't really seen much creativity there
kinda reminds me of the dude who didn't sanitise a bot command, the arg was handed directly as is to shell execution. turns out the bot was running on root and someone did a rm -R
can't spawn processes anyway
Oh yeah, I remember that one scrags
What's a fork bomb btw?
It's basically a self-replicating process
Because it self-replicates and all those replicants start replicating too, it gets out of hand real quick
The term comes from the line diagram you make
It looks like a fork
if you draw it with sharp lines, you'd get a fork shape
Ah... I was thinking of forks on Github ^^
Oh, I thought it was called that because you're forking processes, like, os.fork
it's actually named after the blink 182 song
yes
not many people know this.
but I suspect the name of creating a fork comes from the diagrams you draw to represent that.
but, I may be wrong, but that's what I read as the origin for both
That's the original diagram that inspired the name, I think, in a 1963 paper
So, the process "forks" into two and it looks like a fork
yeah but. the word fork has meant to split somehting into two for like hundreds of years before that.
so I don't know if I buy that etymology
ahh
It only replicates itself? Messy but useless, isn't it?
At some point I suspect it crashs the computer
because there are suddenly thousands or millions or processes running
yes
even if they're not doing much, no system can handle exponentially more process creations
It seems to come from the tool, but why the tool was called that way, I can't find
Anyway, latin etymology is probably off-topic for this channel
the name fork above probably comes from the "split into two"-meaning, not the shape of the diagram
OS aren't protected against forkbombs?
it's effective but it's also a really shitty thing to do
You can easily limit the amount of processes that can be spawned in Ubuntu and most other Linux distributions by modifyingย
/etc/security/limits.conf
Doesn't seem too complex
yes, but then you can't start any more processes
Ty for all the infos on forkbombs I'll try now
Inside joke noticed and acknowledged. Chuckle protocol initiated.
haha, well it's no longer an inside joke, I guess, explained above
Well then
legacy lives on
how would I test (I'm guessing I need mocks here) code that retrieves stuff from the web?
coughs totally not basing this question off this issue I claimed but now can't do..
if there is a function that gets something from the web > deal with response checking/error handling > builds a representation of the stuff gotten from the web all in one function, the way to go with unittesting would be to break up that function then test each part separately?
yes.
at work we have a nice library for mocking responses but it only works specifically with requests
oh, of course sentry has that, haha
very nice
Yeah, break up the function if it makes sense, and mock out the library calls
being able to structure it as a context manager is particularly nice
I wouldn't mind if we wrote a nice aiohttp requestmock thing that we can use for this so we don't have to do it the hard way every time, by the way kosa.
something like this? https://github.com/pnuckowski/aioresponses
just something that makes it as trivial as creating an instance, feeding that instance the endpoint url and the response you want, and then using the instance as a context manager.
hm, yeah, that looks promising
We rarely talk to aiohttp directly in our codebase, though. We usually use the bot.api_client.method, which is easily mockable with a return_value
ah, that's true.
Yeah most of that communication is handled within discord.py
No, we're talking about our requests to our own api
took me a second as well, haha
I'm not opposed to us adding some testing packages to the toolchain though, if we come across some cool stuff. there are some really excellent ones
this is one of my favorites: https://github.com/spulec/freezegun
yes
Kind of off-topic, but what's our current coverage?
Yeah
20-30 something %?
Branch or line coverage?
I honestly don't know the difference
It's fairly easy
line coverage just keeps track of which lines are executed during the tests
And then calculates the percentage of all lines that got executed
if a line was never executed during testing, it was never tested
However, take a look at this code:
def eggs(bacon):
if bacon:
spam = "ni"
return spam
If, during our tests, we call this with eggs(True), all of the lines in there would be executed and we would have full line coverage
However, there are two paths/branches possible: bacon is truthy and bacon is falsy
If we only call it with a truthy bacon, we don't test the branch/path where bacon is falsy
So, we have full line coverage, but only partial branch coverage
Reminds me of site coverage, which does require doing all the branches too
Yes, bot as well. Both have coverage.py set to branch=True
I've added a section on that to the testing readme for bot
with a link to the coverage.py explanation of it
big recommend
The reddit cog break at the end of the month
Traceback (most recent call last):
File "...\lib\site-packages\discord\ext\tasks\__init__.py", line 68, in _loop
await self.coro(*args, **kwargs)
File "...\bot\bot\cogs\reddit.py", line 133, in auto_poster_loop
midnight_tomorrow = now.replace(day=now.day + 1, hour=0, minute=0, second=0)
ValueError: day is out of range for month```
Ah, yes. This should use a relativedelta instead to add the day
Feel free to make an issue for it
I think it would be a good idea to add the emojis we create to the branding repo. A emoji directory would work well and we could include both the .png we upload and, if available, the svg we used to create it.
They aren't already in?
Not that I know of
There is some in the assets folder, but yeah a lot are missing
is there way to suggest adding a tag or alias
I think there's an issue on the meta repo
Or the meta channel
Yeah there is an issue on meta
ty
Guys, I have three hours before hacktoberfest is completed for me, I want to do a last issue on a pydis project (my 10th contrib) any important issue in mind that need to be solved and that will not take ages?
There's not that many to go through and check what you can handle
Filter tests out and the second half is a manageable amount to check, you know better about what you can handle in that timeframe
Hmm good point
I found one
Not sure if I can finish it but I'm gonna try anyway
If someone can please assign me
I think I'm going to use the bot_setting model (https://github.com/python-discord/site/blob/master/pydis_site/apps/api/models/bot/bot_setting.py) does that seems OK to you?
Assigned
@mellow hare thanks! Any thoughts about using the bot_setting model? Because for now it is only used for the defcon settings there is maybe a reason to it?
I don't really have any strong thoughts about it honestly. Plead your case, how do you think you'd make it work?
Well, we have this model that isn't very used, I don't think this feature deserve a brand new model and it seems to very fit the goal of this model they are runtime settings.
Actually I only need to store two list (one for the tokens, one for the users) and an expiration date
That seems like the wrong model
"settings" to me sounds like stuff you don't change automatically
the user sets them and they're not big lists of things
whereas it seems like this one is purely access programmatically by the bot, especially considering the timing aspect, and commands
so yeah I'd say this probably needs another model
The defcon can't be enabled at runtime?
yes but it's not like entries are going to be automatically added and removed
there's always a single defcon entry
Hmm yeah you're right
btw there is a issue with bot , i am just saying cuz m not skilled enough to help fixing it ,
in the output it don't consider empty spaces
@mellow hare :warning: Your eval job has completed with return code 0.
[No output]
I think that's intentional
no not that
def reformat_(a):
len_a = 8 - len(a)
a = " " * int(len_a / 2) + a + " " * int(len_a / 2)
return a
reformat_("Hii")
It will strip the leading spaces of the first line; is that what you mean?
Yep
wait
that's on me
but it shows it anyway
!e
print(" hello", " goodbye", sep="\n")
@hardy gorge :white_check_mark: Your eval job has completed with return code 0.
001 | hello
002 | goodbye
Huh
!e
print("hello ")
Sorry, but you may only use this command within #bot-commands.
what about after spaces ?
in some cases YES
why?
some conditions like if i want to print | abcd __________
and with end = ""
i do next print
wait its the discord
which strips it
Here's the thing, they're still there in the variable, but they just aren't printed
And there really isn't a feasible way to see white spaces after a string
so what happened i typed a function and wanted to check it , that reformat_ one , and i did it with this bot and was really confused why it didnt worked
This stripping of spaces should not influence the end="" thing
!e
print("A ", end="")
print("B", end="")
@hardy gorge :white_check_mark: Your eval job has completed with return code 0.
A B
def reformat_(a):
len_a = 8 - len(a)
a = " " * int(len_a / 2) + a + " " * int(len_a / 2)
return a
this one
Right, but I'm more saying there's no way to tell if there's more spaces after B
Because it's the last visible character
but after using this function it dont even show first spaces ?
Yeah it strips the whitespace on the first line for some reason
!e
def reformat_(a):
len_a = 8 - len(a)
a = " " * int(len_a / 2) + a + " " * int(len_a / 2)
return a
print(reformat_("Hii"))
@woeful thorn :white_check_mark: Your eval job has completed with return code 0.
Hii
It strips the whitespace of the output variable
So, leading and trailing spaces will be removed
I'm not sure if that's absolutely necessary, someone should experiment with removing it. It's probably there for a reason.
or maybe maybe as python reply with ` at start and end , is throwing it off
Oh yeah ` strip the spaces
It's not an inline codeblock, but a multiline one
this works fine
with both leading and trailing spaces
doesnt bot uses 2 of those `
Oh yeah
No, it uses a multine codeblock, not an inline codeblock
It doesn't have to do with Discord's formatting
hi hell no
!e
print(" I will be flush with the | symbol")
print(" I will not.")
@mellow hare :white_check_mark: Your eval job has completed with return code 0.
001 | I will be flush with the | symbol
002 | I will not.
If it did have to do with Discord's formatting, the output for this would be the same as the prints
Snekbox is Mark's baby, right?
I'm sorry, it's this line: https://github.com/python-discord/bot/blob/master/bot/cogs/snekbox.py#L137
Or who designed it?
The other one comes after the line numbers are added
This is the bot code of snekbox, not the snekbox repo.
conclusion its the bot who is doing it on purpose ? right
I think gdude originally adding the stripping, but mark reformatted the code
(going by the git blame)
Yes, the bot is doing this on purpose, probably to prevent empty lines from being added at the start or end
We have limited space, so that would only take up space and usually isn't relevant
Seems pointless since we have a built in spam reduction
It pares it down to 10ish lines anyway
We only allow 10 lines of eval output, using two of those empty trailing or leading lines is probably not that useful
However, it just means we should not strip whitespace from lines with something on it
True but it'd be accurate to the output
Maybe we can add an option for it?
toggle like system ?
No, I just think we should change the stripping logic to where it doesn't strip leading spaces on lines with actual non-blank output
btw are we gonna get any support for matplotlib , like outputting a image , like spyder does ?
if we dont have it yet
there's wolfram alpha support which I believe does that
I keep forgetting about that cog
Trying to set up a dev environment for playing around with the bot, but I haven't used Docker before and I'm feeling a little lost. I'm on Windows 10, but not a Pro version so I'm not meeting the criteria for Docker Desktop. Should I then go for the Docker Toolbox? These binaries https://download.docker.com/win/static/stable/x86_64/ ? pip install docker? x_x
If you're on a home edition windows, Docker is probably not going to work for you
you'll need to do it without docker
Ah, oh.
I got it working for the site on 7 with gdude's help but bot's being run through pycharm's pipenv configuration
I'm on 10 home and I use a no-docker setup @past falcon
Oh, cool! Was it a hassle to set up? @green oriole
That would be very much appreciated ๐
Was thinking I'd start with just the bot, unless I need the site for that too
You need it to interact with the db
I see. So another fork and clone for me
Yep
You're staff, you don't need to fork
In the meantime you can download postgres 12
Yeah if you are in the org you can clone the upstream
Ah, well I guess I'm doing a bit of a lone wolf setup then ^^
You also need postgres here https://www.enterprisedb.com/thank-you-downloading-postgresql?anid=1256972
Thank you for downloading PostgreSQL, packaged by EnterpriseDB!
Yeah, installing atm
Okay in the meantime we can start configuring the bot
I think I did most of that
Okay you changed the channels, the roles and the webhooks?
I went through this: https://pythondiscord.com/pages/contributing/bot/#requirements
Only snagged an issue at the docker thing
(inside config.yml)
No leave the default
In the env you need to add
DATABASE_URL=postgres://pysite:pysite@localhost:5432/pysite
SECRET_KEY=suitable-for-development-only
STATIC_ROOT=C:/Users/<your username>/AppData/Local/Temp/django```
Environment vars?
Oh yeah you don't need to store it as an actual env var you can add it in the .env
You need to create it
Oooh.
When you launch your script pipenv load the variables inside the .env as actual environment variables
Oh wait
My bad I mixed things up
I gave you the env of the site not the bot
Ah, I'll move those to the site folder then?
No worries! Thanks for the taking the time =)ยจ
So postgres
This is taking me through quite a few things that are new to me. I tend to stick to my comfort zone of solving fun code puzzles ^_^ Anyhoo. Got a site .env, got my postgres - leaving my bot token as a real envvar for now
Open the start menu and search for pgAdmin
Gotcha.
Oh before that you can type your bot token and BOT_API_KEY=badbot13m0n8f570f942013fc818f234916ca531 in the bot .env
Uh hm, do I have both a BOT_TOKEN and a BOT_API_KEY?
I'm not sure where to find that API_KEY. Discord gives me client id, client secret, bot token
the api key comes from the site
look at the compose file for it
for the bot
I mean
Yeah
Right click on the user icon in the left bar and click new
Then name that new user pysite
Make it admin (it a switch in the security tab I think)
And in security set the password pysite
?
Anyway
Uh, hang on. I think I'm making a group role, not a user
...but that's also the only thing I see that I can create
Create it and I think it actually create an user
Perfect
Now right click on database and then click on create
Name it pysite and I think you can choose the database owner?
Yupyup
Then choose pysite as the owner and create it
So far so good
Okay
I think we are ready to go!
Try pipenv run python manage.py run --debug in the site folder and go to http://pythondiscord.local:8000/
(well you need to wait a bit of time until the server start)
(assuming you changed your host file)
I have interacted with very few host files recently ๐ I also haven't fixed the pipenv on the site, so installing some packages now
Yeah, doing that
Or you are going to get an error on pyuswgi
You are sure it is installing the dev packages?
I ran the pipenv sync --dev, so I would hope so
Oh okay I thought pipenv was self installing it because you started the site
Ok, now what's this host file thingy
There was a note on it in the contributing guide
Okay so
Open the start menu, search for notepad, right click and select run as admin
Next use ctrl + o
Type C:\Windows\System32\Drivers\etc\hosts and press enter
Then add
127.0.0.1 pythondiscord.local
127.0.0.1 api.pythondiscord.local
127.0.0.1 staff.pythondiscord.local
127.0.0.1 admin.pythondiscord.local```at the end of the file
Yeah on phone I saw them with one per line
But they wasn't
No you're right, clarity is important ^^
Site is running!
With site running?
run whatnow? Missing something there I think
Missing something? Why?
The bot should post some log and stop around user sync finished
BTW we should add a proper "I have started" message
pipenv run start --debug
(I said it)
You forgot the start bit
Oh my bad
Stuff happening now! Hitting a snag on the yaml file though, but think I can squash that
The start commands are so wordly
Sed, if you look in the pipfile at the bottom you'll see a variety of commands you can use through pipenv run
You might want to run the precommit one to make it easier to do linting before making a commit
I always forget to do it otherwise
You have test coverage lint precommit and all that kind of crazy stuff
Oh yeah precommit
Very important one ^^
just remembered, would it be possible for the precommit to only run on things that are added in that commit?
That's what it does
(and so they are at the end of the pipfile. I always asked myself where they were)
It picked up some test files I had laying around in the folders
The alternative is manually syncing the pre-commit config with everything else, which isn't desirable
Yeah it stash them before running the test
Hitting some connection errors, but I gotta do some dinner-related errands. Gonna hafta look at it later. I muchly appreciate the help so far @green oriole Making big progress here ๐
You should consider expanding on that contribution guide for windows nurbs like me
Oh. Well, +1 on the suggestion from me.
We did not?
Pretty sure that's not true
Let me find it back
Oh well, no staff responded
Sure but considering not everyone has the same system we might have to take them in piecemeal and fix any discrepancies
I wanted to write a no-docker win 10 all in one guide
lemon did say he was interested
I even created an outline of the guide https://docs.google.com/document/d/13ee_G71SypP5nJj4RS8gpVaQMnL9qxTRI6gT3eOG0m4/edit?usp=drivesdk
He did?
@mellow hare Sure, but the biggest issue is docker and it's perfectly possible to provide a guide that works without docker (but maybe has an optional docker part for people who want to use it)
I think there should be a guide special no-docker because of the additional step it had, like manually setuping the database @hardy gorge
@green oriole What I meant was that if docker is that problematic for a large group of (potential) contribs, because it doesn't work well on Windows 10 Home, then our main guide should not say "use docker; it makes things easy". Instead, we should probably have a robust guide without docker as the main guide (if that's the solution to those problems) and have docker as the additional guide.
However, this is probably topic that's going to trigger some debate, since some people really like our docker set-up
So, it's not something just a few people should decide
What's the value added by docker, since there is already pipenv to properly set the dependencies?
Docker makes setting it up even quicker
As well as updating the setups and what have you
Maybe just a clear distinction at the beginning of the docker guide "if you are on win 10 home see this guide instead"
Tbh I just recivied my raspberry pie and I'm going to do a no-docker setup even if I could have used it
I don't think it make things easier
But that's just my opinion
You don't think docker makes things easier?
Yeah
Have you gotten it to successfully work on the rpi?
Do you have any particular reason for that?
well, certainly not on windows at least so that should be covered in some way
Why not on Windows?
Correction, not on Windows 10 Home
Because Docker does not work on that version since it requires...
What's the word...
No I don't really see any point in it
I just received it @mellow hare I will see tomorrow
That's the same as doing a normal setup and you need to work around docker
It just add restrictions imo
The fact that it made my lost my mind and two days of my life @woeful thorn :)
What restrictions does it add?
because it took me 2 days to get it running, lack of resources online for looking up things yourself
(all my message are in the wrong order thanks internet connection)
10 Home does not have Hyper-V functionality
And so it can't properly run Docker. That's something that they mention in their setup (the docker folks being the they)
@woeful thorn the fact for example you need to configure the bot and the site to be able to communicate
?
The fact that it take 10 minutes to shutdown the container
It doesn't
Yeah neither of those are true
If we're going to say "don't use docker" for anything that isn't Windows 10 Home then we need real reasons
Yes you need to add the compose project or something
Not "I don't like it"
Well I'm pretty sure, "It doesn't work" is enough of a reason
It does work lol
It doesn't take 10 minutes but it take something like 20 seconds
Sorry, maybe it's Docker-Compose that doesn't?
I agree
didn't manage to get it working for the bot
20 seconds you don't have to wait without docker
Either way, it's something crucial for it to function
@green oriole You can safely kill it and it takes 2 seconds
And true ELA, you CAN get it working on Win 10 Home, but it would require either a VM or WSL
I'm not talking about just Windows 10 Home
And at that point, you might as well use the other option
This is the context
As is Docker for 10 business or pro
if we're talking about docker on xyz windows versions
pro: yes, full hyper-v available
I totally understand that some people prefers docker, I just don't like it
home stable: yes, barely, for now
So yes, I agree that the guide shouldn't be swapped over to not suggest docker
home insider preview: nope
Wait, home stable has Hyper-V?
no
you can use docker toolbox, which spins up a virtualbox VM
Gooooooootcha
there's a problem with this though
WSL2 is the problem
in order to facilitate it, home is going to include some select parts of hyper-v
not enough to run docker proper
but enough to break virtualbox
meaning neither solution will work
So for practical purposes, it's not a good fit for 10 Home
Pretty much