#dev-contrib

1 messages Β· Page 166 of 1

brisk brook
#

Ah perfect, when I was last going around and checking in on the PRs I had left to review you already had changes requested.

#

I think I'll have time to review it tomorrow unless someone else gets before me - you only need one staff approval (since Wookie already approved)

austere hornet
#

I'd also like core dev approval (or disapproval) on sir-lancebot#989, sir-lancebot#1000, and sir-lancebot#1018 (sorry if I'm being annoying about it)

cold island
#

Approved the topics issue

#

and assigned you since you checked the box

austere hornet
hoary haven
#

@vale ibex hey the last 2 times that we ran out of dormant channels recently, did the bot create new dormant channels? then what gives us the ping in #helpers ?

cold island
#

No it doesn't

#

We're just out of channels

hoary haven
#

is it bc we're already at max channel 42?

cold island
#

yeah

#

It will create new channels if we up it

hoary haven
#

and if we had say 35 channels, it would create up to 7 more dormant channels before a helper ping

cold island
#

yeah

#

Or well

#

no

#

It would still ping I think

#

But it would create a new channel

#

hmmm I might be lying

#

It might create the new channels immediately on startup

hoary haven
#

i'm testing right now

#

it seems to just create dormant channels and isn't pinging helpers

cold island
#

immediately, or only when you run out?

hoary haven
#

that happened after i claimed a bunch until i had 0 dormant

vale ibex
#

the check is when the cog tries to pull a channel to available

#

if there isn't one in dormant, it will make a new one and put it in help available

hoary haven
#

right and pydis already has a total of 42 channels in rotation?

vale ibex
#

if it couldn't make a new one, due to being at the max, it pings

vale ibex
#

.love 528937022996611082

dusky shoreBOT
#
πŸ’— You seem like you are good friends πŸ’—

Chrisjl#2655 ❀ Sir Lancebot#9543 scored 44%!
​

A letter from Dr. Love:

The chance of this relationship working is not very high, but its not that low either. If you both want this relationship to work, and put time and effort into it, meaning spending time together, talking to each other etc., than nothing shall stand in your way.

vale ibex
#

This embed still recommends you sub/unsub with the deprecated way

#

someone feel free to PR an update to the embed footer here, to tell people to use the !subscribe command instead

magic arch
#

On it, seems quick and easy πŸ‘Œ

dusky shoreBOT
trail pilot
#

Hm so quick question, I'm using LinePaginator.paginate and it sends the embed but it doesn't seem to paginate it

#

with the reactions and what not

#

code is

list_embed = Embed(title="All Trivia Night Questions")

        if len(question_list) <= 5:
            list_embed.description = "\n".join(question_list)
            await ctx.send(embed=list_embed)
        else:
            list_iter = iter(question_list)

            await LinePaginator.paginate(
                ("\n".join(grouping) for grouping in zip(list_iter, list_iter, list_iter, list_iter, list_iter)),
                ctx,
                list_embed
            )

(apologies for the indentation)

trail pilot
#

found out the issue!

fallen patrol
#

@patent pivot why is #dev-log dead again?

#

cf ban again?

patent pivot
#

Β―_(ツ)_/Β―

#

uhhh

fallen patrol
#

discord: use http interaction bots, you can host them on cf workers
also discord:

patent pivot
#

what repo

patent pivot
#

http interactions are called by discord, not the other way

#

there are some 429 errors from earlier but nothing huge, last successful hit of the worker was at 19:56, not sure what repo you are on about

fallen patrol
#

smh you don't think that http interaction bots use the REST api?

patent pivot
#

right yea cloudflare have banned cloudflare workers again

#

not much we can do

#

i'll speak to someone if i get time

fallen patrol
#

i know how they work

patent pivot
#

what time did they block access last time

fallen patrol
#

i don't remember

patent pivot
#

similar time by the looks of it

fallen patrol
#

!snf 933888214266150912

stable mountainBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

patent pivot
#

I wonder if we're getting affected by geo balancing

#

lol

#

nice

fallen patrol
#

geo balancing?

patent pivot
#

americas are more online in this time window

#

that means more requests through cloudflare

#

which means higher chance of anti-spam trips

fallen patrol
#

ah lmao

patent pivot
#

oh - might be the UK actually

#

not sure where hookshot sends from

fallen patrol
#

hookshot?

patent pivot
#

oh

#

uh

#

internal naming

#

hookshot is the github microservice they use to send webhooks

#

if you look at the user agent of any gihtub webhook request you'll see User-Agent: GitHub-Hookshot/6aef237

#

or something similar - based on the currently active revision

#

i'll go open a ticket to fix this

#

okay i've passed a message on to discord

#

will update here if someone replies

fallen patrol
patent pivot
#

discord developers

#

oh wait, it is a private channel yeah

fallen patrol
#

by private channel its the lib dev channel right?

patent pivot
fallen patrol
#

πŸ€”

#

how many are there

#

oh that channel

patent pivot
#

oh

#

uh

#

3 or 4

#

for different topics

fallen patrol
#

ah okay

#

Who do you ask for that lib dev role again? iirc its Mason?

brisk brook
patent pivot
#

might open an issue one day

magic arch
#

is it already known that the bot errors when you try to get the source of a tag?

#

!src resources

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'

sleek steppe
dusky shoreBOT
magic arch
#

awesome, assumed it was already spotted at some point

austere hornet
cinder forum
#

How did pydis bot get coverage badge?

vale ibex
stable mountainBOT
#

.github/workflows/lint-test.yml line 128

run: pytest -n auto --cov --disable-warnings -q```
vale ibex
cinder forum
cinder forum
vale ibex
#

I am not exactly sure on that one

#

I think coveralls may be pulling that data for us on action

#

with coveralls cloud

#

I know on the site we have specific actions for it, since was want to to be a status check in PRs

vale ibex
#

@trim cradle not sure if you noticed or not, but the linting failed on your PR due to trailing spaces.

#

I've approved the changes already, since they look good. But the PR will be blocked until that's fixed

#

site#653

trim cradle
vale ibex
#

Yea, github tends to add whitespace on ends of lines 😦

cinder forum
gritty wind
#

The badge is outdated, we haven't actually been keeping track of coverage since september. We've been moving away from requiring tests for a while anyway, but we removed coverage upload when coveralls had a multi day outage

Here's the commit that removed it, you can see we were using coveralls to ship it before.

#

cc @vale ibex

#

!pypi coveralls

stable mountainBOT
gritty wind
#

if you're wondering how the dates line up

gritty wind
trim cradle
#

@vale ibex I fixed the trailing spaces, but I hadn't noticed your comment about apt-get.

#

the PR is ruined now.

hoary haven
#

is lance down?

#

.help

brazen charm
#

looks like they're all down

rapid swallow
#

!help

hoary haven
#

ok we've alerted devops ty

austere hornet
#

Oh wow all the bots are down....is this the first time that's happened that they all go down at once? ....how odd

patent pivot
#

if host goes out all bots are goint to go down lol

#

yea nasty networking problem it looks like

magic arch
#

Netcup switch when??

patent pivot
#

lol it's a very gradual migration, we'll be on linode for a while

#

this is just an unfortunate networking thing

sharp crag
#

Can I ask what the pydis forms project is? Sounds pretty interesting to me and I would like to contribute, but not sure exactly what it is as of now haha

#

Ohh

hoary haven
#

we have 2 repos related to forms afaik, one is front end and one is back end

sharp crag
#

Rather than the third party form providers? Interesting

hoary haven
#

it's one of our more newer projects

sharp crag
hoary haven
#

and will be ready for contribution very soon (cc @gritty wind @thorny obsidian)

magic arch
sharp crag
#

Fancy! I'll go take a look at the code and see if I might be able to do anything :p

#

Ah sort of like an API

#

To glue the front-end and back-end I guess you could say

magic arch
#

And the front end is all a single page application iirc

sharp crag
#

πŸ€” Interesting, assume that's the backend repo

magic arch
#

I think it’s https://git.pydis.com/forms-frontend and https://git.pydis.com/forms-backend (on mobile so hope I got those right)

GitHub

Frontend for Python Discord forms. Contribute to python-discord/forms-frontend development by creating an account on GitHub.

GitHub

Backend for Python Discord forms. Contribute to python-discord/forms-backend development by creating an account on GitHub.

sharp crag
vocal prairie
sharp crag
#

Awesome! Love TypeScript personally

patent pivot
#

linode coming back

sharp crag
#

Looks like I can make a PR, I think maybe because I have write access? Anyway not really planning on making a contribution right this instance

#

Well it's the only one I have so most likely

vocal prairie
#

You can always bother someone in #dev-forms if you have any questions

sharp crag
#

Hehe, I'll get acquainted with the code since I haven't worked with React in a bit, I mostly do Next but Next is pretty similar to React so shouldn't be an issue

#

Yep

thorny obsidian
sharp crag
#

πŸ‘€

thorny obsidian
austere hornet
patent pivot
#

all services back

magic arch
patent pivot
#

hmmm

#

!c r bot.exts.help_channels

stable mountainBOT
#

:ok_hand: Extension successfully reloaded: bot.exts.help_channels.

patent pivot
#

odd

magic arch
#

fix it ansible man πŸ˜‚

patent pivot
#

yea, i'm trying

#

user_id none is not a snowflake

#

huh

#

think i need to reset the redis cache

#

restarting bot

magic arch
#

jeopardy theme song plays in the background

#

also doesn't work on close right now, probably an error, not sure if that info helps

patent pivot
#

error with claimants

#

won't be immediate, but have a fix in mind

magic arch
#

πŸ‘Œ

magic arch
#

amazing ty

placid ermine
cinder forum
#

In bot why not separate lint and Testing?

#

GitHub actions

static canyon
#

I don't see the harm in having them together

cinder forum
#

We could lock merges by adding rule test must go stonks

#

Also why not?

static canyon
cinder forum
#

Ah so it was just a wim aight

static canyon
vale ibex
#

lol yea what tizzy said

cinder forum
#

Lint errors flashback intensifies

trim cradle
#

@vale ibex thx bb

vale ibex
#

πŸ˜„

trim cradle
#

what other things can I reword. will it ever stop?

vale ibex
#

everything, no

trim cradle
#

fuck

vale ibex
trim cradle
#

noooooooooooooooooooooo

#

pretty sure this is sentdex

vale ibex
#

it is, but it also looks fine for me

trim cradle
#

why does it work for you
homophobia?
wow

vale ibex
#

does that load for you?

hoary haven
#

hm we're using imgur to host these images?

vale ibex
#

That's not a rule no

#

I'd prefer we didn't tbh

#

not sure why this one in particular does

austere hornet
#

What does this mean?

#

Do I need to upgrade my Python version? Right now I have 3.9.6 so probably not

#

I'm lost as to why I'm getting this message. This is in Github Desktop btw when I try to commit to a branch on my fork

#

It looks like python doesn't even exist on my machine according to this but I highly doubt that because py --version in Command Prompt gives me 3.9.6 so I have no clue whatsoever what's going on

austere hornet
#

Would appreciate some help with this. Thanks!

fallen patrol
#

notice the differences

#

you use py to run it but the error is python

#

additionally you're on windows and its trying to use a non-windows python interpeter

#

idk why atm tho

austere hornet
fallen patrol
#

essentially windows is wonky

#

and git on windows is even more convoluted

#

i believe it packages its own version of python with itself on windows

austere hornet
fallen patrol
#

i don't know, i don't use the products in this environment that you're having issues with

#

you don't need to uninstall, no

magic arch
#

If I understand it correctly, py is basically a separate "launcher" program that acts as a runner/launcher for actual Python installations, it comes with Python installations

fallen patrol
#

to anyone who helps, the error is focused on /usr/bin/env which doesn't exist on windows

magic arch
#

Now that part, that's weird, and GH Desktop settings are pretty simple iirc so I doubt there's something there to fix it

austere hornet
austere hornet
magic arch
austere hornet
magic arch
#

Sounds good, and if that doesn't work it might be worth asking in other communities if you don't end up finding help here. Seems to be more a Git/GH issue than Python.

austere hornet
dim pelican
#

Could be due to git bash using unix like folder structures?

austere hornet
dim pelican
#

I think the git bash / drive is actually C:\Program Files\Git. But since the issue seems to be with the desktop app I'll be a bit useless as I tend to avoid using it

austere hornet
#

Alright, thanks!

austere hornet
#

Not sure why I would not have permissions since my user account on my machine is an administrator, if you know what I'm talking about

#

I kinda worked around this for now cuz I'm completely lost at this point. I just edited the file on the Github website instead of in my editor.

#

sir-lancebot#1022 is ready for review!

dusky shoreBOT
magic arch
#

Yeah now I'm even more confused and have less of a guess as to how to fix it πŸ˜‚ sorry, wish I could help more

austere hornet
austere hornet
# dusky shore

@hoary haven Just wanted to check with you before I commit my changes to the #pedagogy PR. What do you think about these?

  • What is the best way to teach/learn OOP?
  • What are some reasons we might want to teach programming?
  • How important is it for a programmer to learn some amount of assembly?
  • What are some basic concepts that we need to know before teaching programming to others?
  • What are the most common difficulties/misconceptions students encounter while learning to program?
  • What are 5 pedagogical approaches that can be used to maximize learning?
  • How do you teach programming effectively?
hoary haven
#

i'll defer to @trim cradle on these, i think he'd have better judgement on what topics would work better in this channel

trim cradle
#

Hello, I am Stelercus.

hoary haven
#

@tawdry vapor i pushed that last re-wording in site#624 btw. i was gonna wait til someone else reviewed it since it was such a small update but i guess it's fine. what is the protocol/procedure for resolving review threads? do i comment with a link to the commit? do i hit the resolve button or wait for the reviewer to do so?

dusky shoreBOT
trim cradle
#
  • What is the best way to teach/learn OOP? βœ…
  • What are some reasons we might want to teach programming? β˜‘οΈ I would restate as "What benefits are there to teaching programming to students who aren't training to become developers?"
  • How important is it for a programmer to learn some amount of assembly? incident_unactioned redundant
  • What are some basic concepts that we need to know before teaching programming to others? βœ…
  • What are the most common difficulties/misconceptions students encounter while learning to program? βœ…
  • What are 5 pedagogical approaches that can be used to maximize learning? incident_unactioned too general
  • How do you teach programming effectively? incident_unactioned that is the whole topic of the channel
austere hornet
short snow
#

"How do you make learning programming fun for your pupils?" maybe? or something on those lines

wild prism
#

what makes a good beginner project?

austere hornet
austere hornet
austere hornet
trim cradle
trim cradle
austere hornet
austere hornet
#

Done

tawdry vapor
hoary haven
#

have you seen the way gitlab does it? review thread automatically shows new diff in the thread once changes are pushed

tawdry vapor
#

No, I haven't seen that. I haven't really used GitLab since 2018.

#

That can work sometimes. Other times, there may be necessary changes to parts of the code that are far away from where the comment was left, or even in a different file. So I'm not sure how it'd handle that.

hoary haven
#

mm

brisk brook
#

@stable mountain uses Prometheus for logging yeah?

#

I have a faint memory of someone saying that. Looks to be that something called stasd is used?

vale ibex
#

Yea we use statsd

#

we use prom for monitoring, and graphite for looking/keeping the statsd stats

brisk brook
#

Ah, Prometheus looks at uptime

vale ibex
#

Yea, we've got a bunch of stuff in prom, mostly devops monitors

#

like cputhottling, highcpu, nginx4XX reqs etc

brisk brook
vale ibex
#

we hook graphite to grafana

#

so the statsd client actually sends to graphite

brisk brook
#

Ah, okay makes more sense

vale ibex
#

joe wrote a pretty nice async transport layer for statsd too

#

pretty simple too, which is great

brisk brook
#

Yeah I saw that!

patent pivot
austere hornet
#

Would appreciate a review or 2 on sir-lancebot#1022, thanks so much!

dusky shoreBOT
hoary haven
#

any takers for bot#2073 for a very smol PR? it would help our moderation team

molten perch
vocal prairie
#

I believe that was on purpose, because it is a pain to deal with unresolved IDs on mobile.

hoary haven
#

yeah, and side benefit is that we'll see both the username#discrim and nickname now

#

other options were

  • a large thumbnail on the right hand side, but in the event that someone had a very inappropriate pfp we didn't want to highlight it so much
  • a footer pfp icon
vocal prairie
#

btw, I think this would also require changes to bot#2021 too

dusky shoreBOT
short snow
#

yeah, just gotta merge to upstream

#

and yeah i will get back to it soon

molten perch
short snow
#

just curious, when are avatar.url None?

hoary haven
#

uh let me look up the docs

molten perch
#

If the user does not have a traditional avatar, None is returned.

#

From the docs.

short snow
#

ah ok, thanks πŸ‘

molten perch
#

No worries πŸ˜„

hoary haven
#

or is this smth in our code

hoary haven
#

ok let me explore this, i'll make an account w/ no pfp

#

yuuup

#

hm for such a small PR it probably doesn't matter much, but when the PR author resets and force pushes to maintain a cleaner commit history, github doesn't really indicate that previous approvals should be re-evaluated

so how does that work in bigger PRs?

gritty wind
hoary haven
#

or once it's in a PR it shouldn't be done like this?

gritty wind
#

There is an option to dismiss reviews on changes though

hoary haven
short snow
#

not really, i would use rerequesting reviews

#

on the right side bar

hoary haven
gritty wind
gritty wind
#

To argue the counter, automatic dismissals will dismiss regardless of the content of the change. Changed punctuation in a docstring? Dismissal. Rewrote the entire PR? Dismissal

hoary haven
#

mm

gritty wind
#

We don't have a nice middleground here. We could technically write our own solution to do something like dismiss on the size of diff or whatever, but even that is a bad metric

hoary haven
#

this is a fascinating topic lol

molten perch
#

@hoary haven If you don't hate me enough, it should be message.author.display_avatar.url πŸ˜…

hoary haven
#

uhh why did it work without the .url

molten perch
#

Not sure, it's used with url everywhere πŸ˜„

vale ibex
#

str(Asset) always returns the cdn url

#

.url is more explicit though

hoary haven
#

no problem, please nitpick on everything lol. i'm gonna be a pro at this resetting thing by the end of today

molten perch
hoary haven
#

we do use .url elsewhere

vale ibex
#

!zen 1

stable mountainBOT
#
The Zen of Python (line 1):

Explicit is better than implicit.

molten perch
#

Yep, so at least for the sake of consistency it would be good if you could change it.

#

(and I'll approve ofc. :D)

hoary haven
#

yup 1 sec

molten perch
#

Merged πŸ‘Œ

hoary haven
#

meow3c thank you!

cinder forum
#

Pls gib source code if source and resource command I can't find em

#

GitHub link is fine

vocal prairie
#

It's loaded as part of the tags command

hoary haven
#

are there already improvements planned for the .epoch command? i quite like it.
things like adding support for .epoch in 10h as opposed to .epoch in 10 hours

#

also currently .epoch in 1 hour doesn't work (have to do .epoch in 1 hours plural)

austere hornet
#

cc: @summer garden since you were working on that command I believe ^^

summer garden
hoary haven
#

oic

summer garden
#

The other big shortcoming is the lack of support for parsing of named timezones, eg PST

hoary haven
#

being on this server has forced me to memorize many of those offsets from UTC haha

gritty wind
#

The named timezones are kind of meh

#

They aren't unique

#

AST stands Atlantic Standard Time, as well as Arabian Standard Time

#

I know this because I was in AST, and sometimes you'd run into stuff like that

#

UTC offsets are superior in that regard

hoary haven
#

and no one i personally know switches between EDT/EST depending on time of year... i just always say EST

#

daylight versus standard

#

e=eastern

placid ermine
#

Abstract Syntax Trees and Binary Search Trees, my favourite timezones

vale ibex
#

isn't BST British summer time?

#

then GMT is Greenwich mean time

vocal prairie
#

timezones are fine, daylight savings time is stupid

obsidian patio
#

@placid ermine your requested changes on sir-lancebot#988 have now been addressed

dusky shoreBOT
obsidian patio
austere hornet
#

Haha I mean it's just an opinion after all. I personally think the same as dawn

trim cradle
obsidian patio
#

If anyone wants to click the green button below sir-lancebot#988

dusky shoreBOT
obsidian patio
brazen charm
#

They won't run if there are conflicts

obsidian patio
#

Ah, didn't even see the conflicts

#

How do I most easily fix the poetry lock conflicts?

brazen charm
#

resolve the pyproject.toml conflicts if there are any and relock

placid ermine
#

if i wanted lance to do something at a fixed time every day, how would i go about it
one thing i thought of was to have a @tasks.loop(hours=24) on the task; then when the start command is invoked, i get the time until the config'd time, sleep for that duration, and start the task

#

but that feels quite janky

#

also might bork if its redeployed in between or smthn

obsidian patio
brazen charm
rapid swallow
placid ermine
#

to tasks.loop?

rapid swallow
#

Im trying to find it in the docs

placid ermine
#

hmph

magic arch
gritty wind
#

We never removed it because it never really mattered, and it was forgotten over time

#

If you want to PR it, go for it

magic arch
#

I just figure there's no reason to keep around an extra dependency πŸ€·β€β™‚οΈ

magic arch
dusky shoreBOT
gritty wind
#

Could you remove it from the Readme too

magic arch
#

for sure, one sec

#

boom, done

fallen patrol
#

@gritty wind is coverage used too or does it make sense to remove that as well?

magic arch
#

@thorny obsidian (cc) mentioned in a staff channel that coverage reports are still useful, just not uploading them to coveralls

gritty wind
#

It’s 50-50

#

We don’t use coverage for anything explicitly atm, the whole reworking testing thing has gone silent

#

But at the same time we can keep it till we figure out something

stable mountainBOT
#

await discord.utils.sleep_until(when, result=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sleep until a specified time.

If the time supplied is in the past this function will yield instantly.

New in version 1.3.
short snow
#

There is no specific utility function for that, so you would need to use sleep_until in a task loop

placid ermine
#

hmm interesting

#

thank you

placid ermine
#

oh nice

#

yoink

vale ibex
stable mountainBOT
#

bot/utils/scheduling.py line 63

def schedule_at(self, time: t.Union[datetime, Arrow], task_id: t.Hashable, coroutine: t.Coroutine) -> None:```
vale ibex
#

Which could be ported to bot-core and then used by both

fallen patrol
vale ibex
#

The urls are 404ing, refreshing won't help πŸ˜„

fallen patrol
#

o

vale ibex
#

but none of the important links work

#

couldn't find any objects.inv files

#

πŸ™ƒ

#

I'm hoping it's a bad deployment and they'll fix it themselves in a bit

fallen patrol
#

objects.inv is at that path ^

vale ibex
stable mountainBOT
#

Package scipy has already been added.

vale ibex
#

oh, it doesn't replace

#

!help docs

#

!docs deletedoc scipy

stable mountainBOT
#

Successfully deleted scipy and refreshed the inventories.

vale ibex
stable mountainBOT
#

Added the package scipy to the database and updated the inventories.

vale ibex
#

!d scipy

stable mountainBOT
vale ibex
fallen patrol
#

!remind 24h nump docs fixed?

stable mountainBOT
#
Absolutely!

Your reminder will arrive on <t:1644319920:F>!

fallen patrol
#

wait isnt that supposed to be disabled

fallen patrol
vale ibex
#

!docs deletedoc numpy

stable mountainBOT
#

Successfully deleted numpy and refreshed the inventories.

vale ibex
stable mountainBOT
#

Added the package numpy to the database and updated the inventories.

vale ibex
vale ibex
#

I saw a load of questions about it but haven't read myself

fallen patrol
#

I know that there was something about them not being dropped off and that the impl was poor because it requires member cache and other things

#

idk

vale ibex
#

so is the fix just use get or fetch?

fallen patrol
#

@gritty wind remind 24h numpy docs

vale ibex
#

If so, we already have a helper func for that, so it's about 2 loc πŸ˜„

fallen patrol
#

not sure, because that would be a lot of fetches....

#

idk I can look at it later, I have a lot on my plate as it stands

vale ibex
#

it would be one for each person that has a reminder right?

fallen patrol
#

not just pydis related anymore, either

#

yeah

vale ibex
#

since a fetch then adds to the cache

#

Yea, maybe even adding like a 5s asyncio.sleep before doing that could help πŸ˜›

fallen patrol
#

it depends on how you fetch afaicr

vale ibex
#

it's not crucial that reminders get sent the instant the bot starts up

fallen patrol
#

if you fetch a user I don't think it saves

vale ibex
#

so waiting a bit before fetching from DB and sending is fine

fallen patrol
#

if you fetch a member it miiight save

vale ibex
#

gives the cache some time to populate

fallen patrol
#

speaking of cache

#

there's a bug in dpy which if fixed could speed up chunking about 2x times πŸ‘€

vale ibex
#

wait, isn't the a flag we can use to see if the guild member cache is chunked?

vale ibex
#

I guess we could do guild.member_count == len(guild.members) lol

fallen patrol
#

we have been testing it on a large bot for a week now, gonna add the fix to our fork soon

vale ibex
fallen patrol
#

or wait

#

it will be

vale ibex
#

Yea, member_count isn't based on the cache

#

but member cache only populates online members afaik

fallen patrol
#

member count is a property that uses guild.members

#

IIRC

vale ibex
#

!d discord.Guild.member_count

stable mountainBOT
#

property member_count: int```
Returns the true member count regardless of it being loaded fully or not.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
vale ibex
#

It's the first line that made me think it didn't

#

since if it works without being fully loaded, then it must use something else

fallen patrol
#

viewed the source

#

it uses the api supplied count if it exists but falls back to len members

vale ibex
#

Ah cool

#

Ah yea, member_count? * integer total number of members in this guild

#

from discord api

patent pivot
#

good morning gamers

vale ibex
#

you're up early

#

it's not 8pm

fallen patrol
#

yeah the api is wack

patent pivot
#

thanks man i went to bed early last night

#

11pm bedtime, woke up at 3am to make curry and then went back to bed

vale ibex
#

lol

#

Do you have a moment to talk about your lord and saviour graphite?

#

this is unacceptable, the person who caused the bot to report 0 members to statsd should be dealt with

patent pivot
#

i do

#

th anks

#

i wrote this

#

i will fix it

vale ibex
#

lol it was me that caused the issue πŸ˜›

patent pivot
#

there are some utils somewhere in the graphite container

#

wtf chris!

vale ibex
#

I int e'd a guild.chunk

#

which caused the member count to chill at 0-1k for a bit

patent pivot
#

this is the problem with python discord ! this is the problem i have been gaslighted into believing all failures are my fault when in actuality, I am a genius

#

fixing it now

vale ibex
#

lmfao

#

iirc the member count was off, so we tried fixing it with a guild chunk

#

but the member syncer didn't like that, since it was making a site api call for each member as it came in

#

bot was not having a good time

patent pivot
#

hmmmm

#

do we have a ts for the eval

vale ibex
#

lemme look

patent pivot
#

wait

vale ibex
#

it was in #admin-spam

patent pivot
#

what month is september

#

oh

#

i'm an idiot

#

i've done the american thing and have been trolled

vale ibex
#

lol

#

you played yourself

patent pivot
#

excellent work

vale ibex
#

#admin-spam message

vale ibex
patent pivot
#

so frooooom

#

1632006000 to 1632089400

vale ibex
#

seems about right ye

#

It was taking a loooong time to chunk

fallen patrol
vale ibex
#

ye

patent pivot
#

right

#

restarting

#

one sec

vale ibex
#

very nice

#

ty joe

patent pivot
#

NAILED it

vale ibex
#

nice nice

spare plaza
#

hey @crude gyro,

Would you be able to give me these assets as SVGs?
I'm awful at asset creation and I want these toggle switches as they look nice and fit the site theme perfectly

#

I've managed to setup the cookie thing as you described, ty for the detailed response c:

crude gyro
#

they don't exist, I just threw them together in photoshop

#

and we'd want animation for the little circle

#

so, hmm.. might need to make it in css

#

but I could probably try to put something together in a fiddle for you

spare plaza
#

ah, so currently I have it refresh the page so the correct CSS is requested and sent (using context processors).
Would you want this to load both so the can be swapped without a refresh?

crude gyro
#

that would be supercool, yes, but I'm not sure exactly how we'd solve it

#

can JS easily swap out and reload a css file?

spare plaza
#

can we just have it as a comment out css style tag πŸ˜‚ so it isn't use

spare plaza
crude gyro
#

maybe if the html tag had a class somehow... keep in mind, django-simple-bulma is my repo so if changes are needed, that might be doable.

spare plaza
#

there is literally a .disabled value for elements, so if we pass both. the client can figure it out.

I'll quickly implement it and see if there is any weirdness.

crude gyro
#

you're comfortable with js, right?

#

so this is fun and not terrifying?

spare plaza
#

I'm very familiar with TS angular

#

server side rendering is where I've got no exp

spare plaza
crude gyro
#

pretty sure I can help throw together a nice custom switch a tiny bit later today.

#

just gotta finish cleaning house

#

I wanna css animate the background color transition too

#

it's gonna be awesome

spare plaza
#

one thing i'm currently trying to solve is that

  {% bulma %}
  {% bulma 'dark' %}

resolve to

<link rel="stylesheet" href="/static/css/bulma.css">
<link rel="stylesheet" href="/static/css/dark_bulma.css">

I can work with this to select these elements to then disable. But it feels messy not doing it using an id tag.

Is there a way to pass an id tag to the django template blocks (idk what they are called), example below

  {% bulma id="default-theme"%}
  {% bulma 'dark' id="dark-theme"%}

I've never used Django, but I'm guessing the package would need to support these arguments/params.
Which I assume it isn't as it is a weird use case, i'll check tho.

vocal prairie
spare plaza
#

i'll give that a go, although having it use an id to gather the element would still be nice

vocal prairie
#

Should be a matter of getting the element via one of the methods (document.getElementById or whatever, I don't know what works) and then calling setAttribute on it

#

I think that would update the styles?

spare plaza
#

i'll test, ty

#

it works

#

although, the first time a new css file is loaded the menu disappears.
might be nicer for UX to not have it in the dropdown menu, for that reason

#

i'll drop a quick gif shortly (not actually made the theme work yet, just does the top bar)

crude gyro
#

mmm.. right. might be solvable.

#

but where would you put it if not the nav?

spare plaza
#

on the top bar

crude gyro
#

could work.

#

let's test it.

#

I'll be at a computer in a sec

#

can try to build a thing then

spare plaza
vocal prairie
#

Ah, FOUC is always wonderful

spare plaza
#

whats FOUC

vocal prairie
#

Flash of unstyled content

spare plaza
vocal prairie
#

Are you loading the second style sheet on demand or on every load?

spare plaza
#

i'm swapping the href so on demand i think

#

if I did the disabled it could be on every load, i'd have to check

vocal prairie
#

Hmm. I wonder if there's a way to wait for the request to complete and then update the sheet.

#

Assuming that's what the problem is

#

I'm making that assumption since it works after the initial load

spare plaza
#

I could just make the css element spawn below it, so it would only take priority when it is downloaded (another guess of how browsers render)

#

this feels really hacky tho, but it would just be in one place

crude gyro
spare plaza
#

it depends on where we are going to put it, can you review the two gifs.

Would you prefer it on the top bar or in the menu? I prefer the top bar.

crude gyro
#

top bar seems fine

spare plaza
#

probs about half the size of the discord button then, for SVGs do I just have to tell you the ratio?

#

or do you want exact pixel?

crude gyro
#

in em or something would be fine

#

just gimme a height

spare plaza
#

70

#

pixels

#

idk how to gauge em lol

#

if it is a SVG, i can just rescale it

crude gyro
#

haha, it won't be svg

#

it'll just be some html, css and javascript.

spare plaza
#

ah

vale ibex
#

we only do raster around these parts

crude gyro
#

I think it's fun to build these things in pure css

vocal prairie
#

Manually writing out SVG code is so fun

#

It's actually really fun to do

crude gyro
#

that sounds dreadful

vocal prairie
#

It's really not, at least for simple things

#

Like <circle>s or whatever

#

And I think <line> is one? And path and g and whatever else

#

I forget what I used that one time

thorny obsidian
#

Doesn't Mark also like to manually code out SVGs?

crude gyro
#

@spare plaza here's something

#

colors can be messed with

#

haven't battle tested it, might be fragile.

spare plaza
#

oooo

#

ty!

crude gyro
#

which isn't unreasonable, by the way

stable mountainBOT
#

django_simple_bulma/templatetags/django_simple_bulma.py lines 29 to 34

# Build the html to include the stylesheet
css = static(f"css/{theme + '_' if theme else ''}bulma.css")
html = [
    f'<link rel="preload" href="{css}" as="style">',
    f'<link rel="stylesheet" href="{css}">',
]```
spare plaza
#

I just used some document.getElementsByTagName and .find with regex to gather them.
adding that would just shorten the logic for getting the stylesheet elements

crude gyro
#

so it would be pretty trivial to do something like id="bulma-css-{theme} in there

#

or whatever

spare plaza
#

time to PR it EvilKermit_REH

crude gyro
#

are you talking to yourself

spare plaza
#

yes

crude gyro
#

if you do, I'll get it released quickly

#

seems very minor, won't break anything,

#

I can release a patch version right away

spare plaza
crude gyro
#

did you test it, @spare plaza?

spare plaza
#

i'll test it with pythonsite, i should beable to build locally. 1 sec

#

also, chris just pointed out. if there is a theme called "default" it would overwrite the real default. i'll update

crude gyro
#

yeah, just inject the code right into your dependency, and then rebuild the docker container

crude gyro
#

@spare plaza

here's a variant that uses css.gg icons instead of fontawesome. a bit cheaper to load, too, since I'm loading only those two icons and nothing else.

spare plaza
#

I was hoping to just use a git dep

django-simple-bulma = { git = "https://github.com/GDWR/django-simple-bulma.git", branch = "gdwr/add_id_to_stylesheet_element" }

But I kept getting this unhelpful error

#9 10.79
#9 10.79   FileNotFoundError
#9 10.80
#9 10.80   [Errno 2] No such file or directory: 'git'
#9 10.80
#9 10.80   at /usr/local/lib/python3.9/subprocess.py:1821 in _execute_child
#9 10.92       1817β”‚                     else:
#9 10.92       1818β”‚                         err_filename = orig_executable
#9 10.92       1819β”‚                     if errno_num != 0:
#9 10.93       1820β”‚                         err_msg = os.strerror(errno_num)
#9 10.93     β†’ 1821β”‚                     raise child_exception_type(errno_num, err_msg, err_filename)
#9 10.93       1822β”‚                 raise child_exception_type(err_msg)
#9 10.93       1823β”‚
#9 10.93       1824β”‚
#9 10.93       1825β”‚         def _handle_exitstatus(self, sts,
#9 10.93
------
executor failed running [/bin/sh -c poetry install --no-dev]: exit code: 1

Either way, I just mounted it inside and made it a path dep. It is working.

crude gyro
#

I usually just.. inject the code straight into the dependency

#

also I made it spin because this is how I have fun at 00:30 AM

spare plaza
#

Spin on hover πŸ‘€ that is awesome

crude gyro
#

it's super stupid but so much fun.

#

why would the moon spin

#

your PR has an f-string inside an f-string

#

are you trying to kill me

spare plaza
#

LOL

#

is that bad?

crude gyro
#

it has, what we call in the biz, "a high cognitive complexity"

spare plaza
#

