#dev-contrib

1 messages · Page 74 of 1

tawdry vapor
#

also git config --global core.eol lf

eternal owl
#

okay

#

thx

#

ops pinged the wrong mark

#

@tawdry vapor

shadow elbow
#

😂

tawdry vapor
#

I don't have time to review right now

eternal owl
#

I just changed few word

#

none of the cogs were actually using on_error

tawdry vapor
#

I don't know if anything was relying on the previous behaviour

eternal owl
#

okay

#

Let me cross check again

#

the surprising part is, a cog was using error.handled = True

cold moon
gritty wind
#

3 Relevant variables at the top have to be filled in

late wolf
#

Is there any reason, why the bot keeps on typing even after when the command is already displayed

gritty wind
#

Seems like a quirk of d.py

#

I tested with this, and it just held for a while after sending the message

@bot.command()
async def test(ctx):
    async with ctx.channel.typing():
        await ctx.send("Test")```
late wolf
#

ah i see

green oriole
#

Typing events will last for 5 seconds, because of the way discord work

manic echo
green oriole
#

We need to use normalized types in order do a proper isinstance check though

manic echo
#

`import typing as t
from collections import deque

t.get_origin(t.Deque)
<class 'collections.deque'>
isinstance(deque(), deque)
True
isinstance(deque(), t.Deque)
True`

#

Similar for list too, output for both is same.

green oriole
#

!e The issue is with

from typing import List

print(isinstance([1, 2, 3], List[int]))```
stable mountainBOT
#

@green oriole :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 |   File "/usr/local/lib/python3.9/typing.py", line 657, in __instancecheck__
004 |     return self.__subclasscheck__(type(obj))
005 |   File "/usr/local/lib/python3.9/typing.py", line 660, in __subclasscheck__
006 |     raise TypeError("Subscripted generics cannot be used with"
007 | TypeError: Subscripted generics cannot be used with class and instance checks
green oriole
#

But it will work with get_origin

mellow hare
#

@green oriole It looks awesome! I really appreciate it

#

@eternal owl It'll commit them but when you try to push them it'll only send the ones you modified, not all the line ending ones

#

At least in my experience

eternal owl
#

okay

surreal venture
#

@nocturne hare Can you please drop a review on my pull request?

dusky shoreBOT
cold moon
cold moon
tawdry vapor
#

Yes, you can close it if you do not plan to continue working on it.

#

I think it's better to live with false positives and wait for a fix rather than fix that and introduce an easy way to circumvent the filter.

green oriole
#

... Oops

#

We tried to keep PRs open in the past to keep the work already done, I feel like we should do the same here?

#

Sorry, I didn't checked this channel first, my bad

tawdry vapor
#

That's situational. In this case, I don't think there's much to salvage from the current diff since a more comprehensive approach is required, which means something more complex.

green oriole
#

you never seen that

surreal venture
#

I do not know why, but I am unable to run seasonalbot. Every time I run pipenv run start, it gives me an error:

 socket.gaierror: [Errno -2] Name or service not known
#

I have installed redis (from source) and have run pipenv sync --dev

#

oh wait do I need to start the redis-server?

#

At what port does the bot expect redis to be running?

#

Nevermind I got the port

#

Nope, it still isn't working

#

I am running Ubuntu 20.04.1 (AND I AM EXTREMELY EXCITED) with python version 3.8.5

#

Please do ping me if you know why it isn't working

sullen phoenix
#

@surreal venture you can enable fakeredis in the config

surreal venture
#

/etc/redis/6379.conf?

sullen phoenix
#

no, the bot's config

surreal venture
#

how do I do that?

sullen phoenix
#

so you won't need a redis server running at all

surreal venture
#

USE_FAKEREDIS in .env?

sullen phoenix
#

set use_fakeredis to true in your config

surreal venture
#

ok thank you!

sullen phoenix
cold moon
#

SeasonalBot have this in environment variable USE_FAKEREDIS=true

sullen phoenix
#

oh, i missed that this was seasonalbot

#

i thought you were talking about @stable mountain, sorry

#

@surreal venture this

cold moon
#

Yeah, JSON have to be migrated to Redis for #509

surreal venture
#

Thanks!

surreal venture
#

Just one more question, when we initiate RedisCache, do we need to specify the namespace? Also, will it automatically load the data stored for that namespace (if there is some data)?

cold moon
#

When you define this inside class (like in example I linked), no.

surreal venture
#

Ok, since the namespace would be class_name.var_name by default?

hardy gorge
#

A RedisCache needs a namespace, as that's what tries to prevent us from having collisions in redis

#

Yeah, but you don't have to worry about that

#

RedisCache will automatically set that namespace and you never have to manually provide it

surreal venture
#

Ok thanks!

hardy gorge
#

Just make sure you assign a class attribute to it

surreal venture
#

And it automatically loads the data from the namespace?

hardy gorge
#
class MyClass:
    some_attribute = RedisCache()
#

It does not load data automatically, you have to use the get and set methods (or any of the other methods)

#

Basically, we don't want to have a local copy of the data that could get out of sync with the state in the Redis database

#

Each time you want a value, you just ask for it and it will get you the value from Redis

surreal venture
#

Okay thank you!

surreal venture
#

I can't make my __init__ an async function, right?

#

How do I add some code in which I get something I need to await?

late wolf
#

use property decorater

surreal venture
#

isn't that for like getter and setter?

late wolf
#

u can use it as an attribute, so you could basically do

class A:
  @property
  async def something(self):
    return "hello there"


  async def somefunction(self):
    await self.something #raises some error, but this is the basic idea u can use it as an attribute


surreal venture
#

I am not sure I understand

#

So like this is my code:

def __init__(self, bot: Bot) -> None:
  self.bot = bot
  ...
  self.some_attr = await something
#

How would I put that in my __init__?

late wolf
#

u don't,u can use self.something as an attribute.
__init__ can't have async and await

surreal venture
#

Oh ok I see what you mean now, thanks!

brazen charm
#

I don't really see how that's relevant to running async in an init

eternal owl
#

you can set self.some_attr to None and then load it using self.bot.loop.create_task(func)

#

@surreal venture

gritty wind
#

Other parts of the codebase schedule the tasks for separate execution, but I don't know if that is viable in your case

surreal venture
brazen charm
#

You can use a separate coro that you call manually or schedule it with the create task like above

surreal venture
#

is there HGET and HSET in async-rediscache?

#

(and sorry for asking so many questions)

hardy gorge
#

That's what a RedisCache uses

#

The namespace is the main key, the key you provide is the second key

surreal venture
#

What if I want to store a dictionary in a RedisCache instance? How would I go about doing that? Normally in redis-py you could do redis.Redis().hset() and redis.Redis().hget().

brazen charm
#

json if you need it for more keys

surreal venture
#

I was using json, but ks123 asked me to use redis instead

hardy gorge
#

You typically represent a dictionary by a RedisCache directly

#

Since that's what a RedisCache is more or less a stand-in for

#

A RedisCache is the hashset you're after

surreal venture
#

so I define another RedisCache for each nested dictionary?

#

Wait can I convert it to a string and load it back again using json.dumps and json.loads?

hardy gorge
#

Right, nested dictionaries is another story. You can't really do that with Redis either.

#

there's only key -> key -> value, which in Python translates to "name of the dictionary" -> "key" -> "value"

#

A single, non-nested dictionary would already be a hashset

#

A non-hashset "set" is like assigning a single name to a single value (no container other than the entire database)

surreal venture
#

So basically, I need my RedisCache to be like int: Dict[int, int, str] or something

green oriole
#

Sure

hardy gorge
#

That should work (but: it could create potential race conditions)

#

The problem with serializing and deserializing JSON is that if you get this sequence of tasks, you lose data:

green oriole
#

That is true, json operations aren’t atomic

#

Could it be possible to make them atomic at the library level? Maybe using a lock or something?

hardy gorge
#
  • task 1 fetches data

  • task 1 deserializes and modifies local dict

  • task 2 fetches data (OLD data)

  • task 1 serializes as JSON

  • task 1 stores new JSON to Redis

  • task 2 makes changes to OLD dict

  • task 2 serializes

  • task 2 overwrites changes made by task 1

surreal venture
#

oh... that would be bad

hardy gorge
#

It's a decorator

surreal venture
#

but this would apply if task 1 and task 2 are running in parallel or near parallel right?

green oriole
#

That’s cool

surreal venture
hardy gorge
#

Well, our bots use asyncio and most of our functions await at intermediate points, meaning that, yeah, multiple tasks could run and alternate

hardy gorge
surreal venture
#

Ok, thanks for your help, I'll see what I can do!

hardy gorge
#

The race condition is possible with non-JSON as well, but, with JSON, there's typically more going on (more simultaneous values that rely on a single key update)

surreal venture
#

Can I just use JSON to make the data persistent instead of using redis? What advantages does redis have over JSON?

glass pecan
#

redis is a hosted service that already exists and doesn't require us to assign a specific persistent storage volume to the bot service

#

because of our infrastructure, if we had a file-based persistance, we'd need to add a persistent volume to the hosted container that runs the bot

#

that costs us money

surreal venture
#

oh oh ok

glass pecan
#

since working with it is practically the same feel as json, it shouldn't be a hassle

surreal venture
#

Except, you can't store nested dictionaries

#

which is a really big down for me

#

since I have nested dictionaries

glass pecan
#

that's just a case of reorganising your data schema tbh

cold moon
#

Using JSON to persist isn't option anymore

#

Only Redis

glass pecan
#

you can still store id references to cross reference other data if needed

cold moon
#

Otherwise data will get lost

surreal venture
glass pecan
#

yep

cold moon
#

Yes, but this will be overwritten every time when bot redeploys

glass pecan
#

it's better to use a dict tho in that case

#

since it's going to live/die the same way

surreal venture
#

but it's a really long file

glass pecan
#

how long

#

as in, whats the filesize

surreal venture
#

2207 lines

glass pecan
#

that's not long

#

it's fine

#

that's like 1 module in my bot lol

surreal venture
#

what

glass pecan
#

was thinking it would be GBs worth of data

gritty wind
#

I'm trying to figure out how the verified attribute gets set on the API, as I can't find it in the bot's code, nor can I get it to be set when a user verifies

green oriole
#

Hmm, the verified attribute on the discord objects, or on the site database @gritty wind?

gritty wind
#

Site DB

#

The users endpoint

#

it just returns null on all users

#

The rest of the verification process works normally and adds the role

green oriole
#

Huh

#

We never set it?

gritty wind
#

I dont see it in the code

#

But it must work.. right?

tawdry vapor
#

What verified attribute?

brazen charm
#

Doesn' that just work through roles?

tawdry vapor
#

Do you mean the role?

gritty wind
#

api.site/users/{user.id}/metricity_data

#

Huh I wonder if metricity sets it

#

I mean, I have metricity running too

green oriole
#

I was going to check django admin, but I cannot login with discord

tawdry vapor
#

Yes that is a metricity-only thing

green oriole
#

Yeah, we don't have that on the site db

gritty wind
#

So... metricity sets it?

tawdry vapor
#

Well it is on the site DB. I don't think there's a separate postgres instance.

#

Yes metricity sets it

gritty wind
#

Oh, if that's what you're referring to, I have them set to the same DB

#

I'm just trying to get it to update though

green oriole
#

It is on the postgres instance, but not on the site db, metricity is using a separate database

gritty wind
#

Well, I see it now

#

How would it be accessed from the bot?

tawdry vapor
#

With the API endpoint

#

Why do you need it

gritty wind
#

I'm reviewing a PR that's using it

#

Which endpoint would that be?

tawdry vapor
#

Probably the one you sent earlier

gritty wind
#

But.. wait how do I connect the site API to the metricity DB?

#

Sorry, I'm still figuring out my setup for the projects

tawdry vapor
#

It automatically connects

gritty wind
#

Huh, well it returns different values from what is stored in the DB

#

I'm not seeing any errors anywhere either

tawdry vapor
#

How are you checking what's in the DB

gritty wind
#

I was selecting the columns using SQL directly

#

And there is some connection I would think, because the message counts is reported

tawdry vapor
#

Are you using the default db connection string?

gritty wind
#

For the site itself, I'm just running docker-compose up, no changes, and for the metricity I'm not changing anything (the only change I have it getting it to connect through host network)

#

Metricity also has the correct channel IDs

tawdry vapor
#

What change exactly?

#

Are you sure the bot is connecting to the same db as the site?

gritty wind
#

Well, same postgres instance, but metricity uses metricity db, the site uses the site

#

Let me grab them

tawdry vapor
#

Yeah that's what i mean

gritty wind
#

Should it not be setup like that?

tawdry vapor
#

It should

#

I was asking if the site connects to the same metricity db that the bot connects to

gritty wind
#

Ah, in that case yeah

#

I can test to confirm

#

Ok update

#

It is definitly looking in the right place but

#

It selects the verified_at, which is never updated for me, even when the actual verification status is set

tawdry vapor
#

Did you set the right IDs in the config?

gritty wind
#

The metricity IDs?

tawdry vapor
#

The role ID in metricity's config

gritty wind
#

Yeah, that one is set

#

I can try to set it again and verify again

#

But I figure if it did detect the verrification...

tawdry vapor
#

What do you mean detect verification?

gritty wind
#

It set the verified status to true for my test account

tawdry vapor
#

You mean when you manually query the db?

gritty wind
#

Yes

tawdry vapor
#

But it doesn't show that through the api?

gritty wind
#

But its a different column

#

The column the api uses is null

tawdry vapor
#

I don't know what's wrong then.

#

Different column?

gritty wind
#

Is it working for you?

#

There is is_verified and a verified_at

#

the api uses the verified_at

#

Well...

#

I changed nothing

tawdry vapor
#

I've never tried running it so I don't know

gritty wind
#

Just reverified and

#

it works

#

I must've updated it at some point

#

Thanks for helping me :D

surreal venture
#

What is dump.rdb?

gritty wind
#

A Redis dump of your active DataBase cache
Here is the redis page on data persistence https://redis.io/topics/persistence

Do you have specific questions about its connection with the projects?

surreal venture
#

it shouldn't be commited right?

gritty wind
#

No, it shouldn't

surreal venture
#

Okay, that's all I wanted to know. Thanks!

surreal venture
#

@cold moon I have changed my code to use RedisCache to make the data persist, can you check if the code is good to go or if it needs some more improvements?

#

@nocturne hare Can you also review my pull request?

dusky shoreBOT
clever wraith
brazen charm
#

Mind that running the bot locally is really only useful for development on it. If you need specific features out of it for your own use it'll be easier to just take out those features and make them work without the bot's environment

cold moon
#

Why Core Dev approvals use checks? This isn't really nice when so much commits show ❌ even when linting success, but core dev approvals not. This should be label instead I think.

sullen phoenix
#

because it is a required check

#

you can't require a label

gritty wind
#

We could just have a dummy account on the whole repo to prevent prs not approved by core devs, without failing all the actions

sullen phoenix
#

we're going to change it over to a pending status i think

#

a dummy account?

green oriole
#

That was one of the proposal, using the github bot for that, but we don't actually require changes

gritty wind
#

Well the check was implemented to allow core-devs to remove themselves from getting messages for the whole repo, but if we add just one account thats required for all prs, we can stick with the old system, but not have to fail commits

patent pivot
#

we're actively changing it right now

#

the way it's going to work is that the PR will display pending

gritty wind
#

Does the commit status show as failed or pending when there are failed and pending tasks?

#

I image it would resolve lazily?

patent pivot
#

well, it's as you say there

#

failed shows failed, pending shows pending

#

oh you mean if there is still a pending task when there is a failure

#

good Q, I think it displays failed, but at the bottom of the PR it will always display

#

new system is running on forms backend now

green oriole
#

So it is working?

patent pivot
#

forms frontend and backend have it now

green oriole
#

Hmm, the apps has some scopes I'm not sure it really needs

patent pivot
#

(these links appear on the PR checks)

green oriole
patent pivot
#

hmm I'll have a look ak

#

weird because it explicitly says no accesss

green oriole
#

Huh

#

Need a restart maybe?

patent pivot
#

doesn't seem to be

#

I think it might be the write access it needs on PRs

green oriole
#

Well, it would need it only for the account it is configured on, not for everyone who visit the website

patent pivot
#

yeah

#

not sure

#

it might just not be specifying the scope and that is the defaults

crude gyro
#

A check is the correct thing to use.

#

a failing check doesn't mean "linting error"

#

that's just what you're personally used to

#

a failing check means "this isn't ready to merge"

#

a PR without a core dev approval is not ready to merge.

green oriole
patent pivot
#

lol yeah

gritty wind
#

As a counter, if I look at a PR and see failing tests, I will assume the author is working on updating the PR and wasn't using a draft

#

If all PRs will be marked with a fail, what use is it

patent pivot
#

policy-bot will continue to use checks, but stay in the "pending" stage (as shown in #dev-contrib message)

#

so you won't get the X, but you will not get the green for go

crude gyro
#

I think pending is infinitely worse and I hate this change.

gritty wind
#

I get what you're trying to say, but having everything red would make everything useless for the most part

patent pivot
#

I don't really see how pending is much worse, I think that a description saying the rules are not met and then linking to a site where you can see a visual representation of why makes sense

gritty wind
#

There is still that other suggestion

patent pivot
#

and this allows us to have more complex rules, like "if it touches a CI file do not pass until a devops member reviews"

crude gyro
#

pending, to me, means "checks are running and haven't completed yet, but this will soon change". Having everything in pending really triggers me a million times harder than having failing checks - which is semantically correct.

#

a core dev has not approved. we're checking if the core dev has approved. It's a failed check.

gritty wind
#

If you are really set against pending, we can compromise and only have it run on PRs that don't have a core-dev by default

cold moon
#

I have more seen pending than failing for such cases

gritty wind
#

That way what is pending is the assignment of a core dev to the pr

patent pivot
#

yeah, I think pending is the github norm, it's what I've used at work and on other repos where checks like this are enforced

crude gyro
#

I've never seen pending used like this

#

but okay

#

if anyone in the world has used it like this, I guess it's marginally less gross to me

#

What happens if the core dev requests changes?

gritty wind
#

I suppose, another alternative alternative would be to give only core devs write perms

crude gyro
#

does it then fail?

cold moon
#

I don't think giving write permissions only to Core Devs is good idea

patent pivot
#

hmmm, I believe that by default that is a success since it has received a core developer review.

#

@cold moon can you open a dummy PR to forms-backend

#

just change a file or something

crude gyro
#

so, if it failed the check on changes requested, passed it on approval, pending if nothing, then I can sort of see how that makes semantic sense

cold moon
#

I will change gitignore

patent pivot
#

cheers ks

#

actually before you do

#

let me just update the org review policy

#

to set this disapproval thing

green oriole
#

Failing will send an email though

#

I feel like it should still be pending

crude gyro
#

pending what. the core dev review has happened. It was not an approval. There is nothing pending. You have to make changes.

patent pivot
#

okay @cold moon policy updated

crude gyro
#

it sends an email? good, because you should be taking action.

patent pivot
crude gyro
#

I've totally missed that this was a thing

patent pivot
crude gyro
#

nice

patent pivot
crude gyro
#

that works for me. does the check really have to be called policy-bot main though

#

let's give it a very descriptive name

gritty wind
#

CDA

#

But really, Core Dev Approval

patent pivot
#

we can rename the first bit, I think the latter is just saying it's the review requirements for main

crude gyro
#

yeah, something like that

patent pivot
#

one second

cold moon
#

Core Dev Police

patent pivot
#

so Core Dev Approval: main is how it will look

crude gyro
#

that's better

#

not sure about capital A

#

seems a bit unlikely

patent pivot
#

yeah

crude gyro
#

but yeah I can live with this. thanks for changes.

#

you're very accommodating

#

I'll send the money to the usual account

patent pivot
#

hahahha

#

and then that Details link will link to the page I was screenshotting above

#

if we ever make more complex rules about CI/devops or whatnot then that'll appear in the flow

crude gyro
#

excellent

#

looks quite good

patent pivot
#

actually @green oriole it won't generate an extra email for requested review

#

it'll send the usual one when someone requests changes

#

but since it isn't github actions you don't get a vague "run failed" email

crude gyro
#

yeah. because that won't trigger it

patent pivot
#

yep

green oriole
#

Alright cool

surreal venture
#

Whenever I run a command, it is running twice for me, is it happening with anyone else?

gritty wind
#

The mod bot?

surreal venture
#

No sir-lancebot

#

like here

gritty wind
#

Huh, could you have an extra instance running without knowing?

surreal venture
#

Hmm... maybe that's the case

gritty wind
#

Try disabling one, and see if the commands still get processed

#

If you want to force stop all instances, reset your token

surreal venture
#

Yeah, I had two of them running

#

my bad

#

thanks!

nocturne hare
surreal venture
#

Sure, take your time!

nocturne hare
#

@crude gyro Can you iterate keys in the Async RedisCache?

#

Or do you have to call .items, and index/unpack the key from index 0

brazen charm
#

You'll have to iterate items

crude gyro
#

we used to have a keys but I think it was abandoned in a later iteration

#

we only model the actual redis stuff now.

#

when it was called RedisDict, I did have a .keys for it.

gritty wind
#

@trim cradle is bot/1319 ready for review or does it still need discussion?

green oriole
#

We are discussing it atm lemon_happy

trim cradle
#

@gritty wind we're discussing it in a mod channel. Thanks for asking!

gritty wind
#

Good stuff

green oriole
#

You can still review it though

gritty mortar
#

Hi devs, I wanted to start contributing, mostly reviews to the community, can someone help to identify where and what to pick up. Apologies if this is the wrong channel.

gritty wind
#

And, this is the right channel for such discussions.

gritty mortar
#

Thanks I will start with the setup

gritty wind
#

Once you do, you can start looking through the PRs for all three till you find something you feel capable of contributing to (any comments, suggestions, or modifications, even a 👍 can be helpful).

sullen phoenix
#

the reviewing guide is coming very soon™️

#

i’m think hem is finished with it actually

#

if that’s the case, it just needs to be released

green oriole
#

Hey @eternal owl, on sir-lancebot#540 you have a 2.2k line changes because of line endings, can you revert that please?

eternal owl
#

wait, I thought line ends are ignored :/

gritty wind
#

Only if you didnt change your default settings

eternal owl
#

ahh

gritty wind
#

You should be able to fix that by changing the autocrlf setting, and redownloading your project

eternal owl
#

reverted

#

aaand pushed, done

patent pivot
#

sir lancebot, site, bot and forms frontend/backend are now all using policy bot

patent pivot
gritty wind
#

It forces all PRs to need a core-dev approval to be merged. It is used so we get pending status instead of a failed check

patent pivot
#

more advanced review requirements basically

obsidian patio
#

Ahh, okay. Was this discussed before I arrived at the staff meeting?

gritty wind
#

it was not discussed in a helper staff meeting

#

scroll up in this channel for discussion

obsidian patio
#

I guess I just missed it then

#

Alrighty, thanks 😄

patent pivot
#

nah I did mention it in the news section

patent pivot
quasi crypt
#

Anyone know where I might find an expert on snekbox? I have an issue... Seems like if I send the server two requests at approximately the same time one or both gets an out-of-memory error (return code 137).

gritty wind
#

Sebastiaan was working on OOM issues recently, they might be able to work on this. I'll point him towards here if I see him

#

But out of curiosity, can you include some specific info like os, and snekbot version?

tawdry vapor
#

That error may be misleading since it just assumed that SIGKILL = killed due to OOM but really it could be coming from anywhere.

#

NsJail doesn't log OOM termination because it's actually handled by the kernel via cgroups. NsJail only directly handles killing for an exceeded time limit and therefore you'd see a log for that.

#

It may be an issue with how cgroups are set up where all nsjail processes share the same cgroup. I thought it would apply separately to each process but maybe it's more like a pool.

#

Can you open an issue with reproduction steps so I can remember look into it later?

quasi crypt
#

@tawdry vapor definitely. Thanks for being willing to look into it.

quasi crypt
#

Seems like it is a memory issue based on my testing... Hm.

shadow elbow
quasi crypt
#

lol TRUE

trim cradle
#

If I run pipenv run pre-commit in powershell, it says everything is fine. But PyCharm says that flake8 fails when I click "commit".

brazen charm
#

fails in what way?

trim cradle
#
                Flake8...................................................................Failed
                - hook id: flake8
                - exit code: 1
                
                Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of cre... (show balloon)
``` @brazen charm
#

I suppose I could try committing it using powershell

#

does git commit -m recognize \n?

brazen charm
#

I believe you can chain multiple -m for the subject and body

#

Do you have a global flake8 that pycharm could be picking up?

trim cradle
#

so git commit -m "main message" -m "secondary message"?

trim cradle
#

I was able to make commits earlier today

sullen phoenix
#

once you type in the commit message and close the editor, it'll commit

#

i just use nano for git

trim cradle
#

For some reason that didn't work either

PS C:\Users\Steele\development\projects\pydis\bot> git commit
Check for merge conflicts................................................Passed
Check Toml...........................................(no files to check)Skipped
Check Yaml...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
Mixed line ending........................................................Passed
Trim Trailing Whitespace.................................................Passed
check blanket noqa.......................................................Passed
Flake8...................................................................Failed
- hook id: flake8
- exit code: 1

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Loading .env environment variables...
'flake8' is not recognized as an internal or external command,
operable program or batch file.
#

I'll look into it some more tomorrow

brazen charm
#

Run it under the pipenv environment

sharp timber
#

^ it looks like pycharm is not using the virtual environment set in the directory for some reason (?)

gritty wind
#

Someone told me that was a bug before

#

(Windows specifically)

#

You'd either update the hook to make sure it actually uses the environment, or you change the pre-commit settings to run on system which would then use pipenv

#

The second solution won't work though, because you'll have to commit the modified pre-commit

#

So you're left with modifying the file

surreal venture
#

@trim cradle

'flake8' is not recognized as an internal or external command,
operable program or batch file.

Are you sure you have it installed?

gritty wind
#

Its probably installed in the pipenv, but the precommits don't use the env correctly on windows

#

(and possibly other oses)

surreal venture
#

Well, you can always try installing it...

#

because pre-commit is working fine for me on Ubuntu

#

I uninstalled my global flake8 and ran pipenv run lint and it worked well (using the virtual environment)

gritty wind
#

The thing about the global flake8

#

is that its caused problems for me and a couple other people, by reporting false negatives (returning no errors when the workflow fails on github)

#

Might've even been on one of steler's commits, i don't remember

gritty wind
#

It seems to just be using any disapproval, is that intended?

cold moon
#

I think this is meant that all users with write access that require changes count to there

#

But only Core Devs approvals count

gritty wind
#

The check should be renamed then?

cold moon
#

No, this still checks Core Dev approvals.

#

Just also indicates other disapprovals

gritty wind
#

There can be cases of disapprovals, with approving core devs

cold moon
#

Not sure how this work in such cases.

gritty wind
#

It'll still fail I'd assume

patent pivot
hardy gorge
#

@patent pivot Does it take core dev membership into account in the check?

#

What happens if a regular org member approves, but a core dev has not yet approved yet?

gritty wind
#

They are two independent checks on the website (so it'll still be pending), but any disapproval would mean failure apparently

patent pivot
#

Yes, core developer approval passes the check, disapproval from anyone in the org fails the check

crude gyro
#

that's fine

hardy gorge
#

That looks like the right setup to me

hardy gorge
obsidian patio
#

Nice 😄

surreal venture
#

Just curious, do changes in the .github folder not show as a commit? Because I just updated my branch and git pulled, and it does show changes, but it doesn't show as any commits in my forked repo:

#

(I forked it before the name change, if it helps)

trim cradle
#

@gritty wind I hadn't yet pushed what I have locally when you gave your feedback on github, so I converted the PR to a draft to make that more clear.

gritty wind
#

It wasn’t a super detailed review anyways, I’ll check back on it when it’s ready 😄

trim cradle
#

Is it possible that flake8 is objecting to my commit message, and that's why I can't commit?

green oriole
#

It doesn't run on commit messages, no

#

Well, at least our default setup doesn't

hardy gorge
#

What kind of output are you getting, @trim cradle ?

trim cradle
#

...

Flake8...................................................................Failed - hook id: flake8 - exit code: 1 Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. Loading .env environment variables... 'flake8' is not recognized as an internal or external command, operable program or batch file.```
#

PyCharm is using the correct virtual environment, but my guess is that it's not using the pipenv that's in that environment.

#

if that even makes sense

#

Yes, I'm using a "Virtualenv environment" and not a "Pipenv environment"

hardy gorge
#

pre-commit uses pipenv run to run flake8 to make sure it selects the appropriate environment

#

I assume that's what is not working for you

#

What I do is create an environment with pipenv sync --dev from the command line and then use the "existing environment" option in PyCharm, selecting the pipenv venv, as I don't like how PyCharm manages pipenv environments.

#

However, what happens if you try to run flake8 manually with the venv activated?

hardy gorge
#

what does it give you for flake8 --version?

gritty wind
#

Theres a pycharm bug (possibly just on windows)

trim cradle
gritty wind
#

Someone walked me through fixing it a while ago

#

and no, a system install doesnt work as intended

green oriole
#

What does pipenv run lint gives you? Or you don't use pipenv at all?

gritty wind
hardy gorge
#

It could still be that it bypasses your environment, uses a flake8 version installed systemwide, without our plugins

green oriole
#

I guess you can skip the checks then

#

It is the option -n with the CLI

trim cradle
#

I think it might be working now. One moment and we'll see

clever wraith
#

how do i make a dockerfile for snekbox

mellow hare
#

The code review guide is done!

shut aspen
clever wraith
#

how can i use it?

shut aspen
clever wraith
#

damn

#

its that simple

shut aspen
#

but its also on docker hub

gritty wind
mellow hare
#

HA

shut aspen
#

you can just pull down the image instead of runnign it yourself

#

thats what i do

clever wraith
#

yeah

shut aspen
#

this is my entire snekbox code for my bot

mellow hare
shut aspen
#

i just threw it into a compose file

clever wraith
gritty wind
shut aspen
#

have you installed docker?

#

and is it running

clever wraith
#

im on windows if that changes anything

shut aspen
#

what is that?

clever wraith
#

container list

shut aspen
#

so snekbox is running then?

#

whats the issue

gritty wind
#

Can you upload the output of running dir as well?

#

(btw, you don't need to build the image yourself if you are just using it)

clever wraith
#

me?

#

oh

gritty wind
#

Yeah

shut aspen
#

you can just pull from docker hub

#

easier

clever wraith
#

oh i dont need to build it?

#

damn

shut aspen
#

no its on docker hub

clever wraith
#

yeah

gritty wind
#

You only need to build it if you're modifying it yourself

clever wraith
#

Hey guys I am new

gritty wind
#

Hello

clever wraith
#

can u please help me out

#

im not modifying it

#

one sec let me type dir

shut aspen
#

dockerhub

#

from the repo

clever wraith
shut aspen
#

i use compose

clever wraith
#

I wanna learn python!

shut aspen
#

but its the same thing basically

gritty wind
#

It was erroring out because the copy instruction failed

clever wraith
#

please help me out

gritty wind
#

There should be a config folder there too

shut aspen
#

what did it do

clever wraith
#

anyone?

gritty wind
shut aspen
#

ohh scale said it

clever wraith
#

thank you!!!!

gritty wind
clever wraith
#

thank you

gritty wind
#

But this is only relevant if you still want to build yourself

clever wraith
shut aspen
#

you dont need that tho

#

you literally only need to pull the image

clever wraith
#

ok

#

i have everything running, right

#

so now i need to make requests

gritty wind
#

Should be, yeah

shut aspen
#
  snekbox:
    image: pythondiscord/snekbox:latest
    init: true
    ipc: none
    networks: 
      - ClemBotNet
    ports:
      - "8060:8060"
    privileged: true```this is literally the only time snekbox is mentioned in my bot
#

compose pulls the image, runs it on the docker network and assigns those ports

gritty wind
#

You can get the address and port through docker desktop

clever wraith
#

yeah

#

it's running on 8060

shut aspen
#

ideally you run BOTH yourbot and snekbox as containers

clever wraith
#

so how do i make requests to it? as in what do i include in the request

shut aspen
#

then you can network them with docker

clever wraith
#

and do i have to make requests with a specific module or

gritty wind
#

The api docs are here

clever wraith
#

oo

shut aspen
#

also here

#

the comment in on_post is all you need

clever wraith
#

so i do localhost:8060/eval/<code>?

#

or is it a bit more complicated

shut aspen
#

have you ever worked with an api before?

#

like http stuff

#

or is this your first time

clever wraith
#

yeahh

#

i've worked with one

shut aspen
#

its not a query string

#

its a post

#

its a request BODY

clever wraith
#

ahh ok ok

#

i see

gritty wind
#

(Also don't forget its a POST endpoint)

clever wraith
#

i can make requests with aiohttp, right?

shut aspen
#

yes

clever wraith
#

good

shut aspen
#

this is how i did it

#

go wild

#

as you can see its dirt simple

#
    async def _post_eval(self, code) -> t.Union[str, None]:
        data = {
            "input" : code
        }

        json_data = json.dumps(data)

        async with aiohttp.ClientSession() as s:
            async with s.post(BotSecrets.get_instance().repl_url, 
                    data=json_data, 
                    headers=HEADERS) as resp:
                if resp.status == 200:
                    return json.loads(await resp.text())

clever wraith
#

so it returns text with the eval result?

shut aspen
#

it returns that json that you saw in the comment i just linked

clever wraith
#

yeah

#

whats in that json

shut aspen
#

its in the comment lol

clever wraith
#

what comment

shut aspen
#

the one i linked

clever wraith
#

ooo

#

thank you

shut aspen
#

np

clever wraith
#

@shut aspen it says localhost:8060 is an invalid url

#

should i replace it with my ip address

shut aspen
#

that is an ip

clever wraith
#

yeah

#

should i replace it with 192.168.x.x 127.0.0.1, my public ip etc

shut aspen
#

well no cuz its not running on your public ip

#
    "ReplUrl": "http://localhost:8060/eval",
#

this is in my config

gritty wind
#

Try adding http to the beginning of that

#

yeah

clever wraith
#

damn i even forgot the /eval oops one sec

#

one sec i forgot the headers

#

im getting http code 400

gritty wind
#

What does your code look like right now?

clever wraith
#

let me paste it

#

oh

#

i accidentally pasted twice sorry lol

shut aspen
#

whale

#

there ya go lol

shut aspen
#
    async def _post_eval(self, code) -> t.Union[str, None]:
        data = {
            "input" : code
        }

        json_data = json.dumps(data)

        async with aiohttp.ClientSession() as s:
            async with s.post(BotSecrets.get_instance().repl_url, 
                    data=json_data, 
                    headers=HEADERS) as resp:
                if resp.status == 200:
                    return json.loads(await resp.text())
clever wraith
#

hm? @shut aspen

shut aspen
#

how does yours differ from mine

clever wraith
#

you used json.dumps?

shut aspen
#

yee

clever wraith
#
Ignoring exception in command eval:
Traceback (most recent call last):
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\onyx\onyx\main.py", line 54, in eval
    async with s.post("http://localhost:8060/eval", data = {"input": code}, headers = HEADERS) as resp:
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\aiohttp\client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\aiohttp\client.py", line 376, in _request
    headers = self._prepare_headers(headers)
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\aiohttp\client.py", line 836, in _prepare_headers
    headers = CIMultiDict(headers)
TypeError: CIMultiDict takes either dict or list of (key, value) pairs

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\vndev\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: CIMultiDict takes either dict or list of (key, value) pairs
#

i get this traceback

#

i did HEADERS = json.dumps(HEADERS)

shut aspen
#

the headers can be a normal dict

clever wraith
#

oh?

#

oh wait

#

oh i see

shut aspen
#

i think you can do json={dict}

#

but i did data=json.dumps

#

probably the same thing

#

try both /shrug

clever wraith
#

400 again

gritty wind
#

code = None

clever wraith
#

oohh

#

i named two variables the same thing

shut aspen
#

the code

#

ohh ya what scale said lol

#

he beat me

clever wraith
#

lmao

gritty wind
#

You can actually just delete lines 8 & 9

#

They don't do anything useful

#

(and as more of a sidenote, don't name your variables after builtin python ones, such as input)

clever wraith
clever wraith
gritty wind
#

It is, but why introduce unneeded complexity ig

#

^ That was to your first comment on input

#

Your else currently has a return

clever wraith
#

oh

gritty wind
#

Which means your variables are only used if you go into the if

clever wraith
#

so that means i dont need it?

#

im a bit confused

gritty wind
#

Yeah

clever wraith
#

ok

gritty wind
#

!e

if True:
    a = "hello world"
else:
    exit()
print(a)```
stable mountainBOT
#

@gritty wind :white_check_mark: Your eval job has completed with return code 0.

hello world
clever wraith
#

how do i install a package from github instead of pypi

gritty wind
#

A github python package? It would depend on the package, but there should be instructions on the package's repo

clever wraith
#

ok one sec

#

oo yeah i found it

#

one sec brb

trim cradle
gritty wind
#

When you have a terrible programmer such as myself publishing it

late wolf
#

Is there an issue open on making the setup for contributors easier?
If so could someone link it to me, i would like to take a look,
happen to ping me

green oriole
#

Hey @late wolf, we are currently working on a project, smartconfig, in order to simplify the whole setup process. Once it is done, you can be sure that I'll work 'em! In the meantime, if you have any idea or suggestion for the guides, feel free to comment on meta#60

#

.issue 60 meta

dusky shoreBOT
late wolf
#

ohh

slim widget
#

Hey, I was wondering what people think about adding a .tldr command to Sir Lancebot.

#

this I can vouch for the quality of these pages. I use them regularly.

patent pivot
#

oh hey

#

that's a great tool

green oriole
#

I didn't know about this website, I'd 100% support this, it looks very cool

eternal owl
#

isn't that similar to man pages?

patent pivot
#

the readme sums up how it isn't manpages

slim widget
#

Yep, but they're shorter and emphasise common examples.

eternal owl
#

alright

slim widget
#

This might make a good first-contribution for someone?

#

Since I think it should be relatively straightforward.

eternal owl
#

I think, yes

#

I think using a line paginator will also be helpful

#

during the implementation

#

just in case

patent pivot
#

yep

green oriole
#

Hmm, I am not sure, I usually label as first good contrib anything that would help you familiarize with the code base, that isn't really the case here

#

That could work, I dunno

#

Yeah, if it is a well written issue that should be fine

#

sorry thinking out loud again

trim cradle
#

self.guild = self.bot.get_guild(Guild.id) -- The expression on the right returns None when this is in the init method for a cog, I guess because it runs before the bot is fully online. I checked the docs to see if there's an async method for cogs that runs once the bot is fully online and didn't see one. Is there something I'm missing?

sullen phoenix
#

we have a method just for that

#

wait_until_guild_available

trim cradle
sullen phoenix
#

just await that method before getting the guild, and you'll be fine

trim cradle
sullen phoenix
#

no, i'd await in on_ready

#

or

#

you can create an async method and then create a task for it in __init__

#

let me find an example

trim cradle
#
    def __init__(self, bot: Bot) -> None:
        self.bot = bot

    @Cog.event
    async def on_ready(self) -> None:
        await self.bot.wait_until_guild_available()
        self.guild = self.bot.get_guild(Guild.id)
        self.developer_role = self.guild.get_role(Roles.verified)
#

so I can't just do this?

sullen phoenix
#
class SomeCog(Cog):

  def __init__(self, bot: Bot) -> None:
    self.bot = bot
    self.guild = None
    self.bot.loop.create_task(self.get_guild())

  async def get_guild(self) -> None:
    await self.bot.wait_until_guild_available()
    self.guild = self.bot.get_guild(Guild.id)
#

no, you have to wait for the guild to be available

#

either way works

trim cradle
#

how about now?

sullen phoenix
#

i'm unsure if Cog.event exists, i've only seen Cog.listener()

#

but other than that, yeah

#

it's also good practice to initialize those variables in __init__ as None

trim cradle
#

PyCharm was insisting that I do that, but I figured this wasn't the edge case they were discouraging.

brazen charm
#

imo it's not really necessary when you have a clear initializer coro like that, just adds some noise to the init

#

Make sure that the coro finished before going to the parts of the code that use the vars and you should be good

late wolf
#

Hey so I had an idea.
Instead of us having to replace all the id's manually, why not make a setup command, which creates the config-yaml file, gets their id of the channels using their names, and adds that to the config-yaml file.

short snow
late wolf
sullen phoenix
#

@late wolf we’re already working on a project called smartconfig

late wolf
#

oh ok

cold moon
#

I think one part of site is missed in dewikification: Contributing section. This should be in different app. Should I create issue?

patent pivot
#

I thought we settled on using the content application for that

cold moon
#

Content app doesn't support bulma widgets like contributing pages have

surreal venture
hardy gorge
#

I'm not sure.

short snow
#

https://cht.sh/ what do u guys think about this compared to tldr pages. it is easier to get data from this in a nice way. i have made code also for it

hardy gorge
#

Hey @eternal owl, could you give me an update on the error handler PR for @dusky shore? Maybe we can work out a way to get it to a mergeable state soon so that we can merge the Advent of Code changes soon as well.

eternal owl
#

sure

#

I will commit now

gritty wind
#

As a counter argument, tldr can be self hosted, and has a python library, while cht.sh would require extra http requests and parsing to remove the non-tldr section.

#

The page mentions a github page, which isn't linked, so I haven't searched too thoroughly

thorny obsidian
#

The tldr makes it clearer what's available and how to use it. cheat.sh doesn't make it obvious what exactly I'm supposed to do. Their github makes it slightly clearer, but I don't think I'd remember the syntax for it

green oriole
gritty wind
#

There is a TLDR header on some pages which is pretty much what the tldr content is

#

But not all pages have it, and some have really bad formatting

#

Hey @hardy gorge mind sharing what might be wrong with the webhook?

#

Is it just authentication or something

green oriole
#

Which webhook?

gritty wind
#

Check the latest two messages in #dev-log

#

Its the webhook for pr runs

hardy gorge
#

It is

#

It's what I feared and kinda hoped

#

Some secrets are not available in a pull_request run from a fork

gritty wind
#

That seems like a mostly good thing

hardy gorge
#

yes

#

but there was no easy way for me to test it

#

Anyway, I have a solution ready, which also ensures that we're actually running our workflow file instead of a potentially modified one in a fork

green oriole
#

workflow_run?

hardy gorge
#

That could work, but that will make getting information about the run into the webhook embed more difficult later (which is something that's planned for later)

#

At the same time, it could be the safest

green oriole
#

Hmm

hardy gorge
#

You know what, I'll figure out the passing of output later. There are other ways of doing that.

green oriole
#

Can't get everything you need from the API, or GraphQL?

hardy gorge
#

Let's just fix this

eternal owl
#

@hardy gorge I think it will be better to use error.original in the local error handler (snakes cog) as the FileNotFoundError (aka OSError) does occur if the file is not found (example: https://github.com/python-discord/sir-lancebot/blob/master/bot/exts/evergreen/snakes/_snakes_cog.py#L178)

#

just error will be CommandInvokeError

#

I am not sure how the .snake video and .snake get commands would raise an OSError

#

but the .snake card command can raise one(check the example link above)

hardy gorge
#

I'm not that intimately familiar with the code and not looking at it right now; do any of those commands use Pillow's Image?

eternal owl
#

yes

#

the card does

#

Image.open

hardy gorge
#

Because Image.open raises an OSError when an empty stream of bytes is passed to it

#

I suspect that's why they added the handler

eternal owl
#

not empty, but even a file which is not found

hardy gorge
#

We create a BytesIO from downloaded bytes, right?

#

If that BytesIO stream does not yield bytes, Image.open does raise an OSError

green oriole
#

That's a weird behavior

eternal owl
#

then that stream is passed into Image.open

green oriole
#

All in all, do we even need the special case? I haven't looked into it too much, it just change the error message a little bit, right?

eternal owl
#

yes, just gotta change it use error.original instead of just error

#

in the isinstance

hardy gorge
# green oriole That's a weird behavior

It's because OSError is raised for when I/O fails. This is usually when the file stream you're trying to read does not give you anything (or is inaccessible), but we're using a virtual in-memory stream.

green oriole
#

I mean, OSError isn't very adapted here, nothing goes through the OS

hardy gorge
#

It's because you'd normally pass it an actual file stream.

#

It's not that Pillow tries to work out whether or not you're using an actual file or faking it using an in-memory file object-like stream

#

It just tries to read from your (potentially pseudo) I/O stream

#

And if that fails, it raises the appropriate error

eternal owl
#

I just tested with an incorrect path and it gives me FileNotFoundError

green oriole
#

I'm not sure if the FileIO abc group intends you to use OSError here, since the actual methods can take the actual data from anywhere

#

well, that's not really the point anyway

hardy gorge
#

It kinda is the appropriate error, as OSError is the exception defined by the docs to be the one to be raised for I/O-related errors.

green oriole
#

when a system function

eternal owl
#

I just tested with an empty buffer, raises OSError

green oriole
#

And here you are just reading from memory using a non-system method

#

Also, you don't have any errno to fill in

eternal owl
#

btw, the actual image error is UnidentifiedImageError

#

which comes under OSError

#

also, I think I can remove the error handler for get_command and video_command, I don't see how these 2 commands can raise an OS error.

green oriole
#

Let's keep this for another PR that isn't time critical lemon_pleased

#

Yeah, I think you can do that, what do you think @hardy gorge ?

trim cradle
#

Who's bot is running on the test server, out of curiosity?

green oriole
#

Senjan's and Hem's bots are running

trim cradle
#

Just out of curiosity, how expensive is it to have the same kinds of event listeners in multiple cogs? I assume there's one component of the bot that's actually doing the listening, and when that happens it calls the event listener in each cog.

gritty wind
copper pawn
#

Hey I am looking to learn the pytest library. Does anybody need some testing for a python project so that I can practice? Add me/message me if you do

gritty wind
trim cradle
#

How much of the bot's computation time is spent checking messages against the regular expressions?

tawdry vapor
#

It is undoubtedly you, if anyone, that would be the first to profile that.

green oriole
#

Haha

#

Do we even make sure that we don't have a catastrophic backtracking on those

rapid swallow
#

I've always wondered about that

cold moon
#

@cold island About snowflake command, do you mean creating custom converter? discord.py don't have in-built snowflake converter.

cold island
cold moon
#

Oh, I didn't know that

rapid swallow
#

what's the snowflake command?

cold island
rapid swallow
#

oh okay

#

thank you for the link

rapid swallow
gritty wind
#

I doubt that’s tracked

rapid swallow
#

do you guys use some fancy tree thing when checking against the blacklisted words in the database

#

hmm, alright

surreal venture
#

oh wait nevermind

hardy gorge
#

It's just really, really, really bad at guessing the right language

#

change the extension manually and it'll be better

trim cradle
#

I believe messages from staff members aren't checked.

rapid swallow
#

hmm

#

how many blacklisted words do you guys have?

trim cradle
#

I will go check and report back

#

There are currently 60 patterns.

#

Some patterns might be intended to capture multiple words depending on which similarly-spelled things you think of as the same word

brazen charm
#

@patent pivot didn't the saving on the hastebin default to .py?

patent pivot
#

it did — though that disappeared with the migration to pydis infra since people complained about it

rapid swallow
#

Thank you Stelercus lemon_pleased

obsidian patio
#

@patent pivot do you think adding an optional option to change language, defaulting to python, could be added?

patent pivot
#

well, we don't maintain hastebin, so we'd have to maintain a fork if we did that

brazen charm
#

Huh, wouldn't think that'd be a problem with how it's being used, saw more people confused why they were getting coffeescript

patent pivot
#

we'd either fork it or raise an issue upstream

trim cradle
patent pivot
#

lol

obsidian patio
#

Hmmm, yeah

patent pivot
#

the way we deploy it already is rather hacky

hardy gorge
#

did people have an issue with automatic py?

#

I'd say people now have to change it to py more often than people having to change it from py to something else

patent pivot
#

yeah, I'd agree

#

I mean we can add the defaulting back to py, but it's just something else to maintain

obsidian patio
#

It’s probably better to default to py and not maintain a fork for some features that most people probably don’t use. If you’d be interested in opening an issue in the hastebin repo about allowing users to pass the language in some sense, that would be cool though

patent pivot
#

hastebin upstream is kinda dead

#

I don't have the time to write up an issue, but if someone wants to open something brief on https://github.com/seejohnrun/haste-server then we'd definitely set that option if implemented

quasi crypt
#

Anyone know the best way to get snekbox running on GCP? I've tried...

  • Cloud Run (fails because it can't find nsjail after booting up -- maybe because no privileged mode).
  • Compute Engine (adds a ton of authentication overhead / non-severless setup seems expensive. Not sure if it works, deleted the container once I read their auth docs)
  • App Engine (currently trying it now but I suspect it'll fail like Cloud Run since I don't see a privileged option here either)
tawdry vapor
#

Compute engine should be able to run privileged containers. I'm not sure about the others.

#

GKE also supports privileged containers

#

Maybe you can find a way to configure the k8s service account cloud run uses so you can enabled privileged containers

sharp timber
#

!warn 533618406767722499 please do not post memes randomly into the server

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied warning to @ivory drift.

quasi crypt
#

I wonder if I'm overcomplicating things by trying to use snekbox for my needs. I need something that runs serverless in the cloud that can run arbitrary code... And I like the memory limits snekbox provides... But maybe I could just run exec in cloud functions with a 50mb memory limit per request and call it a day? I mean, if it's severless I'm not sure there's a ton of risk there. Tried to Google it and the jury seems to be out -- someone mentioned protecting my source code would be a factor, but my source code in that case would just be exec

tawdry vapor
#

Not sure. I thought that setting a limit on the container will cause it to kill the container.

#

Sorry, you said cloud functions. I don't know about those.

#

Keep in mind that NsJail is built on linux kernel features like cgroups and namespaces. You can think of it as a nice wrapper for those features. There may be a feasible way to use those features with a container directly.

#

After all, containers are implemented using those same features

gritty wind
#

It's a PR from before the migration that had the migration recently merged into it

#

Shows up fine on the site though

patent pivot
#

interesting

#

thanks for letting me know @gritty wind, I'll have a look shortly

gritty wind
#

Take your time

patent pivot
#

looking into things

#

well

#

I see the log

#
"error":"failed to compute approval status: failed to list commits: 3 commits were not found while loading pushed dates
gritty wind
#

I forgot you were looking into this when I approved 👀

vocal wolf
#

uh oh, did something break?

green oriole
#

Yup

vocal wolf
#

D:

sullen phoenix
#

site ded

patent pivot
#

hahaha no it's alright, I can go over logs scaleios

#

site is dead?

green oriole
#

Well, cloudflare is probably dead

patent pivot
#

oh

green oriole
#

Yup

vocal wolf
#

o noes site is ded

green oriole
#

Look at your pings haha

gritty wind
#

oh no

vocal wolf
#

lol confirmed from at least 3 coasts

patent pivot
#

yeah looks healthy here

gritty wind
#

Its not loading for me, possibly just my shitty internet

sullen phoenix
#

site's dead for me

vocal wolf
#

smae

green oriole
#

Probably cloudflare's shitty internet

gritty wind
#

lol

vocal wolf
#

heck cloudflare

sullen phoenix
#

weird, my sites haven't had any issues

vocal wolf
#

hmmm

sullen phoenix
#

it's not a cloudflare issue

gritty wind
#

Even if its a cloudflare issue, its unlikely all off cloudflare fails at once

vocal wolf
#

yeah site/cloudflare is very much ded

#

oh wait

#

bruh

gritty wind
#

Now we can't blame CF :P

cold island
#

Getting this when trying to start up @dusky shore. Anyone familiar?

gritty wind
#

Check your site config

#

Either that, or redis

#

Actually, from that stack trace, definitely redis

cold island
gritty wind
#

It isn't on that page (yet)

#

but set the fake-redis env var

#

USE_FAKEREDIS=True

#

If you want to, you could setup redis, but it isn't easy on a windows machine

brazen charm
#

Fairly easy through docker

cold island
#

excellent, that did it. I'll update the page

gritty wind
#

Actually, if you hold off for a minute

#

I might be able to dig through the config for all the env variables

cold island
#

Go for it

#

(you can edit that page too btw)

gritty wind
#

.

#

I can add them myself, but I first have to figure out which ones are worth adding

#

A bunch of these are not so useful and would pad out the page quite a bit like the AoC ones

#

I think I will add the fake_redis and Tokens list for now

cold island
#

I think having a record of them would be useful

gritty wind
#

Alright, I'll see what I can do

cold island
#

Although if you're actually using redis then you don't need fake-redis right? so it's mandatory, but it's either or

gritty wind
#

I've added the tokens, look over them if you have a sec

#

I'd also appreciate someone looking into the docs for wolfram's api

cold island
#

Awesome, thank you

#

This might even work as its own subpage where we can list all variables

gritty wind
#

Let me finish this list first

gritty wind
#

Ok, I've gone ahead and done that

#

Feel free to copy it to another page if you want to

#

I might do the same for the bot and the site tomorrow

clever wraith
cold island
#

I don't think we're using it anywhere in the bot atm

clever wraith
#

looking to implement #1320

clever wraith
cold island
#

If we're not using it then it's probably not in the config. I can take a look

brazen charm
#

No, the id is not stored anywhere atm as it's just a static message

patent pivot
#

I doubt we'd make that a constant

#

fetching the last message sent by the bot in the channel sounds wiser

clever wraith
#

making the channel a constant is what i mean

cold island
clever wraith
patent pivot
#

oh right, yeah

cold island
#

I assigned you to the issue@clever wraith

clever wraith
#

thank you

#

how should i get the latest message? i was thinking of pulling it from channel.history but i don't know if there's a better way you guys use

cold island
#

or is it "I assigned the issue to you"? 🤔

gritty wind
#

He’s handling the issue, so “he’s assigned to it”

clever wraith
cold island
clever wraith
#

hm