Skip to content

Conversation

@ElectricalBoy
Copy link
Collaborator

@ElectricalBoy ElectricalBoy commented Feb 4, 2026

@ElectricalBoy ElectricalBoy requested review from a team and FO-nTTaX February 4, 2026 12:32
@ElectricalBoy ElectricalBoy marked this pull request as ready for review February 4, 2026 12:32
Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should test this on a fork first ;)

on first glance seems reasonable

@ElectricalBoy
Copy link
Collaborator Author

ElectricalBoy commented Feb 4, 2026

i think we should test this on a fork first ;)

running: https://github.com/ElectricalBoy/Lua-Modules/actions/runs/21672292444
cancelled for now; will run during EU night time

update: https://github.com/ElectricalBoy/Lua-Modules/actions/runs/21696696866

@Rathoz
Copy link
Collaborator

Rathoz commented Feb 4, 2026

Would it be worth using pywikibot directly?

@hjpalpha
Copy link
Collaborator

hjpalpha commented Feb 4, 2026

Would it be worth using pywikibot directly?

imo too much overhead and would likely increase runtime even more
additionally it would not generate the same "log" outputs as currently

Copy link
Member

@FO-nTTaX FO-nTTaX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we feel the need to have a linter and style checker for the deploy scripts? I'm not aware of such things for bash, but in the python world tools like Flake8 exist

@mbergen
Copy link
Collaborator

mbergen commented Feb 4, 2026

Do we feel the need to have a linter and style checker for the deploy scripts? I'm not aware of such things for bash, but in the python world tools like Flake8 exist

nowadays people use https://astral.sh/ruff instead

@ElectricalBoy
Copy link
Collaborator Author

Do we feel the need to have a linter and style checker for the deploy scripts? I'm not aware of such things for bash, but in the python world tools like Flake8 exist

I didn't pass the scripts through a linter but everything is style checked with psf/black already
I'm not opposed to adding a linter if there's a suggestion for one

@ElectricalBoy ElectricalBoy requested a review from mbergen February 5, 2026 10:07
@@ -0,0 +1,19 @@
name: Python Code Style

on: [pull_request, workflow_dispatch]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on: [pull_request, workflow_dispatch]
on:
pull_request:
paths:
- '**.py'
workflow_dispatch:

Not sure if we even need the dispatch?

Copy link
Collaborator Author

@ElectricalBoy ElectricalBoy Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we even need the dispatch?

it's there only because luacheck workflow has it
and I'm not opposed to removing dispatch trigger from both

Comment on lines +29 to +31
token = get_token(wiki)
with requests.Session() as session:
session.cookies = read_cookie_jar(wiki)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also move this into a dedicated context manager to avoid repetition of cookie reading, but is also a bit overkill

@contextmanager
def authenticated_session(wiki: str):
    token = get_token(wiki)
    with requests.Session() as session:
        session.headers.update(HEADERS)
        session.cookies = read_cookie_jar(wiki)
        yield session, token
Suggested change
token = get_token(wiki)
with requests.Session() as session:
session.cookies = read_cookie_jar(wiki)
with authenticated_session(wiki) as session, token:

In case we'd then also move the opening of this context manager to be in each main function, and then passed everywhere, we could also get rid of the cookie jar as the session will persist the cookies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think it's a bit overkill

ElectricalBoy and others added 2 commits February 5, 2026 19:32
Co-authored-by: SyntacticSalt <mail@mbergen.de>
@FO-nTTaX
Copy link
Member

FO-nTTaX commented Feb 5, 2026

Do we feel the need to have a linter and style checker for the deploy scripts? I'm not aware of such things for bash, but in the python world tools like Flake8 exist

nowadays people use https://astral.sh/ruff instead

Fair enough, I'm not super up top date with the wider python ecosystem, flake8 is what I use for the LP Discord Bot, hence that suggestion. I'm not married to either tool, or to how far we'd want to go with implementing style checking and/or linting for this, I just wanted to start the discussion if this was relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants