Skip to content

Conversation

@r-b-g-b
Copy link
Contributor

@r-b-g-b r-b-g-b commented Mar 19, 2025

Closes #444

Add a post gen hook to resolves a Python version string to one that behaves as expected with the "compatible release" operator which we use in pyproject.toml [requires-python], for example:

  • 3.13 should result in ~=3.13.0 which installs the latest version of Python that is compatible with 3.13, so the highest patch number for 3.13 (3.13.3 at the time of writing)
  • 3.13.2 should result in ==3.13.2 which ensures Python 3.13.2 is used

Copy link
Member

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

FYI, I think our CI tests should fail for #444, and I'm working on trying to make that happen in #445.

I think we should merge the two PRs together before merging them into master.

Examples:
- 3.13 should result in ~=3.13.0 which installs the latest version of Python that is compatible
with 3.13, so the highest patch number for 3.13 (3.13.3 at the time of writing)
- 3.13.2 should result in ~=3.13.2 which ensures Python 3.13.2 is used
Copy link
Member

Choose a reason for hiding this comment

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

- 3.13.2 should result in ~=3.13.2 which ensures Python 3.13.2 is used

This is not correct. ~=3.13.2 is equivalent to >= 3.13.2, == 3.13.*, so 3.13.3, 3.13.4, etc. will also satisfy it.

https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release

In the case of 3 parts, I think we want to use an exact version match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha thanks, I had misunderstood that. Updated, and confirmed that it works when providing . (use ~=) and .. (use ==).

Use uv in CI

Fix python version of created environment in tests

Pipenv should create its own virtualenv

Remove sys import

Remove extraneous parenthesis

Fix wrong input to configs product

Fix virtualenvwrapper to set Python version instead of Python interpreter

Install Python executables into PATH
@pjbull pjbull temporarily deployed to 444-uv-python-version - Cookiecutter Data Science PR #446 March 23, 2025 21:47 — with Render Destroyed
@jayqi jayqi merged commit e6119d3 into master Mar 24, 2025
16 checks passed
@jayqi jayqi deleted the 444-uv-python-version branch March 24, 2025 00:54
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.

uv dependency management doesn't use specified Python version for venv

3 participants