-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Add support for Python 3.11 and test 3.12-dev #545
Conversation
Codecov Report
@@ Coverage Diff @@
## master #545 +/- ##
=======================================
Coverage 95.12% 95.12%
=======================================
Files 6 6
Lines 820 820
=======================================
Hits 780 780
Misses 40 40
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Is 3.12-dev allowed to fail? Otherwise it looks good to me. Needless to say it would be easier that the PR only adds the changes the title says. |
No, it can also fail the build. I think that's fine: 3.12 is almost in beta and should be pretty stable.
I've changed the title to also say we're testing |
What you describe in point three is a good one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hugovk forgot about this PR but found it again wondering why there was no 3.11 in the matrix. Resolved the conflict and I think we should merge It even 3.12 is failing. Agree?
Aha! Good to see a 3.12 failure, it's a valid failure showing there's something to fix in django-model-util (this is bullet point 1 above :) File "/home/runner/work/django-model-utils/django-model-utils/model_utils/__init__.py", line 1, in <module>
from pkg_resources import DistributionNotFound, get_distribution
ModuleNotFoundError: No module named 'pkg_resources' https://docs.python.org/3.12/whatsnew/3.12.html#removed says:
I've pushed a commit to also install setuptools when we're on 3.12 or higher. Alternatively, we're using pkg_resources to get the distribution version. Instead we can use try:
# Python 3.8+
import importlib.metadata as importlib_metadata
except ImportError:
# Python 3.7 and lower
import importlib_metadata
import importlib.metadata
__version__ = importlib.metadata.version(__name__) Or, we're in luck, Python 3.7 is end-of-life this month (https://devguide.python.org/versions/) so we could drop that backport and simplify it to: import importlib.metadata
__version__ = importlib.metadata.version(__name__) That would be my recommendation. What do you think? |
Thanks for providing an extensive explanation about the issue, couldn't find an easy solution myself. Using Do you want to update the pull-request or merge this and use importlib when 3.7 is EOL? |
I'll update this PR. Do you want to wait until the official EOL (2023-06-27) or are we close enough already? Many projects have already started dropping it. |
We are close enough if you ask me. 3.7 users won't miss any new features or something so can stick to 4.3.1. |
.github/workflows/test.yml
Outdated
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 5 | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing 3.7 here and we can merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
I need to upgrade Read the Docs to use a new Python version than 3.7. Coming up! |
Ready! |
Since this PR contains a lot of different changes squashing doesn't seem right, thoughts? |
Either way is fine for me, I usually don't worry too much it :) |
That suits me well, reading git history still isn't something I do for leisure. Thanks for your contribution! |
Can we get a release with this change? The current available version, 4.3.1, has an issue on the latest Pythons. |
Problem
Python 3.11 was released on 2022-10-24 🚀
We should test it and declare support via the Trove classifier.
Solution
Add to tox.ini for local and CI testing, add to GitHub Actions for CI, and add the Trove classifier to declare support.
Also bump GitHub Actions and add colour to CI logs for readability.
Commandments
CHANGES.rst
file to describe the changes, and quote according issue withGH-<issue_number>
.