Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python 3.8 support #525

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.13
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.9-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-pip-3.13-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: make setup
Expand All @@ -37,10 +37,10 @@ jobs:
steps:
- name: Checkhout
uses: actions/checkout@v4
- name: Setup Python 3.9
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.9
Copy link
Member

Choose a reason for hiding this comment

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

Please keep to older versions for lint job, it's more likely to catch mypy errors that user's of older Python versions may encounter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.
Ideally we should do mypy checks for all supported Pythons, it is not that hard.

Copy link
Member

@Dreamsorcerer Dreamsorcerer Dec 16, 2024

Choose a reason for hiding this comment

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

I'm not necessarily against it, but from I've seen it doesn't really provide any benefit. I don't think we've ever encountered errors on a newer Python version than what we tested with.

Copy link
Member Author

Choose a reason for hiding this comment

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

A newer version could raise a deprecation warning.
Honestly I don't expect any error from testing mypy against the oldest supported version as well; but if we can and want providing the possible strongest typing -- why don't do it?

Copy link
Member

Choose a reason for hiding this comment

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

A newer version could raise a deprecation warning.

mypy wouldn't give a deprecation warning, that's a runtime thing. If it did, we wouldn't be able to do anything as we still need the code working on the older version.

Honestly I don't expect any error from testing mypy against the oldest supported version as well;

We've had a couple of occasions where this has happened. There's some slight oddities where mypy will produce an error (e.g. due to invalid syntax) when run on older versions of Python (as it's uses the Python parser), but won't produce those errors on newer versions.

but if we can and want providing the possible strongest typing -- why don't do it?

Just because it's unlikely to add anything, but it will add CI time and might add some complexity when some internal code produces different errors on different versions (making it difficult to pass on all versions).

Copy link
Member Author

@asvetlov asvetlov Dec 16, 2024

Choose a reason for hiding this comment

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

It's a minor thing from my perspective, but...

  1. Mypy supports deprecations: https://peps.python.org/pep-0702/
    I guess in typeshed it will be implemented as if sys.version_info ..., we can handle it as well.
  2. Compilation issues don't belong to mypy entirely, if python 3.9 can compile then mypy for python 3.9 can process. Type checking for all python versions helps us to mitigate things like using API from newer python but covering it with the test with skip mark for older python versions. It is a very rare case, I agree, but still.
  3. CI time is the question. I suggest adding this mode for aiojobs only and see how it is going. The project is not updated frequently, we can experiment on it for free.

Copy link
Member

Choose a reason for hiding this comment

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

1. Mypy supports deprecations: https://peps.python.org/pep-0702/
   I guess in typeshed it will be implemented as `if sys.version_info ...`, we can handle it as well.

I think that's still unsupported: https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html

2. Compilation issues don't belong to mypy entirely, if python 3.9 can compile then mypy for python 3.9 can process.

My point is more that we can have an issue with syntax that only work in 3.12+ and mypy doesn't detect the problem unless it's being run with an older version that doesn't support the syntax. I think that's roughly what happened before, when we saw issues.

Feel free to experiment though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow, very cool table. I never saw anything like this.
Maybe we should switch to pyright if it is so good?

Copy link
Member

Choose a reason for hiding this comment

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

I think mypy is a solid foundation that most of our users use. It might be worth adding pyright as a second tool, but most of those features we won't use for some time as we support older versions still (e.g. deprecated was added in 3.13). mypy should have those features long before we actually use them.

python-version: 3.13
- uses: actions/cache@v4
with:
path: ~/.cache/pip
Expand All @@ -55,10 +55,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pyver: ['3.8', '3.9', '3.10', '3.11']
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']
experimental: [false]
include:
- pyver: "3.12"
- pyver: "3.14"
experimental: true
fail-fast: true
continue-on-error: ${{ matrix.experimental }}
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run:
python -m pip install -U pip wheel setuptools build twine
Expand Down
1 change: 1 addition & 0 deletions CHANGES/525.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Python 3.12 and 3.13 support.
1 change: 1 addition & 0 deletions CHANGES/525.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop Python 3.8 support.
3 changes: 3 additions & 0 deletions CHANGES/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Towncrier changelog records.

Run ``towncrier create <num>.feature`` to add a new reacord.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ classifiers =

Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13

Topic :: Software Development

[options]
python_requires = >=3.8
python_requires = >=3.9
packages = aiojobs
include_package_data = True

Expand Down
Loading