i see, would this be more suitable?


    stylesheet_id = f"bulma-css-{theme}" if theme else "bulma-css"

    html = [
        f'<link rel="preload" href="{css}" as="style">',
        f'<link rel="stylesheet" href="{css}" id="{stylesheet_id}">',
    ]
#

or just a full if statement?

crude gyro
#

yes, that looks great.

#

no problem there

spare plaza
#

i'll update it, one mo

crude gyro
#

the inline condition is very readable like that

spare plaza
#

i'll also give it another test, just to ensure

spare plaza
fallen patrol
#

@spare plaza BTW github supports a zip download of every single commit so you can use those and not require git

spare plaza
#

ah, so I can do this?

django-simple-bulma = { url = "https://github.com/GDWR/django-simple-bulma/archive/refs/heads/gdwr/add_id_to_stylesheet_element.zip" }
fallen patrol
#

yep, as long as the link is valid :D

spare plaza
#

seems like it misses files if I try just a zip, cos it doesn't build (i think)

#
 > [7/8] RUN     BUILDING_DOCKER=yes     SECRET_KEY=dummy_value     DATABASE_URL=postgres://localhost     METRICITY_DB_URL=postgres://localhost     python manage.py collectstatic --noinput --clear:
#11 0.823 Traceback (most recent call last):
#11 0.823   File "/app/manage.py", line 195, in <module>
#11 0.823   File "/app/manage.py", line 184, in main
#11 0.823     execute_from_command_line(sys.argv)
#11 0.823   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
#11 0.824     utility.execute()
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
#11 0.824     self.fetch_command(subcommand).run_from_argv(self.argv)
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
#11 0.824     output = self.handle(*args, **options)
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 194, in handle
#11 0.824     collected = self.collect()
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 109, in collect
#11 0.824     for path, storage in finder.list(self.ignore_patterns):
#11 0.824   File "/usr/local/lib/python3.9/site-packages/django_simple_bulma/finders.py", line 215, in list
#11 0.825   File "/usr/local/lib/python3.9/site-packages/django_simple_bulma/finders.py", line 116, in _get_bulma_css
#11 0.825     for dirname in self.bulma_submodule_path.iterdir():
#11 0.825   File "/usr/local/lib/python3.9/pathlib.py", line 1160, in iterdir
#11 0.825     for name in self._accessor.listdir(self):
#11 0.825 FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.9/site-packages/django_simple_bulma/bulma/sass'
------
executor failed running [/bin/sh -c BUILDING_DOCKER=yes     SECRET_KEY=dummy_value     DATABASE_URL=postgres://localhost     METRICITY_DB_URL=postgres://localhost     python manage.py collectstatic --noinput --clear]: exit code: 1
ERROR: Service 'web' failed to build : Build failed

I'll try the other way

spare plaza
crude gyro
#

had to do a minor version bump because I also bumped bulma to 0.9.3

#

should be on pypi within a few minutes

#

might be there now, actually

#

mmmyep

#

thanks for the pull request!

spare plaza
crude gyro
#

the button seems a bit big, and the colors probably aren't quite right - but the animation and icons totally rock

#

this is gonna be fantastic when it's done

#

nice work so far!

tawdry vapor
#

Well... it's nice until you encounter all the inconsistencies across different rasterisers. Some of the more advanced/niche parts of the standard can have no support or buggy implementations.

fallen patrol
#

!remind 2h bonk joe for member stats

stable mountainBOT
#
Absolutely!

Your reminder will arrive on <t:1644292112:F>!

patent pivot
fallen patrol
#

nah i'll bonk you tomorrow then

#

not sure if the sweeping raid hit here yet, or if it did at all

patent pivot
#

lol

#

you can see it there

#

don't need to ask me

vale ibex
#

sir-lancebot#910

dusky shoreBOT
vale ibex
#

lol ok, I used github ui to rebase this to get it up to date with main

#

but now I'm marked as a committer on every commit πŸ˜…

brisk brook
#

Yeah... you accidentally rewrote the history πŸ˜…

vale ibex
#

well I meant to rewrite the history, since that's how rebasing works

#

thought it would be smart enough not to mark me though lol

brisk brook
#

It still sets the author as @trail pilot from my experience of rebasing, but you are now considered the committer I think?

vale ibex
#

possibly yea

#

yea, seems like it

brisk brook
#

Yeah a merge commit might be better moving forward. I remember seeing the changelog from GitHub and figured there'd be issues like this with rebases

vale ibex
#

I prefer rebases though, since you don't have a load of merge commits in the history

brisk brook
#

It's probably best if @trail pilot just force-pushes that away and then use merge commits since we use merge commits to merge PRs

brisk brook
vale ibex
#

it's probably only that since it's the default, rather than an active thought on how we merge

#

but yea, the repo has been running so long like this it barely makes a difference now

brisk brook
#

Meaning that this commit with you as the committer will show up in the main branch, not sure if that's desirable?

vale ibex
#

I meant that the repo has been using merge commits so long, that there's likely little point in stopping now, since there are so many of them

brisk brook
vale ibex
#

Yea, if I had known it would mark me as the committer I would have asked fronto to rebase, or just merged main

brisk brook
vale ibex
#

it makes squashing harder too, if you have a bunch of merge commits in the branch history between branch commits

brisk brook
#

Yeah, you kind of have to decide between only squashing + rebasing or merge commits

vale ibex
#

or try and walk someone through dropping the merge commit locally and then possibly dealing with conflicts before you can squash/fixup πŸ˜…

trail pilot
#

oh I'm here now, anything I need to fix or is it fine

vale ibex
#

Yea, probably worth fixing πŸ˜…

#

could you sync main on your fork with upstream main

#

then pull main locally and rebase your branch to main and then force push

#

it should sort out the changes I made then πŸ˜„

trail pilot
#

!remind 9h30M sync main

#

!remind 9h sync main

vale ibex
#

remind cog is unloaded iirc

trail pilot
#

ah I see

trail pilot
#

So something like

git pull link_to_upstream main
git checkout trivia-night
git pull link_to_upstream main
git rebase main
git checkout main
git push --force
#

I'm not very good at git hence I'm double checking

vale ibex
#

if you go to your fork on github there should be an option to fetch upstream

#

Once you do that it would be ```
git checkout main
git pull
git checkout trivia-night
git rebase main
git push --force

green oriole
#

hello folks, just wanted to check, have y'all blocked the project name smartconfig on PyPI back when that was still a pydis project?

#

I've just tried uploading it, and I'm getting 400

#

imma CC @patent pivot because I think if someone did it would be you pleased_akarys

green oriole
#

yeah like you can create a project and don't upload anything to reserve the name

patent pivot
#

no, we didn't do that

#

I don't think we ever made any progress towards a pypi release since project direction wasn't clear

#

Did we get something that was pypi ready

green oriole
#

no

#

lol

#

just wanted to double check, because I'm really unsure why PyPI is rejecting it

#

smartconfigparser is an existing package, I wonder if that's why

short snow
#

but isn't the project name smartconfig?

green oriole
#

yes

#

that's what I'm trying to upload to pypi

short snow
#

you could probably ask in the pypa discord, there are several admins there

#

ah πŸ‘

placid ermine
#

i have a async_rediscache.RedisCache instance, is there no way to add a list to the cache?
i saw an .update method which took a dict so i suppose i could make a dict keyed by ints to mimic a list

thorny obsidian
placid ermine
#

redis itself has a list type

green oriole
#

assuming there has been no updates since then, there is no builtin list type

thorny obsidian
green oriole
#

that said you can serialize it yourself using comma separated values or something

placid ermine
#

mm sad

vale ibex
#

yea, there was complexity in ensuring atomic writes to the cache and redis for lists (iirc)

#

so asyncrediscache only supports primitive types

green oriole
#

I wonder if you could subclass the default impl to have an actual list

patent pivot
#

yeah we purposefully avoided dictionaries and lists

#

it's just a prime case for race conditions when you're doing things like that

patent pivot
green oriole
#

from what I can see, deleting should free the name thonking

patent pivot
#

or someone has blocked it

#

uhhh

#

maybe

green oriole
#

I'll poke some people about it

patent pivot
#

though I'd actually hope it doesn't work like that lol

#

if packages get deleted the names should never be able to be reused

gritty wind
#

Iirc correctly you can reuse a name*
Except you can never name a release after an existing (or deleted) one

#

Which is great for security if people actually locked to specific versions instead of blindly updating :P

#

I guess we get around that by never updating 🀑

placid ermine
green oriole
#

yeah, that's already a redis limitation hsp

gritty wind
placid ermine
#

ok ill just avoid all this
and
json.dumps

#

yeah

gritty wind
#

It’s how we sort of get around it

green oriole
#

lol

patent pivot
#

I hate it

#

We really shouldn't

green oriole
#

ideally you want to use nicely namespaced keys for that

patent pivot
#

If possible I'd like to avoid suggesting people throw JSON into redis

#

It's a complete anti-pattern with how we've got things set up and is just asking for race conditions or weird bugs

placid ermine
#

what is my alternative
assuming a structure like

[
  {"name": "alice", "age": 34},
  {"name": "bob", "age": 22}
]
green oriole
#

something like setting the key name.alice to 34

thorny obsidian
green oriole
#

that's what Redis intends you to use

placid ermine
#

currently its me trying to store questions and test cases

placid ermine
green oriole
#

well for instance you could have alice.name set to 34, alice.birthday set to 2004-04-06, ...

placid ermine
#

hrm

green oriole
#

although those lists could probably be comma separated

placid ermine
#

promising

#

okay, that seems reasonable enough to work with for dicts

#

what about lists

gritty wind
#

How would JSON cause a race condition

green oriole
#

Well, could use .index

green oriole
gritty wind
#

I really don’t folllow

#

Isn’t it just a string as far as redis is concerned

green oriole
# gritty wind I really don’t folllow

For instance:
1a. Attribute a gets changed
2a. Object with a changed gets serialized
1b. Attribute b gets changed
2b. Object with a and b changed gets serialized
3b. String with a and b changed is written to redis
3a. String with a changed is written to redis

gritty wind
#

I don’t follow still actually

#

Not sure what you’re describing

#

Let’s say the serialization is done outside the context of redis

green oriole
#

The numbers are steps, the letters are concurrent actions

gritty wind
#

Is the race condition there

green oriole
#

Yes

#

Okay, lemme reformulate

gritty wind
#

This feels like more of a problem with your code if you’re changing the value and writing it multiple times at once

#

Wouldn’t it be true of any string

#

Is redis just a race condition nightmare

green oriole
#

You cannot guarantee that the order in which attributes are changed will be the same as in which the object is saved to Redis because of the serialization step

#

Nah, the race condition nightmare is using one Redis key to store many information that can be changed concurrently

gritty wind
#

So the problem here seems to be trying to modify the value in multiple places at once, but like… that’s not a fault of serialization

green oriole
#

That said, I believe the issue can be resolved with appropriate locking

gritty wind
#

You can have the same problem with a string if two functions try to modify it lol

green oriole
#

Well, no, because you only store one piece of data

gritty wind
#

This is a weird argument to me, because the core of it seems to be redis is just super susceptible to race conditions, but nah it’s totally fine to use it as long as you don’t utter the magic combination of letters

gritty wind
#

Not for encoded values or anything

#

But literally just a plain string

#

Maybe that is the case, but then should we be using it if it’s so fragile

vale ibex
#

AFAIK the issue stems from two different use cases. The one that is the "support" case for asyncredis cache is where you cache a single item, say who claimed a channel, and then read it at some point in the future. but setting the key to a new value doesn't rely on reading the value and altering it, it's purely setting it to a new value

#

the issue with serialising dicts/lists is that to set the key, you need to read, amend and then write

green oriole
#

maybe that'd be clearer

vale ibex
#

since the new value depends on the old value

gritty wind
#

Let me grab a pen and paper

green oriole
#

taking a similar example with a list being serialized as a dash separated string

#

two appends are done at the same time, so you expect the data in Redis to be either a-b or b-a, right?

#

the order is whatever since they happened at the same time

#

which is what the RPUSH redis command would do

gritty wind
#

Mentally this feels the same to me

#

Substitute string[i] for like actual valid code lol

vale ibex
#

Yes, it is, since in your use case setting the new value of string depends on the old value

#

So that would also have a race condition

gritty wind
#

So if it’s just a problem with your code, why would we not allow json

vale ibex
#

The argument isn't that what asyncredis-cache currently supports doesn't have race conditions, but that supporting lists/dicts will always have race conditions

#

any time where setting a new value for a key requires reading the current value and updating, it will have a possible race condition

green oriole
#

although if it uses redis atomic operations, it won't have any race conditions

gritty wind
#

The argument against JSON seems misguided

#

Shouldn’t you be crusading against like

#

People writing to redis 🀑

green oriole
#

for the record, I think using JSON with proper locking would be fine

#

it is another thing to keep track of, though

vale ibex
#

trying to store json with the current asyncrediscache impl can lead to race conditions unless you implement some form of locks

#

but it's not just json, it's when any update to keys requires you to read, modify, then write

green oriole
#

to be fair, Redis isn't made to store very complex data structures

gritty wind
#

Well, that just makes me wonder:

  1. What alternative do we have
    and
  2. Isn’t this true of any data type you use. Why aren’t we locking all our uses of redis everywhere
green oriole
#

it is fast because it is simple

vale ibex
#

I mean it can be, there are pretty decent key types for dicts/lists etc

#

of course if you need relations then don't use redis

gritty wind
#

Sir-lance πŸ˜”

vale ibex
#

you don't care about who previously claimed a channel when updating it

gritty wind
#

An alternative would finally be adding the third bot that’s a middle ground between lance and python

green oriole
#

in most cases the new value does not depend on the old one

vale ibex
#

Yea, what Ak said, those use cases are fine

#

anything where that isn't the case requires lock patterns

gritty wind
#

You can definitely use json without locking then, just write everything at once >.>

green oriole
vale ibex
#

sure, if you only read on boot and dump on shutdown, you don't need it

#

if it's all done in memory, then fine

green oriole
#

that'd work too

vale ibex
#

if you need to write to redis during uptime, you have possible race conditions

gritty wind
#

But that’s not the case is it? Claimants read and write at the beginning and end of the function call

green oriole
#

writing every X minutes could also be a solution, I believe?

gritty wind
#

It sounds more like an attempt to reduce the likelihood of it happening than a solution, so how likely is it

#

This isn’t purely hypothetical, my unfurl PR writes to redis for caching

#

Though it just writes one value at the end of the operation

#

And reads it independently

vale ibex
#

Does updating/setting a key depend on the previous value?

green oriole
#

you can see periodic writes as a locked write

gritty wind
#

It doesn’t write, edit, write again

#

But neither did HSP’s use case

vale ibex
#

Though it just writes one value at the end of the operation
Does it read what's currently there, append to it and then write?

gritty wind
#

Nah if it found a cached item, it just returned it. If it didn’t, it created a cache item

vale ibex
#

then yea, that's fine

gritty wind
#

Zig commented that it’s basically a glorified LRU cache

green oriole
vale ibex
#

From what I could tell hsp was looking at serialising a dict/list into a single key

#

so updating that key would require reading, updating, then writing back

#

which would have a race condition if another operation came in after the first read

green oriole
#

races conditions here are basically this

thorny obsidian
#

If we wanted to add another question + test case, it would read the whole thing back, update it with the next question + test cases, then write it all back. It's not a straight override unless we include all the previous questions everytime we add a new one

vale ibex
#

could we have a key for each quesiton?

#

I'm not familiar with what is needing to be stored

#

but it could be possible to do it in a way that doesn't require defending race conditions

thorny obsidian
green oriole
#

a problem could occur if the same testcase is modified at the same time, but I doubt that can happen

thorny obsidian
green oriole
#

and me who just joined back to ask about smartconfig

vale ibex
#

Yea, I'd need to see a PR or more on what the code looks like to give an answer πŸ˜„

green oriole
thorny obsidian
green oriole
#

makes sense

#

did I ever leave documentation on how to write the test cases?

#

I know I wanted to do that, don't remember if I did

thorny obsidian
#

No, I was going to figure out what that looks like and make the documentation next week

green oriole
#

I could probably take a bit of time to write something up, if you are interested

thorny obsidian
green oriole
#

sounds good

vapid imp
#

I am whiteant . I need some friends. some Python developer friend, also I am a boy? add me. I love python and building things. I am just a student.

#

Thank You 😍

green oriole
#

oh and if y'all are curious, smartconfig was previously registered as a malicious package, so the name is locked haha

vale ibex
#

I'm offended by the package name smartconfig, since it implies my config package is dumb

#

pls ban

#

ty

green oriole
#

haha

placid ermine
#
In [3]: o = {
   ...:     "records": [
   ...:         {"name": "alice", "age": 34, "x": [1, 2, 3, {"stuff": "hi"}]},
   ...:         {"name": "bob", "age": 22, "x": [5, 6, 7, {"stuff": "hmm"}]},
   ...:     ]
   ...: }

In [4]: flatten(o)
Out[4]:
{'records.0.name': 'alice',
 'records.0.age': 34,
 'records.0.x.0': 1,
 'records.0.x.1': 2,
 'records.0.x.2': 3,
 'records.0.x.3.stuff': 'hi',
 'records.1.name': 'bob',
 'records.1.age': 22,
 'records.1.x.0': 5,
 'records.1.x.1': 6,
 'records.1.x.2': 7,
 'records.1.x.3.stuff': 'hmm'}

should i dump sthn like this to redis

cold island
#

What's up? why do we want to write json to redis?

placid ermine
#

i want to store a list of questions
each question has a problem description (str), and two lists of test cases
each test case has one input (str) and one output (str)

cold island
placid ermine
#

i wasn't previously

#

now i am

cold island
#

lol

#

I think that

  • A race condition is unlikely to occur, because there's probably going to be very few people who ever edit the questions, and a single person will probably not try to make two operations simultaneously
  • Even if it does occur, it seems rather harmless, as the only effect I see is one of the operations de-facto not happening.
  • If you still want to deal with it, asyncrediscache offers a transaction decorator
#

So while redis might not be the best tool here, storing json is definitely possible

placid ermine
#

so to clarify, the questions cache has just one key-value pair, the key being smthn like "questions", and the value being a json string representing a list of questions

cold island
#

yeah

#

You could split it however you want, e.g each question could have its own key

placid ermine
#

hmm

cold island
#

But depends on usage

#

If you only ever want to read it in bulk there's no need

brisk brook
#

I tried reading up on the context but failed, are we just talking Redis race conditions?

#

Just add an asyncio lock locally or use Redis' scripts

cold island
#

yeah the library offers a lock decorator per cache

thorny obsidian
#

This conversation originated about concerns of writing a json.dumps() to async_redis

brisk brook
cold island
#

I didn't say it wasn't πŸ˜„

placid ermine
#

hmm i think im going to go with one question per key

cold island
#

Why write a lock yourself?

thorny obsidian
cold island
brisk brook
cold island
brisk brook
#

If you only try to acquire it when you use a specific cache, yes

green oriole
#

The previous discussion was more about using Json in Redis in general

#

I'd assume in some instances it doesn't matter much

short snow
vale ibex
#

neat

rapid swallow
placid ermine
#

Yeah i discovered it too

#

Showed the time param on hover

rapid swallow
#

is that backtalk? banned.

austere hornet
#

Would appreciate some core dev reviews on sir-lancebot#1022 (not urgent). Thanks!

dusky shoreBOT
hoary haven
#

@crude gyro btw wasn't there a search bar in the scope for smarter resources at one point? did we remove it? Thinking_chief or am i misremembering

spare plaza
#

I have tried just putting the component's variable name, but it appears to not be working.

austere hornet
#

@trail pilot In response to this #community-meta message, I have a question but it fits in this channel more than #community-meta. Shouldn't .quiz have an invoker-only message listener like I did for .madlibs if it doesn't already? That way the game can't be interrupted?

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

trail pilot
#

the game wouldn't technically be interrupted but it interrupts the experience if someone say runs code like with !e

#

because the question might get lost

thorny obsidian
#

(.quiz is also a multi-person thing. The bot needs to listen to more than just the invoker)

austere hornet
crude gyro
crude gyro
#

shouldn't be a hugely difficult task to install a search bar into the resources page.

#

might be a task I'd want to take on in the near future myself

vale ibex
#

I can spin up an elastic search container in our shiny new servers

#

super over-complicate it, the true pydis way

crude gyro
#

yes and then we'll use redis as a broker to send the request to the bot, who will consume the order and make the requests via a cloudflare worker microservice that's just there to talk to elastic search. Elastic search will need a list of the resources, so it can make an API call back to the site, which will return the full list of resources and can then be sorted by elastic search. Then elastic search can use websockets to establish a session with the client and bob's your mother!

#

or I can hack together some search thing with jquery filtering in like 20 minutes

magic arch
#

you forgot the new separate Discord bot we'd need too

crude gyro
#

oh yes, let's name it Galahad

magic arch
#

love it, let's make a repo

crude gyro
#

I propose instead of just making a repo, we create a repo for a serverless microservice that we can use to make repos

magic arch
#

we need another bot to interact with that too btw

magic arch
crude gyro
#

so we create Tim the Enchanter, a NLP bot that monitors the chat in this channel and performs sentiment analysis to determine which repos we need before we even know we need them, and which in turn then calls the serverless repo-making microservice to create corresponding repos.

vale ibex
#

learning from you

crude gyro
#

the true test of its viability will be that we host it on a raspberry pi connected to my neighbours power outlet in my garage, and see if Tim understands that he needs to create a repo for himself.