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

Pin Python version to 3.12 #5456

Merged
merged 8 commits into from
Oct 12, 2024

Conversation

browniebroke
Copy link
Member

@browniebroke browniebroke commented Oct 11, 2024

Description

Looking at #5450 I noticed that Python 3.13 classifier was added, which promopted me to look at which version of Python was used to run the tests, and it turns out they run using Python 3.13:

Checklist:

  • I've made sure that tests are updated accordingly (especially if adding or updating a template option)
  • I've updated the documentation or confirm that my change doesn't require any updates

Rationale

Run tests on the same Python version as we officially support

@browniebroke
Copy link
Member Author

I also noticed that our bare metal tests run on Python 3.10 since we migrated the template to uv: https://github.com/cookiecutter/cookiecutter-django/actions/runs/11194437208/job/31120912239?pr=5356#step:7:609

Previous run was on Python 3.12 (as expected): https://github.com/cookiecutter/cookiecutter-django/actions/runs/11193688349/job/31119292907?pr=5430#step:7:538

@foarsitter
Copy link
Collaborator

So the project itself (not the template) is compatible with 3.13?

@browniebroke
Copy link
Member Author

No, the template tests were running on 3.13, we don't run any tests in the project itself on that job, just linters. It seems that the project tests were downgraded to python 3.10 in the bare metal tests.

@@ -98,6 +98,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this required? Capping python in pyproject.toml should be sufficient was my expectation.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't seem to be respecting it because the generated project is not using uv yet. It's for the test_bare.sh script

Copy link
Member Author

@browniebroke browniebroke Oct 12, 2024

Choose a reason for hiding this comment

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

I'll remove it to confirm

Copy link
Member Author

@browniebroke browniebroke Oct 12, 2024

Choose a reason for hiding this comment

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

The pytest run uses Python 3.10 here platform linux -- Python 3.10.12:

https://github.com/cookiecutter/cookiecutter-django/actions/runs/11306934810/job/31448084312?pr=5456#step:7:561

This is because these lines use the first pip and pytest on the PATH, which are not the one from uv:

pip install -r requirements/local.txt

Copy link
Collaborator

@foarsitter foarsitter left a comment

Choose a reason for hiding this comment

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

Ah yes, you are right. The problem is clear to me now.

@browniebroke
Copy link
Member Author

I tried another approach, runing all commands from the script via uv, but that doesn't seem to work. I'll revert back to using actions/setup-python as it seems more straightforward

@browniebroke browniebroke merged commit 931e300 into cookiecutter:master Oct 12, 2024
14 checks passed
@browniebroke browniebroke deleted the pin-python-3.12 branch October 12, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants