#dev-contrib

1 messages · Page 4 of 1

vale ibex
gritty wind
#

You’re missing the actual file

#

In the URL

stable mountainBOT
#

.github/workflows/lint.yaml lines 52 to 56

- name: Setup python
  id: python
  uses: actions/setup-python@v2
  with:
    python-version: '3.9'```
stable mountainBOT
#

.github/workflows/lint.yaml line 105

${{ steps.python.outputs.python-version }}-\```
gritty wind
#

Oh lol

vale ibex
#

it's just so that you can grab the exact version of python lower down in the workflow

gritty wind
#

Sure that sounds fine (will GitHub propagate it?)

vale ibex
#

hmmm

#

good point

gritty wind
#

I can make it a general output

vale ibex
#

yea might be useful

gritty wind
#

I’m out and about atm, but if you PR it I should be able to review it

vale ibex
#

Yea I'll have a play

gritty wind
#

Awesome

#

Sick scale tips: fork it so you can test your changes

#

Has to run in actions though, haven’t figured out how to do it locally

vale ibex
#

nah dude, I expect write to main privileges

#

thanks

gritty wind
#

Devops has write perms to all my projects by default

vale ibex
#

oh lol

gritty wind
#

Very good people, very efficient

vale ibex
#

time to forcepush author tags

#

ty

gritty wind
#

I stole all this from python 🧌

#

If you go back far enough, there is probably an actual author credit to you

#

I wonder if poetry will ever fix that bug I submitted a fix for

vale ibex
#

hmmm this is very weird

gritty wind
#

cough any poetry maintainers here

vale ibex
#

I am guessing the pre-commit-cache is also caching the python version

#

and not respecting the pythonLocation env var

gritty wind
#

Is this the tests on actions?

vale ibex
#

nah, this is a seperate project at work

#

I'm just rubber ducking lol

gritty wind
#

Oh lol

vale ibex
#

I have pytohn verison pinned to 3.10

#

so the cache has 3.10.5

#

but now it's trying to use 3.10.6

gritty wind
#

Ohhhhhh

vale ibex
#

setup python uses 3.10.6, but the cache has 3.10.5

gritty wind
#

Shouldn’t the cache miss then

#

Or did I forget to encode python version

#

I remember there’s a key I forgot to ever add

stable mountainBOT
#

setup-python/action.yaml line 84

${{ inputs.python_version }}-${{ inputs.dev }}-${{ inputs.working_dir }}\```
vale ibex
#

it's there

gritty wind
#

Hm

vale ibex
#

ahhhhhh

#

it's using the input

#

not the actual python version

#

IE input = 3.10, actual =3.10.6

gritty wind
#

Yeah we don’t have access to that till after

#

Ok I see

vale ibex
#

you have accedss to it further up

gritty wind
#

Actually we can export it

stable mountainBOT
#

setup-python/action.yaml line 61

- name: Setup python```
gritty wind
#

Yeah

vale ibex
#

export it from this

gritty wind
#

Alright that sounds like a good place to export it for the cache and the output

vale ibex
#

time to read up how to export props from a workflow lol

gritty wind
#

I think I do it further down

#

It’s a CLI command

vale ibex
#

oh, it's the echo thing

gritty wind
#

Export a bar or something

#

Yup

#

It’s documented thoroughly

#

In a million page document

stable mountainBOT
#

setup-python/action.yaml lines 29 to 32

outputs:
  cache-hit:
    description: "Was there a cache hit for the python cache."
    value: ${{ steps.python_cache.outputs.cache-hit }}```
vale ibex
#

ez

#

well, I can get some OSS credits at work now

gritty wind
#

Oh yeah that should work too

#

Lmfao

vale ibex
#

your repo has been graced by Biosite Systems OSS team

gritty wind
#

This is OSS in the sense you and pydis use it

#

Thank you I’ve made it now

vale ibex
#

wait wut

#

poetry lock --no-update to bump the version removes all the metadata.files

gritty wind
#

What an amazing command

#

It’s fine to update lol

vale ibex
#

HassanAbouelela/actions#6 should do it

dusky shoreBOT
vale ibex
#

huh wait, all the metadata.files got wiped out anyways

#

weird

gritty wind
#

I don’t think you pushed any code lol

vale ibex
#

yea I was inside the tests dir so git add . didn't add the code lol

#

forcepushed

gritty wind
#

Awesome just some doc and version bump stuff

#

Version bump in root Readme and caches, and doc updates in the setup python Readme

#

Oooh I should do GitHub docs

gritty wind
#

I encode the action version in the cache keys to prevent cache mishaps

#

It probably doesn’t matter here though

vale ibex
#

ahhh, yea

#

pushed

gritty wind
#

Oh you fixed the bug too

#

Sick

vale ibex
#

lol which bug?

gritty wind
#

The one in your last commit

vale ibex
#

ahhh yea

gritty wind
#

Fun fact

#

You can’t create releases on GitHub mobile

vale ibex
#

lol

vale ibex
gritty wind
#

I see no issues

#

If I haven’t fucked anything up

vale ibex
#

very cool

#

CI runs fine using that hook 🎉

But it's not a real test since it was a cache-miss due to the version bump

gritty wind
#

The tests do check that caching doesn’t error

vale ibex
#

ahh cool cool

gritty wind
#

I’ll add a regression test for that but later

#

I think I’ll just use your described setup lol

vale ibex
#

hah ye

static canyon
#

Any chance you're able to look over it? Still have absolutely no clue what's going on

vale ibex
#

so I'm guessing resolved isn't getting set in your setup?

#

msg.reference.resolved also needs to be a MockMessage, with a MockMember as the author

#

fwiw, if you do poetry run task test and get the 3 failures, you can do poetry run task retest just to run those 3 again

static canyon
#

When I run the tests as poetry run task path_to_file.py everything passes, which is what I don't understand

vale ibex
#

poetry run task path_to_file.py doesn't sound valid

#

That's not a task

#

The tests are definitely not passing though. I'd suggest using the test and retest tasks.

gritty wind
#

Or run it in pycharm, it’s a very gud runner

#

I’ll be home soon, so I’ll take a look too

vale ibex
static canyon
#

Lemme try fixing it

vale ibex
#

alternativly, you can set the message object such that this if statement runs```
if msg.type != MessageType.reply and not msg.reference:
continue

static canyon
#

Since I'd need the .reference

static canyon
static canyon
#

Just a question of whether we want tests to ensure that reply mentions aren't counted

#

If we don't care about adding that test, then all I need to do is reference=None

#

If we do care, then we need a new MockReferencedMessage class

gritty wind
#

hmm

#

!docs discord.Message.reference

stable mountainBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

gritty wind
#

It's a relatively simple model, and you can probably auto mock most of it's fields

#

If you want to set it up, go for it

#

If you don't, don't

static canyon
#

I'm not that familiar with mocks, but don't mind learning

gritty wind
#

We don't have a particularly strong policy on testing, at least for bot, so it's entirely up to you

static canyon
#

I'll look into it when I have more time

#

It'll be good to learn

gritty wind
#

Sure, take your time

vale ibex
#

!d r

stable mountainBOT
#
Inventories refreshed
gritty wind
#

Django have finally added support for async views and ORM

#

Now if DRF can add it 😔

gritty wind
#

Anyone know why django is complaining about a model I created? The field I believe it's complaining about is:

    last_updated = models.DateTimeField(
        help_text="The date and time this data was last fetched.",
        auto_now=True,
    )

With the traceback:

django.db.utils.ProgrammingError: syntax error at or near "None"
LINE 1: ...timestamp with time zone NOT NULL, "name" varchar(None) NOT ...
                                                             ^

But I took that field straight from another model. Makemigrations was fine, the exception happened during migrations

Full migration: https://paste.pythondiscord.com/facilafowe
Startup log and traceback: https://paste.pythondiscord.com/oxizakosiy

#

Actually it's complaining about this one

    name = models.CharField(
        help_text="The tag's name.",
        primary_key=True,
    )
#

Alright it's because I'm an idiot, max_length is a required argument

gritty wind
#

Am I safe to assume that all tags in the bot repository are safe and won't be used for XSS or other exploits?

#

(I'm rendering them on site)

gritty wind
#

@vale ibex remember the test failure on site from a while back which I couldn't explain?

#
Failure
Traceback (most recent call last):
  File "C:\Github\PyDis\site\pydis_site\apps\api\tests\test_infractions.py", line 103, in test_list_all
    self.assertEqual(infractions[0]['id'], self.voiceban_expires_later.id)
AssertionError: 24 != 28
#

Still no repro though

#

I hate the coverage requirement on site

#

I added one feature, and suddenly the entire coverage dropped 10% from a 100

#

How little code is there on site

gritty wind
#
Coverage failure: total of 100 is less than fail-under=100
#

Thank you coverage, very cool

#

The only "miss" is a stupid partial :P

#

What the fuck, apparently a skipped unittest counts negatively towards your coverage. Why do the unittests themselves count towards the coverage anyway

#

Hahaha the tests are continuing to troll me

- [<Tag: Tag object (first_tag)>, <Tag: Tag object (second_tag)>]
+ [<Tag: Tag object (second_tag)>, <Tag: Tag object (first_tag)>]
cold island
#

Hey @fossil veldt, I'm looking at your replies in bot#2234 and I'm still confused. If the issue is fixed by rounding the microseconds, then why do we need the new field? and if the new field is calculated in one place, and the inserted_at field in another, then doesn't that mean that one of them is incorrect?

dusky shoreBOT
fossil veldt
#

I can remove the rounding and modifications to humanize datetime if you feel it's out of scope though

#

To make it clear, it is not required for the infraction duration fix specifically due to our new field

cold island
#

So the real fix is calculating expiry - last_applied?

fossil veldt
#

yeah, and also sending the expiry as a calculation based on last_applied

#

which required moving the calculation from the individual commands to the post function, and also needed to refactor the d.py typehints since originally the type autoconverted to the final datetime, it is now a delta

cold island
#

ok

#

What about last_applied and inserted_at being different?

fossil veldt
#

inserted_at is essentially not used for the infraction displays anymore, though it could in the future or just for database reference

#

inserted_at would be the time the entry was inserted into the database side, last_applied is calculated by the bot before the post

cold island
#

Did you modify the infraction search embed? I don't think I saw it in the PR

cold island
#

There's a command !infraction search

#

It displays infractions, and one of the things it shows is the time it was added

stable mountainBOT
#

bot/exts/moderation/infraction/management.py line 242

@infraction_group.group(name="search", aliases=('s',), invoke_without_command=True)```
fossil veldt
#

I will add that now 😅

timid sentinel
#

Would it make more sense to do the rounding on the relativedelta rather than the start and end separately?

cold island
cold island
fossil veldt
#

that should make it use the new last_applied field for the delta calculations

cold island
#

I think that the creation time is more interesting actually, maybe with an indicator that the duration was edited

#

Which is an issue because atm you can't tell if the duration was edited because last_applied and inserted_at don't match

#

In the embed, it probably makes sense to calculate the duration as expiry - inserted_at, because if we prolong a one day mute by two days, it will be three days total

fossil veldt
#

wait would it?

#

hm...

cold island
#

Thanks for your patience btw, you picked a pretty involved PR as your first one 🙃

cold island
fossil veldt
cold island
#

A mistake by a mod or an appeal are usually the reasons

#

Or a very poor reaction by the person being infracted

fossil veldt
#

like what function paths

cold island
#

oooh lol

#

!src i e

stable mountainBOT
#
Command: infraction edit

Edit the duration and/or the reason of an infraction.

Source Code
cold island
#

!src i a

stable mountainBOT
#
Command: infraction append

Append text and/or edit the duration of an infraction.

Source Code
fossil veldt
#

I tried to just mute someone again in the test server but it didn't let me

cold island
#

You have the option to DM the member the details of their infraction with

#

!src i resend

stable mountainBOT
#
Command: infraction resend

Resend a DM to a user about a given infraction of theirs.

Source Code
cold island
#

e.g if they didn't get it the first time or if we want to update them on any changes we made

fossil veldt
#

hm..

#

well currently I didn't update last_applied in infraction_edit, so it's only modifying expires_at, if requested

#

If I added the updating of last_applied together with the new expires_at, the log would only show the latest time

#

i.e. a 7 day infraction being edited on day 5 to 1 day would show 1 day when queried again after that

#

is that acceptable behavior or do we need the original infraction delta as well?

#

I think maybe it's fine to just only keep track of the last_applied in conjunction with the expires_at of the latest change?

cold island
fossil veldt
#

do you only want to display the original duration, updated, or both?

cold island
#

just the updated, I think that's how it is now

#

but last_applied should be updated when editing the infraction yeah

fossil veldt
#

hm... the issue is using inserted_at with the new expires_at would result in potential mismatching again

cold island
fossil veldt
#

since currently inserted_at is pretty much a useless field

cold island
#

That might require a change on the site repo

fossil veldt
#

ah, is it not settable?

cold island
#

I'm not sure, don't think it is, since it's currently being set on the site

cold island
fossil veldt
#

we still don't have the original infraction time for displaying both original and modified

#

we can tell if the infraction is edited, the new delta, and the original application time

cold island
#

Then what do you mean by original infraction time?

fossil veldt
#

and the new delta from last_applied to the new expires_at

#

so we no longer know how long the original infraction delta is for

cold island
#

yeah I think that's fine, that's how it is atm so we're not losing anything. There's an issue to expand the infraction schema to save editing history, but atm I think that's good enough

fossil veldt
#

I might make the current unpacking of DurationOrExpiry types into origin and expiry times into a function within time.py though

#

If we're doing it in management.py as well it's starting to be pretty repetitive

cold island
#

yeah that's fine

timid sentinel
# fossil veldt well that would be different

Say we have datetimes:

start = datetime(2022, 8, 13, second=5, microsecond=500_001)
end = datetime(2022, 8, 13, second=6, microsecond=499_999)

The current behaviour is get the difference and display:

diff = relativedelta(end, start)  # relativedelta(microseconds=+999998)
diff.seconds  # 0

Your behaviour to round them first:

start_round  # Rounds up: datetime(2022, 8, 13, second=6)
end_round  # Rounds down: datetime(2022, 8, 13, second=6)
diff = relativedelta(end, start)  # relativedelta(microseconds=0)
diff.seconds  # 0

Correct behaviour of rounding after getting the diff:

diff = relativedelta(end, start)  # relativedelta(microseconds=+999998)
rounded_diff  # relativedelta(seconds=+1)
rounded_diff.seconds  # 1

And looking at that manually it makes sense, the difference is 999998 microseconds which is about a second.

fossil veldt
#

Is the microseconds setting there a potential mutation of the argument? pithink

#

since relativedelta doesn't seem to have a .replace()

fossil veldt
#

if editing reason only, should we still update both the last_applied and expires_at with a new calculation?

cold island
#

nah no need

fossil veldt
#

how come it says I can't run the command?

#

is this a site thing?

vale ibex
#

you can only run it in mod channels

fossil veldt
#

oh.

#

_>

vale ibex
#

It's to avoid leaking infraction data in public

fossil veldt
timid sentinel
#

What you posted looks good though

fossil veldt
#

apparently it doesn't actually mutate in a function like that? Even if the iadd doesn't run

#

I'm not sure why though

timid sentinel
#

It doesn't implement __iadd__ so it falls back to essentially delta = delta.__add__(datetime.timedelta(seconds=1)), making delta a different relativedelta to the one passed, so when you later do delta.microseconds = 0 it's only modifying the new delta, which is fine.

#

Side note: just noticed this is a thing and wtf why

In [87]: relativedelta(second=1) + relativedelta(seconds=1)
Out[87]: relativedelta(seconds=+1, second=1)
fossil veldt
#

yeah uh...

#

there's also microseconds and microsecond

#

all the attributes have plural versions?

#

I have no idea what it is

fossil veldt
#

therefore the delta.microseconds = 0 actually changes the parameter object

#

is that acceptable or should I do a deepcopy?

timid sentinel
#

I don't really mind

#

could do a copy just to be safe

fossil veldt
#

I can alternatively always iadd something to not have to do deepcopy stuff

#
def round_delta(delta: relativedelta) -> relativedelta:
    if delta.microseconds >= 500000:
        delta += datetime.timedelta(seconds=1)
    delta.microseconds = 0
    return delta

def round_delta(delta: relativedelta) -> relativedelta:
    round_up = delta.microseconds >= 500000
    delta += relativedelta(seconds=round_up)
    delta.microseconds = 0
    return delta
#

I dunno if it's really more readable than a copy though

timid sentinel
#

I think a copy would be more explicit

#

copy.copy should be enough rather than copy.deepcopy though right?

#

I guess it doesn't matter

#

Either is fine

fossil veldt
gritty wind
#

@vale ibex is ```py
content = COMMAND_REGEX.search(linkify_tag_ref, content):

meant to be .sub?
vale ibex
#

yea lol

#

I updated the comment when I noticed

#

I copied the line from your code and didn't change the func call

gritty wind
#

Noice

vale ibex
#

I only recently discovered re.sub works with func repls too

#

very cool

#

!cban 905177072522125363 14d please don't use our server as an ad board

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied ban to @nova pumice until <t:1661628178:f> (13 days and 23 hours).

gritty wind
#

Speaking of, do you know any way to get the links to show up properly

#

Because they are in a codeblock, they just look like a codeblock

vale ibex
#

yea, I think in our css code block has higher prio that hyperlink

#

atleast in text colour

fossil veldt
#

uh...

#

can I do a from __future__ import annotations in time.py?

gritty wind
#

What future do you need

vale ibex
#

yea, the code css is higher than a

fossil veldt
#

I want to type hint a DurationOrExpiry which is imported from bot.converters and it's circular

gritty wind
#

I could mark it as important in those sections, a bit hacky though

vale ibex
#

yeaa

vale ibex
#

the only thing in a is this

#

so we could just bump the prio of a entirely

gritty wind
#

Actually would it be that bad if a elements had the highest priority in general

#

yeah

vale ibex
#

yea that's what I'm thinking too

gritty wind
#

I'll just do it for tag pages for now, we can do more later if we decide to

vale ibex
gritty wind
#

Hm it doesn't seem to have worked

#

Still red after being marked

vale ibex
#

what does dev tools say?

#

it should show which class it's getting the color from

gritty wind
#

Yeah it's still using code, it's still red

vale ibex
#

also, might be worth trying to clear cache and reloading

gritty wind
#

I did manage to break the github logo again though, which is nice

vale ibex
#

very cool

#

did a cache reset work btw?

gritty wind
#

The styles had already loaded (I could see the !important in the styles page), but it didn't seem to do anything

vale ibex
#

huh

gritty wind
#

I'm trying to create a fiddle to test it

vale ibex
#

cool cool

#

css is still magic to me

#

I know enough to be dangerous

gritty wind
#

Doesn't change here either

#

lmfao what the fuck chris

#

Oh it's because we need to specify explicitly if applies to the children

vale ibex
#

Yea ```
code {
color: red;
}

a, code {
color: blue;
}

gritty wind
#

The comma is an OR selector, just a space to select descendants

#

but ye ye

vale ibex
#

ahh cool

gritty wind
#

is this better

vale ibex
#

nice nice

gritty wind
#

New cropping algorithim

#

Seems to mostly kind of work 🤡

#

We still end up with some weird cropping like this here and there, thoughts @vale ibex?

#

Most things go to full sentences though

vale ibex
#

looks good

gritty wind
#

I opted not to include the ellipsis after all because basically everything is trimmed

vale ibex
#

the oddity you describes could be solved by putting something like Show more on a new line underneath, which links to the full tag

gritty wind
#

Hm, interesting

vale ibex
#

only if there is more to show

#

The show more could link to the tag

#

or if we wanted to be smart, could unfurl and rerender the whole tag

cold island
gritty wind
gritty wind
vale ibex
#

ah, then the latter could be possible then right? if the js already has the full text

gritty wind
#

What does the second suggestion mean

#

Ohhh gotcha

vale ibex
#

if a tag is cropped, we show something like show more at the end, clicking it removes the cropping

#

I imagine we'd need to re-render the tag for full md support

gritty wind
#

Nah it's already rendered will MD support

#

It would make the code a bit more involved, since we'd have to store the removed elements and keep track of the cropped changes

#

But it should be possible if we wanted

#

Let me see what that looks like

vale ibex
#

yea if it's too much work, this is already pretty nice

gritty wind
#

I'll leave it for now, we can get back to it later with the other improvements

vale ibex
#

sounds good

gritty wind
#

Right now I need to figure out the tag groups thing, it sounds like it would be really complicated for this system

vale ibex
#

is it not just updating the regex to capture spaces too?

#

being lazy on closing the `

gritty wind
#

That would read them out, but the code to display the listings is already a hack on the existing system

#

It would require quite a bit more logic to get it to display properly

vale ibex
#

ahh

gritty wind
#

Off the top of my head, the database might have to store the category, then the get_page_listings would need to return groups too, and the breadcrumbs system will actually need to work properly so that requires special casing the get_category function too

#

Since that relies on the tag actually existing on disk

#

@cold island

cold island
#

noice

gritty wind
#

Why are we using an external highlighter, when the markdown library we're using has support

#

Oh well whatever

#

Not sure I can do anything about it though

vale ibex
#

yea, ideally we'd want to wrap that text

#

but obviously wrapping this code block would be good, but we don't want to for other tag codeblocks 😅

#

it's probably fine

hoary haven
#

oooh tags page!

#

!ytdl

stable mountainBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
hoary haven
#

could just blockquote it?

gritty wind
#

Do @propertrys work in django models

#

I don't see any issues yet, so I think they do

brazen charm
#

the fields return normal objects from instances, don't think there should be any issues

gritty wind
#

Awesome, I'll use them to implement your URL suggestion then

gritty wind
#

Ah gotcha

gritty wind
#

Is there a way to make a view return and tell django to check the next URLs instead of this view?

#

Basically, we have:
/pages/tags/...
if .. is a tag group, I want to return from this view, and go to the one managed by
/pages/...

#

Actually, maybe not

#

It would be more effort to get that other view to work for this properly

gritty wind
#

Why do django templates not have set, so annoying 😔

#

Or better yet, why does a with need to be closed

gritty wind
#

Just need to do tests again :P

#

@vale ibex this is an uhhh interesting tidbit, the static builds are still failing occasionally because... they time out while talking to the site

#

We might want to extend the timeout on that step as well

gritty wind
#

I'm still getting that occasional infraction test failure, and it's always due to the ID being off by a bit. It seems that the difference is not really consistent.

So far I've had at least three different assertions fail: line 103, 104, 105. I'm consistently getting failures now (8 times in a row so far with no fix), and I have no idea why.

#

Environment:

DATABASE_URL=postgres://pysite:pysite@localhost:7777/pysite
METRICITY_DB_URL=postgres://pysite:pysite@localhost:7777/metricity
SECRET_KEY=suitable-for-development-only
STATIC_ROOT=./staticfiles
DEBUG=1

Running on host with command: poetry run task test

#

I managed to get a debugger into it

#

It seems the issue is... site#741

dusky shoreBOT
gritty wind
#

If your database access is quick enough, the insertion times will all be the same, which will create just a completely random order

#

I'll try to explicitly specify the time so this isn't so fragile

#

That seems to have fixed it, I'll push it in a separate PR

#

site#764

dusky shoreBOT
fossil veldt
#

my site pr didn't break anything did it

gritty wind
#

Haha no dw this issue is almost as old as the infraction system

#

Just became a lot more prevalent recently because we sped up database access

#

(Btw if you haven't recreated your database since site#741 do so, you'll get so much sweet speed)

dusky shoreBOT
gritty wind
#

Like 5-10x speed improvement 😛

fossil veldt
surreal veldt
#

Can anyone help me resolve this error when I run py -m pip install disnake? ``` error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for yarl
Failed to build aiohttp frozenlist multidict yarl
ERROR: Could not build wheels for aiohttp, frozenlist, multidict, yarl, which is required to install pyproject.toml-based projects

outer oasis
surreal veldt
#

oh okay sorry

outer oasis
#

no worries

static canyon
#

How do I only run one specific test? I know about retest but that doesn't work once the test passes (I'm editing the test so need to keep rerunning)

#

The test I'm wanting to run is tests.bot.rules.test_mentions.TestMentions.test_ignore_reply_mentions, where test_mentions.py is the file, TestMentions is the class, and test_ignore_reply_mentions is the test function

static canyon
#

For now I'm doing poetry run task test tests/bot/rules/test_mentions.py which runs all the tests in that file (which is much better than all tests)

gritty wind
#

Bot tests are pretty quick in general, but to run a specific test:
path/to/file.py -k <name> which checks if name is in the test name

#

Or press the run button beside the test in pycharm, and experience the best test UI known to man

static canyon
gritty wind
#

Haha is this from the command or pycharm

static canyon
#

PyCharm lol

#

Even running on the class doesn't work

gritty wind
#

Configure the default test template to use the project root as a workdir

#

Then the run button should work

static canyon
#

Right, yeah

#

That works

#

Thanks

gritty wind
#

Awesome

fossil veldt
#

it is possible to only run some tests in bot?

#

whenever I try it just fails on the mocking thing or something

gritty wind
#

How are you running

fossil veldt
#

uh pithink I just clicked the pycharm run next to the function

static canyon
#

Configure the workdir to the root

gritty wind
#

Do it on the run template so it’s configured for all future runs

fossil veldt
#

so this template?

gritty wind
#

Pycharm sometimes picks up unittest as well, so I do it on those two and autodetect

fossil veldt
#

oh right we use unittest

#

oops

#

I'm too used to everything being pytest

fossil veldt
gritty wind
#

The folder where the pyproject file is

fossil veldt
#

hm...

static canyon
#

I.e. in my case it's C:\Users\tizzy\bot

fossil veldt
#
Ran 0 tests in 0.000s

OK
static canyon
#

What's the function you're testing?

fossil veldt
#

ext/moderation/infraction/test_utils.py

#

one of the classes there

static canyon
#

Works fine for me 🤷

#
Testing started at 18:26 ...
Launching pytest with arguments tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests --no-header --no-summary -q in C:\Users\tizzy\bot

============================= test session starts =============================
collecting ... collected 5 items

tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests::test_get_active_infraction 
tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests::test_notify_pardon 
tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests::test_post_user 
tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests::test_send_infraction_embed 
tests/bot/exts/moderation/infraction/test_utils.py::ModerationUtilsTests::test_send_private_embed 

================== 4 passed, 1 skipped, 5 warnings in 3.20s ===================

Process finished with exit code 0
PASSED [ 20%]PASSED [ 40%]PASSED [ 60%]SKIPPED (Current time needs to be patched so infraction duration is correct.) [ 80%]
Skipped: Current time needs to be patched so infraction duration is correct.
PASSED [100%]```
fossil veldt
static canyon
#

What's the full log?

#

Oh and do the test functions start with test_? Otherwise unittest doesn't detect that it's a test function

fossil veldt
#

hm

#

they do though

#

If I right click the entire file it works

static canyon
fossil veldt
#
/Users/ionite/Library/Caches/pypoetry/virtualenvs/bot-xxxVP0Vd-py3.9/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/ionite/repos/Py-Dis/bot/bot/exts/moderation/infraction 
Testing started at 1:28 PM ...
Launching pytest with arguments /Users/ionite/repos/Py-Dis/bot/bot/exts/moderation/infraction --no-header --no-summary -q in /Users/ionite/repos/Py-Dis/bot

============================= test session starts ==============================
collecting ... collected 0 items

============================ no tests ran in 0.00s =============================

Process finished with exit code 5

Empty suite
static canyon
#

Launching pytest with arguments /Users/ionite/repos/Py-Dis/bot/bot/exts/moderation/infraction`

#

That second bot should be tests

#

I think you're in the wrong dir?

#

tests should be somewhere in that fp

#

Probably should be /Py-Dis/bot/tests/bot/exts/moderation/infraction

fossil veldt
#

hm..

#

when I run the file it does

Testing started at 1:32 PM ...
Launching pytest with arguments /Users/ionite/repos/Py-Dis/bot/tests/bot/exts/moderation/infraction/test_utils.py --no-header --no-summary -q in /Users/ionite/repos/Py-Dis/bot

============================= test session starts ==============================
collecting ... collected 9 items
#

which yeah I guess that one has the tests path

static canyon
#

Yeah

#

I guess double check your config or something

gritty wind
#

Are you clicking the run button in the tests dir

#

Send a screenshot of your run configuration

#

(Not the template one)

fossil veldt
#

file (runs correctly)

#

class (no collected)

static canyon
#

That module name seems to be wrong

gritty wind
#

The target in the second screenshot doesn’t look right

#

Is it autogenerated when you press the run button

fossil veldt
#

yeah

static canyon
#

I mean I guess for now you can manually fix it by correcting the fp

#

No clue why it's not generating correctly in the first place though

fossil veldt
#

yeah weird

#

whatever though I'm happy with 1 file working

#

I was just waiting for all unit tests to run trying to test 1 thing

#

so this is considerably less painful 🥲

gritty wind
#

Try deleting it and creating again maybe

#

Not really sure

cold island
#

I need to rebase filters again? 🥲

#

I'll just merge main lol

vale ibex
#

lol

static canyon
#

Rip my 5 open PRs lol

#

How do you update the env to use 3.10?

vale ibex
#

I deleted and remade mine

static canyon
#

Fair enough

vale ibex
#

Not sure if there's a way to update

austere hornet
#

Will Sir Lancebot run on Python 3.10 eventually as well?

vale ibex
#

yup

austere hornet
#

Cool

fossil veldt
#

So uh, bot embeds seem to be broken? pithink

lyric temple
#

!d os.wait

stable mountainBOT
#

b'py\n\nos.wait()\nWait for completion of a child process, and return a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced.\n\nwaitstatus_to_exitcode() can be used to convert the exit status into an exit code.\n\nAvailability: Unix.\n\nSee also\n\nwaitpid() can be used to wait for the completion of a specific child process and has more options.'

brazen charm
#

!d str

stable mountainBOT
#
str

b'py\n\nclass str(object=\'\')``````py\n\nclass str(object=b\'\', encoding=\'utf-8\', errors=\'strict\')\nReturn a string version of object. If object is not provided, returns the empty string. Otherwise, the behavior of str() depends on whether encoding or errors is given, as follows.\n\nIf neither encoding nor errors is given, str(object) returns type(object).__str__(object), which is the \xe2\x80\x9cinformal\xe2\x80\x9d or nicely printable string representation of object. For string objects, this is the string itself. If object does not have a __str__() method, then str() falls back to returning repr(object).'

lyric temple
#

3.10 side-effect? I didn't think anything changed with strings/bytestrings

brazen charm
#

I think it may just be the cache

vale ibex
#

!d r

stable mountainBOT
#
Inventories refreshed
brazen charm
#

ah the results from redis are broken

vale ibex
#

Yea, looks like redis is sending raw bytes and the bot isn't encoding

#

This wasn't happening in dev

#

so might be a migration thing

#

!d str

stable mountainBOT
#
str

b'py\n\nclass str(object=\'\')``````py\n\nclass str(object=b\'\', encoding=\'utf-8\', errors=\'strict\')\nReturn a string version of object. If object is not provided, returns the empty string. Otherwise, the behavior of str() depends on whether encoding or errors is given, as follows.\n\nIf neither encoding nor errors is given, str(object) returns type(object).__str__(object), which is the \xe2\x80\x9cinformal\xe2\x80\x9d or nicely printable string representation of object. For string objects, this is the string itself. If object does not have a __str__() method, then str() falls back to returning repr(object).'

vale ibex
#

kk gonna drop the doc cache

brazen charm
#

the things in the cache should be fine, it's just returning the bytes for some reason

fossil veldt
#

we removed encoding='utf8' in the 3.10 merge?

vale ibex
#

Yea, it's a global setting now

#

but might actually cause an issue if they're bytes in the cache on upgrade

fossil veldt
#

oh so it caches strings now?

brazen charm
#

I don't think redis differentiates that

vale ibex
#

runs alright on main in dev

brazen charm
#

second invocations too?

vale ibex
#

Ah, nope

slate gorge
#

!d threading.Thread.join 🔨 blame on redis?

stable mountainBOT
#

b'py\n\njoin(timeout=None)\nWait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates \xe2\x80\x93 either normally or through an unhandled exception \xe2\x80\x93 or until the optional timeout occurs.\n\nWhen the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened \xe2\x80\x93 if the thread is still alive, the join() call timed out.\n\nWhen the timeout argument is not present or None, the operation will block until the thread terminates.\n\nA thread can be join()ed many times.'

vale ibex
#

bot#2249

dusky shoreBOT
gritty wind
#

Hey I want to document this in the async-rediscache guide and aioredis one, could you summarize where the change is exactly

#

Looking at the diff it seems to be something we removed?

#

I don’t entirely understand

vale ibex
#

aiordis <1.3.X did this by default

gritty wind
#

Gotcha, thanks

vale ibex
#

with the move to redis-py, it returns bytes by default now instead

#

well, iirc string in used to be string out

#

but now it always returns bytes, regardless of how you put it in there

gritty wind
#

I’ll investigate tomorrow too and try to provide the info

fossil veldt
#

main runs on 3.10 only now right?

#

not compat with 3.9?

gritty wind
#

Correct

vale ibex
#

you could probably run it on 3.9 if you really wanted to

#

but you'd need to have build tools installed

#

so probably better to just use 3.10 :P

gritty wind
#

bot-core will refuse to install so you’d have to bump down its version

fossil veldt
#

what should I do if my PR was forked when it was 3.9?

gritty wind
#

Rebase

#

Or merge main

vale ibex
#

rebase/merge main, and then remake your venv

cold island
#

No more Union and Optional hyperlemon

fossil veldt
#

those weren't deprecated though were they?

cold island
#

No need for them I mean 😄

fossil veldt
#

do you think I can add a fix for bot#2247 in my infraction duration PR?

cold island
#

wdym

fossil veldt
#

since if I make another fork there will a large amount of conflicts depending on which one gets merged first due to the extensive argument name changes in the infraction duration PR

cold island
#

Sorry, I don't follow

#

How is the issue related?

#

It's a string change in the antispam cog

fossil veldt
#

well, they're not really I guess

#

nvm >_>

fossil veldt
cold island
#

yeah but it doesn't conflict with your PR

fossil veldt
#

ah, were you thinking it would just be a change in the reason for the auto mute?

cold island
#

yep

fossil veldt
#

I guess that would work, I was thinking of something more complex in recognizing auto-mutes on the infraction side

#

if it's just adding the moderators have been alerted to the actual reason string then it shouldn't have any conflicts

gritty wind
fossil veldt
#

-> str | None

gritty wind
#

Hmm I think I’ll stick with optional lol

fossil veldt
#

yeah sometimes it's actually longer than optional

gritty wind
#

Union and optional were marked as changed rather than deprecated

#

The 3.9 changes were deprecations tho

fossil veldt
#

and Optional was sugar for Union[x, None] anyways

gritty wind
#

It is, but by that same argument generics wouldn’t have deprecated their alternatives

fossil veldt
gritty wind
#

It didn’t break backward compat haha

#

We can still use the same types we’ve been using since 3.7

#

Just there are better ways now

fossil veldt
#

I probably had like 7 ML related libraries broken by the collections.abc switch in 3.8

gritty wind
#

Haha

grave plank
#

Anyone want to take challenge 15 hrs of study ?

#

🤔

outer oasis
#

!rule 9

stable mountainBOT
#

9. Do not offer or ask for paid work of any kind.

grave plank
#

I am not offering

#

ok

static canyon
#
Installing dependencies from lock file

Package operations: 91 installs, 0 updates, 0 removals

  • Installing pyparsing (3.0.9)
  • Installing wrapt (1.14.1)

  JSONDecodeError

  Expecting value: line 1 column 1 (char 0)

  at ~\AppData\Local\Programs\Python\Python39\lib\json\decoder.py:355 in raw_decode
static canyon
#

It also says \...\Python39\... so not sure why it seems to be using 3.9 even though it's set to use 3.10 as the base

fossil veldt
#

Mine is an exe? pithink

#

I think your pycharm env is not synced with your shell env?

#

When I switched to 3.10 I removed the old env, selected no interpreter in pycharm, did poetry env use 3.10 poetry install, and then selected the new poetry env by adding existing in pycharm

static canyon
# fossil veldt When I switched to 3.10 I removed the old env, selected no interpreter in pychar...
PS C:\Users\tizzy\bot> poetry env use 3.10
Traceback (most recent call last):
  File "C:\Users\tizzy\.poetry\bin\poetry", line 17, in <module>
    from poetry.console import main                                                   
  File "C:\Users\tizzy\.poetry\lib\poetry\console\__init__.py", line 1, in <module>   
    from .application import Application                                              
  File "C:\Users\tizzy\.poetry\lib\poetry\console\application.py", line 3, in <module>
    from cleo import Application as BaseApplication                                   
ModuleNotFoundError: No module named 'cleo'    ```
#

My poetry got broken at some point in the process

#

All poetry commands give that

fossil veldt
#

Uh...

#

Reinstall poetry maybe? Did you use the new script

#
static canyon
fossil veldt
#

For any poetry command? Even outside pycharm?

static canyon
#

Nvm, needed to restart the terminal

static canyon
#

And I still have this```
PS C:\Users\tizzy\bot> poetry install
Installing dependencies from lock file

Package operations: 91 installs, 0 updates, 0 removals

• Installing pyparsing (3.0.9)
• Installing wrapt (1.14.1)

JSONDecodeError

Expecting value: line 1 column 1 (char 0)

at ~\AppData\Local\Programs\Python\Python39\lib\json\decoder.py:355 in raw_decode
351│ """
352│ try:
353│ obj, end = self.scan_once(s, idx)
354│ except StopIteration as err:
→ 355│ raise JSONDecodeError("Expecting value", s, err.value) from None
356│ return obj, end
357│

fossil veldt
#

The documentation says you can just use minor version if python is in $PATH

#

Which is what I've always done, weird it doesn't work for yours thonkglobe

static canyon
#

Yeah, it is in path

#

Maybe it's because I have both 3.9 and 3.10 in path

#

There's also this ig PS C:\Users\tizzy> python -V Python 3.9.5 PS C:\Users\tizzy> py -V Python 3.10.0

fossil veldt
#

Is that a windows store alias?

#

How did you end up with python

static canyon
#

From the path ig

static canyon
# fossil veldt How did you end up with `python`
PS C:\Users\tizzy> gcm python

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     python.exe                                         3.9.515... C:\Users\tizzy\AppData\Local\Programs\...


PS C:\Users\tizzy> gcm py

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     py.exe                                             3.10.15... C:\Windows\py.exe```
#

That shows where they're installed ig

fossil veldt
#

Was that from windows store?

static canyon
#

Idk tbh

#

I doubt it

outer oasis
static canyon
outer oasis
#

Also what's the one to see if py recognizes your versions?
py -0?

static canyon
static canyon
fossil veldt
static canyon
#

With 3.10 being the selected one

outer oasis
fossil veldt
#

You should be able to just poetry env use 3.10 then pithink

#

Or maybe "3.10"?

static canyon
static canyon
outer oasis
#

Looks like it

static canyon
#

poetry install still fails though, and is using 3.9

fossil veldt
static canyon
outer oasis
#

They redid their package installer?

fossil veldt
#

From python-poetry/poetry#4210

dusky shoreBOT
static canyon
#

Thanks

#

Things are installing

fossil veldt
#

But in 3.9?

static canyon
#

No clue 🤷

#

It doesn't say what py version

#

Just "Installing dependencies from lock file"

fossil veldt
#

Are you using pyenv btw?

static canyon
#

🤷

#

No clue

fossil veldt
#

I think if you do poetry --version it should show the python version?

static canyon
#

Ah nice, back to this```
PS C:\Users\tizzy\bot> poetry --version
Traceback (most recent call last):
File "C:\Users\tizzy.poetry\bin\poetry", line 17, in <module>
from poetry.console import main
File "C:\Users\tizzy.poetry\lib\poetry\console_init_.py", line 1, in <module>
from .application import Application
File "C:\Users\tizzy.poetry\lib\poetry\console\application.py", line 3, in <module>
from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

fossil veldt
#

Eh

#

Wtf

fossil veldt
#

So apparently...

#

Latest version of poetry is just missing dependencies for python 3.10.0 to 3.10.1 versions

#
pip install cleo tomlkit poetry.core requests cachecontrol cachy html5lib pkginfo virtualenv lockfile
fossil veldt
#

Idk

static canyon
#

It's no longer giving that error```
PS C:\Users\tizzy\bot> poetry --version
Poetry version 1.1.7

fossil veldt
#

Huh, did you do the pip install?

static canyon
#

Yeah

fossil veldt
#

Interesting

#

I guess it's literally missing dependencies then

#

Wonderful

static canyon
#

But it doesn't show python version so still no clue if it's using 3.10

fossil veldt
static canyon
#

However this does```
PS C:\Users\tizzy\bot> pip -V
pip 21.1.2 from C:\Users\tizzy\bot\venv\lib\site-packages\pip (python 3.10)

#

So I'm assuming it is 3.10

fossil veldt
# fossil veldt

I like how this is casually a thing buried in a closed issue though 😂

static canyon
#

Ah, wonderful ModuleNotFoundError: No module named 'botcore'

#

Guess I need to do poetry install again

fossil veldt
#

Mhm yeah

#

Should be fine this time... Maybe?

static canyon
#

Ah, beautiful```
PS C:\Users\tizzy\bot> poetry install
Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 0 removals

Installing the current project: bot (1.0.0)

outer oasis
static canyon
#

I think PyCharm is using a different venv to my PyCharm terminal

fossil veldt
#

Remove your current one and delete (-) it on the interpreter list

#

And then click add new interpreter

#

Go to poetry, and do add existing interpreter

#

And the folder should show up...?

static canyon
#

So I did it a roundabout way but I think it's good

#

Ugh ModuleNotFoundError: No module named 'async_rediscache'

#

But if I poetry install then it says that everything's already installed

static canyon
#

The folder did show up this time but it's just seemingly infinitely scanning

#

And for some reason it has two tasks doing that

fossil veldt
#

Uh

#

Set no interpreter, quit pycharm, then start pycharm and put it in the current interpreter...?

static canyon
fossil veldt
#

Uh..

#

But the shell is working? You're in the correct poetry version?

#

The shell poetry env name matches the pycharm one?

static canyon
#

Yep

#

No clue if this has anything to do with it

00:03    Plugin error: Plugin 'Poetry' (version '1.1.4') is not compatible with the current version of the IDE, because it requires build 211.* or older but the current build is PC-213.6777.50
fossil veldt
#

Tbh I would just close the project, then delete the entire .idea folder in it, then restart and let it reinitialize

gritty wind
#

Uninstall the poetry plugin

#

It’s no longer maintained since it’s built in

static canyon
#

Right, done

#

Just restarted PyCharm and still the same issue 🤷

static canyon
#

Didn't work & now I can't even use the project lol

#

I have to wait for it to finish scanning, which it never does

gritty wind
#

It might be the case that your poetry env is corrupted. I’d delete the environment, update python to 10.6, and recreate the pycharm project as well

static canyon
#

Wdym by recreate the pycharm project?

gritty wind
static canyon
#

Right

#

I guess I'll try that

#

Apparently uninstalling python takes a really long time lol

#

Right, all done

#

Now we try again

#

It's.... still stuck

#

I've created an entirely new poetry env and still the exact same issue

#

It just forever stays on this

fossil veldt
#

Maybe delete the install poetry folder in Local/and then reinstall, not sure pithink

static canyon
static canyon
#

Left it running overnight in case it was just talking an absurd amount of time but it's still not finished

gritty wind
#

At this point we’ve reinstalled everything, so I guess reinstall windows? No that’s a joke

#

Have you tried the builtin “fix IDE” option

static canyon
#

I guess I can try that

#

The "restart option" section of that seems to have actually fixed that lmao

#

Even though I've restarted the project myself numerous times

#

But the libraries pycharm shows in venv still don't match pip list

static canyon
gritty wind
#

Which environment is selected in settings

static canyon
#

Poetry (bot) [3.10.6]

gritty wind
#

Hm, try importing a package in the python interpreter?

#

Or remove and add it again (the environment)

static canyon
#

venv folder still hasn't updated though

static canyon
#

Currently when I run tests I getpy from async_rediscache import RedisCache E ModuleNotFoundError: No module named 'async_rediscache'

#

Which oddly looks like it might be correct since there's not async_rediscache folder in site-packages

#

Huh

#

After manually installing async_rediscache the test works 🤷

#

So for some reason poetry install didn't install that

#
arg = <MagicMock name='mock.created_at' id='2237042899456'>

E               TypeError: Cannot parse single argument of type <class 'unittest.mock.MagicMock'>.

..\AppData\Local\pypoetry\Cache\virtualenvs\bot-6mLjCNeK-py3.10\lib\site-packages\arrow\factory.py:267: TypeError```for some reason `arrow.get(mockmessage.created_at)` is giving this error -- the actual code being `arrow.get(incident.created_at)`
static canyon
#

I'm on a different branch though

#

incident-archive-msg-improvements

fossil veldt
#

did you pull the stuff from the 3.10 PR yet?

#

or is that a new branch

static canyon
#

And I've spent ~3hrs trying to fix them with the biggest issue being the poetry thing from yesterday that still isn't fixed

fossil veldt
#

well it appears to fail on github as well, so I don't think it's related to your poetry?

static canyon
#

Yeah, poetry is something else

fossil veldt
#

yeah your env is like the most cursed I've seen it

static canyon
#

I still have this running infinitely, and PyCharm's venv doesn't match the linked /pypoetry/Cache/virtualenv/bot-.../

fossil veldt
#

I usually have to do a bit of fiddling every now and then but nothing like yours 😅

fossil veldt
#

does it work normally?

static canyon
#

Testing now

#

Yeah, it does

fossil veldt
static canyon
#

🤷

fossil veldt
#

the env you're using for bot now is created via shell right?

#

or through pycharm

static canyon
#

Via poetry install iirc

fossil veldt
#

hm

static canyon
#

It was created through pycharm

fossil veldt
#

oh? pithink

static canyon
#

From the "Add interpreter"

fossil veldt
#

oh but the folder was already there?

static canyon
#

🤷

fossil veldt
#

like was it from existing here or new

static canyon
#

I think I originally did a new one, then set interpreter to nothing and did existing

fossil veldt
#

you could try deleting the current one and letting pycharm make a new one?

static canyon
fossil veldt
#

yeah

#

and after you delete the venv the existing should be empty

#

(restart pycharm after deleting)

#

I mean if your new projects are working fine then it's just something bork with this specific venv?

static canyon
fossil veldt
#

yeah, if you click existing its empty right?

static canyon
#

Yes

fossil veldt
#

okay yeah

static canyon
#

It's installing everything atm

fossil veldt
#

hopefully it works and you can escape the pycharm poetry env mismatch purgatory upsidedown_cry

static canyon
#

I mean I've done this a few times now so I doubt it

fossil veldt
#

wtf

static canyon
#

From the looks of it PyCharm is using its own env instead of the poetry one still

fossil veldt
#

wait so

#

in the terminal the poetry env name is not the pycharm one?

static canyon
#

I.e when I right-click venv and select "open in explorer" it opens C:\Users\tizzy\bot\venv\Lib\site-packages and not ...\pypoetry\Cache\virtualenv\bot-....\Lib\site-packages

fossil veldt
#

wait do you have an in-project venv?

static canyon
#

I've just deleted that for now

#

Cause it does show the poetry stuff and external

fossil veldt
#

but what created that, pycharm or manual

#

the in-project one

static canyon
#

Who knows 🤷

#

PyCharm ig because it wasn't me

fossil veldt
#

wait you reinstalled poetry earlier right

static canyon
#

Yeah

fossil veldt
#

can you run poetry config --list

static canyon
#
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'
```wooo
fossil veldt
#

lmao what

static canyon
#

Time to reinstall the dependencies again lmao

fossil veldt
#

aren't you on 3.10.6 now?

static canyon
#

Because why would a project come installed with its dependencies 🤷

fossil veldt
#

that dependency issue was only for 3.10.0-3.10.1 iirc

static canyon
#
PS C:\Users\tizzy\bot> pip -V
pip 21.1.2 from C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs\bot-6mLjCNeK-py3.10\lib\site-packages\pip (python 3.10)
#

I don't even have 3.10 installed 🤷

fossil veldt
#

ah

static canyon
#

So I'm assuming that just doesn't include the minor version

fossil veldt
#

can you cd to C:\Users\tizzy\AppData\Local\pypoetry

#

is there a poetry executable in there?

static canyon
fossil veldt
#

hm

fossil veldt
#

but you have 3.10.6 installed?

static canyon
#

I have 3.10.6 installed, not 3.10

#

I did have 3.10 but Scaleios said to update to 3.10.6 and try, so I did

#

Just gonna manually install the poetry dependencies

fossil veldt
static canyon
# fossil veldt can you run `poetry config --list`
PS C:\Users\tizzy\bot> poetry config --list
cache-dir = "C:\\Users\\tizzy\\AppData\\Local\\pypoetry\\Cache"
experimental.new-installer = false
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\tizzy\AppData\Local\pypoetry\Cache\virtualenvs
fossil veldt
#

my working theory is your pycharm and shell are trying to use completely different versions of poetry

static canyon
fossil veldt
#

you installed with this earlier right?

static canyon
#

Yeah

fossil veldt
#

...

#

poetry self update?

static canyon
#

I already had the tizzy\.poetry though I think not sure

fossil veldt
#

I dunno what's going on anymore

#

something is broken with your poetry though

#

maybe just delete the whole .poetry folder before installing again, I remember I saw that on a few comments on the poetry issue

static canyon
# fossil veldt `poetry self update`?
PS C:\Users\tizzy\bot> poetry self update
Updating to 1.1.14

  PermissionError

  [WinError 5] Access is denied: 'C:\\Users\\tizzy\\.poetry\\lib\\poetry\\_vendor\\py3.9\\msgpack\\_cmsgpack.cp39-win_amd64.pyd'
fossil veldt
#

nice

#

oh its back to 3.9 as well

#

😂

static canyon
#

Yeah lol

fossil veldt
#

yeah get rid of that whole .poetry directory and install again

#

completely cursed

#

also close pycharm when you do that

#

and reopen pycharm after you reinstall

#

it only reindexes poetry paths on startup

static canyon
#

So I've deleted .poetry

static canyon
fossil veldt
#

yeah

static canyon
#

Before installing I'm gonna uninstall 3.9 actually

#

So it doesn't use that

fossil veldt
#

also for good measure maybe disable the windows store alias as well

fossil veldt
static canyon
#

I really hope not 😢

#

3.9 is gone

#
This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later. It is recommended to use https://install.python-poetry.org instead. Instructions are available at https://python-poetry.org/docs/#installation```
#

Ah nice

#
PS C:\Users\tizzy> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Retrieving Poetry metadata

The latest version (1.1.14) is already installed.```wtf lol
#

I deleted the .poetry but apparently it's still installed

#

Yeah poetry isn't a valid command in the terminal 🤷

#

Wtf is going on

#

Right, I had to delete pypoetry from appdata/local and appdata/roaming

#

Okay, it's reinstalled PS C:\Users\tizzy> poetry --version Poetry version 1.1.14

#

Now to setup the env in PyCharm

fossil veldt
#

Okay so if you just do self update does it error

static canyon
static canyon
fossil veldt
fossil veldt
#

I always had an exe

#

I don't know how you have a .bat as poetry before

static canyon
#

🤷

#

I also don't have tizzy/.poetry anymore 🤷

#

It still seems to be hanging 😩

fossil veldt
static canyon
#

Maybe not actually

#

I think it's just taking its time

#

Since the text underneath is updating

fossil veldt
#

Okay..

#

Yeah it might take a while to reindex python completely

static canyon
#

Yep, it's working 😄

fossil veldt
#

🎉

static canyon
#

And it installed everything properly (last time it didn't installed async_rediscache)

fossil veldt
#

Well check if your unit tests work I guess

#

And if it's using 3.10 and dependencies correctly

static canyon
#

Exact same error

fossil veldt
#

Was it supposed to work?

static canyon
#
E               TypeError: Cannot parse single argument of type <class 'unittest.mock.MagicMock'>.

..\AppData\Local\pypoetry\Cache\virtualenvs\bot-6mLjCNeK-py3.10\lib\site-packages\arrow\factory.py:267: TypeError```
#
self = <arrow.factory.ArrowFactory object at 0x0000022F93228B80>
args = (<MagicMock name='mock.created_at' id='2403377807024'>,), kwargs = {}
arg_count = 1, locale = 'en-us', tz = None, normalize_whitespace = False
arg = <MagicMock name='mock.created_at' id='2403377807024'>```
#

It seems to be passing a magicmock instead of that datetime from .created_at

static canyon
fossil veldt
#

Where was your pr again?

#

I saw it earlier and now GitHub won't show it pithink

static canyon
#

bot#2031

dusky shoreBOT
static canyon
#

Should probably undo the edits actually since they don't work

fossil veldt
#

Oh you didn't even touch the failing tests part in diff

#

Weird

static canyon
#

Yeah I know

#

That's why I'm so confused

fossil veldt
#

Also this thing is broken too? Lol

static canyon
#

From what I can tell this should never have been merged into main (the 3.10 PR)

#

But obvs the tests have to work first for that to happen so 🤷

fossil veldt
vale ibex
#

The test seems like it is working as intended. You have updated make_embed to use incident.created_at

#

but in the other tests, you don't update incident.created at to be a datetime

#

incident being from the message

static canyon
#
    async def test_make_embed_content(self):
        """Incident content appears as embed description."""
        current_time = datetime.datetime(2022, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)
        incident = MockMessage(content="this is an incident", created_at=current_time)

        reported_timestamp = discord_timestamp(current_time)
        relative_timestamp = discord_timestamp(current_time, TimestampFormats.RELATIVE)

        embed, file = await incidents.make_embed(incident, incidents.Signal.ACTIONED, MockMember())

        self.assertEqual(
            f"{incident.content}\n\n*Reported {reported_timestamp} ({relative_timestamp}).*",
            embed.description
        )```
vale ibex
#

What is the test that's failing?

static canyon
#

Right I'm dumb

#

That one's passing

vale ibex
#

yup :D

static canyon
#
     async def setUp(self):
        self.current_time = datetime.datetime(2022, 1, 1, tzinfo=datetime.timezone.utc)

    async def test_make_embed_actioned(self):
        """Embed is coloured green and footer contains 'Actioned' when `outcome=Signal.ACTIONED`."""
        embed, file = await incidents.make_embed(MockMessage(created_at=self.current_time), incidents.Signal.ACTIONED, MockMember())

        self.assertEqual(embed.colour.value, Colours.soft_green)
        self.assertIn("Actioned", embed.footer.text)```
#

What was the setup function?

#

Nvm, it's not async

vale ibex
#

the setup function gets called before every test

#

there is an async setup if you need one

static canyon
#

Nah I don't

#

I just need to add created_at=self.current_time to all of the MockMessage()

vale ibex
#

👍

#

yoiu could create the whole message in there

#

if it's the same code in every test

static canyon
#

Nah it's not

#

It changes

#

There's 3 different messages

#

I guess I could assign each one but that seems overkill

vale ibex
#

Yea, setup is just there to remove code duplication from your tests

#

if there isn't duplication then it doesn't need to be there

static canyon
#

The current_time is needed in more than one test class, so would it be worth making it a constant in the file?

vale ibex
#

There is a module wide setup function that exists, similar to how there are test specific setup functions

static canyon
#

So just def setUp() but outside the classes?

vale ibex
#

I think it's setUpModule

static canyon
#

Is there a preference to whether it goes at the top or bottom of the file?

vale ibex
#

but I'm also not sure how that works with variable scoping

#

so it might just be better to create a screaming case constant

static canyon
#

Yeah

#

Okay

#

Now moderation tests about the rediscache are failing lemon_sweat

#
FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_unsilence_role - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been initialized ...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_skipped_already_unsilenced - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been ...```
#

How do I fix that? @vale ibex

vale ibex
#

Uhhh, what version of redis-py is installed?

#

or async-rediscache

#

This should be initialised by the super class

#

Could you try doing poetry install --remove-untracked

#

and then running tests again

static canyon
static canyon
static canyon
#

Err

#

Now I've got even more tests failing (for the same reason)

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_skipped_already_unsilenced - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been ...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_unsilence_role - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been initialized ...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_preserved_other_overwrites_voice - async_rediscache.session.RedisSessionNotInitialized: the redis session has not...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_removed_notifier - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been initialize...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_restored_overwrites_text - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been in...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_restored_overwrites_voice - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been i...

FAILED tests/bot/exts/moderation/test_silence.py::UnsilenceTests::test_sent_correct_message - async_rediscache.session.RedisSessionNotInitialized: the redis session has not been initialized ...```
vale ibex
#

just to be sure, could you delete any __pycache__ folders you have ?

static canyon
vale ibex
#

hmmm, I have no idea how to troubleshoot this then

#

it works in CI, and it works on my machine, so I'm not sure why it isn't working in your env

static canyon
#

I swear the env just hates me

#

I've had so many issues with getting it to 3.10

#

And now it's finally 3.10 but the tests fail for no good reason

#

I've not even made any changes to the silence command 🤷

#

No clue what to do 🤷