Skip to content

ci: single-source the Python version via pyproject.toml + add uv-lock pre-commit hook - #15111

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:ci-uv-precommit-python-version-file
Aug 28, 2026
Merged

ci: single-source the Python version via pyproject.toml + add uv-lock pre-commit hook#15111
cclauss merged 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:ci-uv-precommit-python-version-file

Conversation

@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

As discussed in #15081 and #15104 (comment), this does the two follow-ups:

1. Add astral-sh/uv-pre-commit (uv-lock hook)

Keeps uv.lock automatically in sync with pyproject.toml. Right now the lockfile only gets refreshed by hand, so it can silently drift (e.g. after a dependency bump). With this hook, pre-commit.ci relocks and auto-commits whenever pyproject.toml changes, so uv sync in CI always sees a consistent lock.

- repo: https://github.com/astral-sh/uv-pre-commit
  rev: 0.12.7
  hooks:
    - id: uv-lock

2. python-version-file: pyproject.toml on every actions/setup-python

Replaces the hard-coded python-version: 3.14 in build.yml, project_euler.yml (both jobs), sphinx.yml, and directory_writer.yml with python-version-file: pyproject.toml. actions/setup-python@v7 reads project.requires-python (>=3.14), so the interpreter version now has a single source of truth — bumping requires-python moves all of CI at once and there's no chance of a workflow being left behind.

No behavioural change today (still resolves to 3.14); this is a maintainability cleanup. Happy to adjust the pin style if you'd prefer a .python-version file instead.

…-commit hook

- Add astral-sh/uv-pre-commit (uv-lock) so uv.lock stays in sync with
  pyproject.toml automatically instead of relying on manual relocks.
- Replace 'python-version: 3.14' with 'python-version-file: pyproject.toml'
  in every workflow that uses actions/setup-python (build, project_euler,
  sphinx, directory_writer), making requires-python the single source of
  truth for the interpreter version.
@algorithms-keeper

Copy link
Copy Markdown

Closing this pull request as invalid

@priya-sundaram-dev, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper
algorithms-keeper Bot removed the request for review from cclauss August 28, 2026 11:28
@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Aug 28, 2026
@cclauss cclauss reopened this Aug 28, 2026
@algorithms-keeper algorithms-keeper Bot added the enhancement This PR modified some existing files label Aug 28, 2026
@cclauss cclauss removed the invalid label Aug 28, 2026
@cclauss
cclauss enabled auto-merge (squash) August 28, 2026 11:39

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect!

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Aug 28, 2026
@cclauss
cclauss merged commit 02c6850 into TheAlgorithms:master Aug 28, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants