Skip to content

Comments

Resolve python version to work with compatible operator#446

Merged
jayqi merged 5 commits intomasterfrom
444-uv-python-version
Mar 24, 2025
Merged

Resolve python version to work with compatible operator#446
jayqi merged 5 commits intomasterfrom
444-uv-python-version

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
proinsias added a commit to proinsias/cookiecutter-data-science-proinsias that referenced this pull request Nov 3, 2025
* upstream/master: (24 commits)
  Add poetry as an env manager (drivendataorg#460)
  Support pixi as environment manager (drivendataorg#459)
  Docs: Add guidelines for contributing and requesting tools (drivendataorg#456)
  Fix terminal animation generation in docs build (drivendataorg#451)
  Fix failing pipenv installation on Windows GH actions runners (drivendataorg#453)
  Fix typo in using-the-template.md (drivendataorg#448)
  Bump to v2.2.0 [skip ci]
  Update HISTORY.md [skip ci]
  Add option for tests (drivendataorg#447)
  Resolve python version to work with compatible operator (drivendataorg#446)
  Add pyproject.toml as a dependencies file option (drivendataorg#436)
  Make PyPI badges links to PyPI (drivendataorg#440)
  Update to version v2.1.0 (drivendataorg#438)
  Add back isort configuration that was removed in drivendataorg#387 (drivendataorg#439)
  add badges to readme and docs homepage (drivendataorg#434)
  Added support for the uv package and project manager (drivendataorg#408)
  Add ruff as default linting + formatting option (drivendataorg#387)
  Add PyTest IDs for better readability and filtering (drivendataorg#409)
  prepare for 2.0.1 release by bumping version in pyproject.toml and updating change log (drivendataorg#422)
  Fix pre-prompt ccds version error (drivendataorg#426)
  ...
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