Skip to content

Commit

Permalink
Bump github python versions (#14)
Browse files Browse the repository at this point in the history
* Add privileges to codeql-analysis.yml

Explicitly give codeql-analysis action the security-events: write permission so it still works even when the default GitHub Actions token is set to read-only.

* Bump versions on libraries  (#10)

* Bump versions

* Bump back Pillow due to test failure

* Bump setuptools

* Bump Flower Version

We missed Flower in our version upgrades earlier somehow, proposing the upgrade here.

* Bump python images

* Bump github python versions

* Down gto 3.11

* Put back the things I accidentally deleted

I seem to have accidentally removed three dependencies while resolving merge conflicts. Putting them back now.

* Pylint ignore deprecation of imghdr module for now

After discussion of the deprecation of the imghdr module, we want Pylint to ignore it for now and will return to checking out alternatives after Pycon, because we expect there will be some better options by then.

* Fix Spacing So I Don't Break The Other Linter Now

I broke another linter with my linterignore by not putting a space where expected in a comment. Fixing that here.

* Adding a space again

Turns out there were TWO spaces the linter wanted that I didn't have! 🤣 This is what I get for reviewing PRs in the GitHub WebUI.

* It Also Wants A Line Break

Please, Python Formatting, Have I Added Enough Whitespace Yet???? 😭

* Made The Comment Shorter For The Linter

Now it's VERY terse, here's hoping this is enough to pass.

* Making the line shorter-er

I miscounted characters, off by 5. This should actually be short enough now.

* Update requirements.txt

* Update .pylintrc

* Add timeout to requests.get

requests.get was missing a timeout; added a timeout of 15 as aligned to the timeout currently used in bookwyrm/utils/isni.py

* Fix what I broke; leave the change

Looks like I copypasted more than I needed to! Oops.

* Update base_activity.py

* Update pylint.yml

* Update .pylintrc

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update base_activity.py

---------

Co-authored-by: Margaret Fero <[email protected]>
  • Loading branch information
phildini and MaggieFero authored Mar 1, 2024
1 parent c98caed commit d714f3b
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 64 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/django-tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Run Python Tests
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-20.04
services:
postgres:
Expand All @@ -22,12 +21,12 @@ jobs:
--health-retries 5
ports:
- 5432:5432
steps:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -67,4 +66,4 @@ jobs:
ENABLE_THUMBNAIL_GENERATION: true
HTTP_X_FORWARDED_PROTO: false
run: |
pytest -n 3
pytest -n 3
77 changes: 38 additions & 39 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,48 @@ name: Mypy

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Analysing the code with mypy
env:
SECRET_KEY: beepbeep
DEBUG: false
USE_HTTPS: true
DOMAIN: your.domain.here
BOOKWYRM_DATABASE_BACKEND: postgres
MEDIA_ROOT: images/
POSTGRES_PASSWORD: hunter2
POSTGRES_USER: postgres
POSTGRES_DB: github_actions
POSTGRES_HOST: 127.0.0.1
CELERY_BROKER: ""
REDIS_BROKER_PORT: 6379
REDIS_BROKER_PASSWORD: beep
USE_DUMMY_CACHE: true
FLOWER_PORT: 8888
EMAIL_HOST: "smtp.mailgun.org"
EMAIL_PORT: 587
EMAIL_HOST_USER: ""
EMAIL_HOST_PASSWORD: ""
EMAIL_USE_TLS: true
ENABLE_PREVIEW_IMAGES: false
ENABLE_THUMBNAIL_GENERATION: true
HTTP_X_FORWARDED_PROTO: false
run: |
mypy bookwyrm celerywyrm
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Analysing the code with mypy
env:
SECRET_KEY: beepbeep
DEBUG: false
USE_HTTPS: true
DOMAIN: your.domain.here
BOOKWYRM_DATABASE_BACKEND: postgres
MEDIA_ROOT: images/
POSTGRES_PASSWORD: hunter2
POSTGRES_USER: postgres
POSTGRES_DB: github_actions
POSTGRES_HOST: 127.0.0.1
CELERY_BROKER: ""
REDIS_BROKER_PORT: 6379
REDIS_BROKER_PASSWORD: beep
USE_DUMMY_CACHE: true
FLOWER_PORT: 8888
EMAIL_HOST: "smtp.mailgun.org"
EMAIL_PORT: 587
EMAIL_HOST_USER: ""
EMAIL_HOST_PASSWORD: ""
EMAIL_USE_TLS: true
ENABLE_PREVIEW_IMAGES: false
ENABLE_THUMBNAIL_GENERATION: true
HTTP_X_FORWARDED_PROTO: false
run: |
mypy bookwyrm celerywyrm
30 changes: 14 additions & 16 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@ name: Pylint

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint bookwyrm/
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint bookwyrm/
2 changes: 2 additions & 0 deletions bookwyrm/activitypub/base_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

logger = logging.getLogger(__name__)

# pylint: disable=invalid-name
TBookWyrmModel = TypeVar("TBookWyrmModel", bound=base_model.BookWyrmModel)


Expand Down Expand Up @@ -423,6 +424,7 @@ def get_activitypub_data(url):
"Date": now,
"Signature": make_signature("get", sender, url, now),
},
timeout=15,
)
except requests.RequestException:
raise ConnectorException()
Expand Down
4 changes: 3 additions & 1 deletion bookwyrm/connectors/abstract_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from abc import ABC, abstractmethod
from typing import Optional, TypedDict, Any, Callable, Union, Iterator
from urllib.parse import quote_plus
import imghdr

# pylint: disable-next=deprecated-module
import imghdr # Deprecated in 3.11 for removal in 3.13; there's no good alternative yet
import logging
import re
import asyncio
Expand Down
2 changes: 1 addition & 1 deletion bookwyrm/isbn/isbn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class IsbnHyphenator:

def update_range_message(self) -> None:
"""Download the range message xml file and save it locally"""
response = requests.get(self.__range_message_url)
response = requests.get(self.__range_message_url, timeout=15)
with open(self.__range_file_path, "w", encoding="utf-8") as file:
file.write(response.text)
self.__element_tree = None
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pytest-cov==2.10.1
pytest-env==0.6.2
pytest-xdist==2.3.0
pytidylib==0.3.2
pylint==2.14.0
pylint==2.15.0
mypy==1.5.1
celery-types==0.18.0
django-stubs[compatible-mypy]==4.2.4
Expand Down

0 comments on commit d714f3b

Please sign in to comment.