Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[thought] `python-version` input -> hook

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
github-actions, python
Domain
ci-cd, devops

Research direction

Start with .readthedocs.yaml and the workflow's existing post-src-checkout, Set up pip cache, and actions/setup-python steps. Trace the proposed interactions among python-version, matrices, custom sources such as deadsnakes or uv, and a possible prepare-python-interpreter hook; done means the behavior and required-input contract are agreed.

Written by the indexing model from the issue text.

Description

enhancement

Sometimes, the Python version cannot be known before starting the job by passing the input easily. One such case is trying to have a single source of truth for building the docs in RTD and GHA.

In many project, the RTD config gluing things together looks as follows:

# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
---

version: 2

build:
  os: ubuntu-24.04
  tools:
    python: >-  # has to be parsed as a YAML string
      3.11
  commands:
  - >-
    PYTHONWARNINGS=error
    python3 -Im venv "${READTHEDOCS_VIRTUALENV_PATH}"
  - >-
    PYTHONWARNINGS=error
    "${READTHEDOCS_VIRTUALENV_PATH}"/bin/python -Im
    pip install tox
  - >-
    PYTHONWARNINGS=error
    "${READTHEDOCS_VIRTUALENV_PATH}"/bin/python -Im
    tox -e build-docs --notest -vvvvv
  - >-
    PYTHONWARNINGS=error
    "${READTHEDOCS_VIRTUALENV_PATH}"/bin/python -Im
    tox -e build-docs --skip-pkg-install -q
    --
    "${READTHEDOCS_OUTPUT}"/html -b dirhtml

...

build.tools.python can only be hardcoded and not sourced from elsewhere so that has to become our source of truth.

And I'd like to feed that version into GHA and possibly into other places. But passing it through the python-version input would mean needing another job to parse this config and possibly separate the reusable workflow out so it would all integrate in an ugly way.

I was initially thinking that it may be a good idea to have a special value like python-version: skip, or python-version: external, or python-version: hook that would mean skipping the actions/setup-python invocation. I thought, that maybe the callers could then use the post-src-checkout hook to do this Python setup and version sourcing.
As I'm writing this, I think that this probably deserves its own hook, perhaps, — prepare-python-interpreter. I'd probably have it between post-src-checkout and Set up pip cache, and move actions/setup-python there too (right after the hook?).
Though, it'd be a good idea to figure out how these are supposed to interact w/ each other. Maybe, instead of having a special sentinel value, we could have the hook output the version and if it does (it could have env-dependent skips internally and only set up the version dynamically for the docs build), we'd skip actions/setup-python. Would we need to make the input non-required, then? What about the matrices w/ custom Python sources like deadsnakes or uv? How would they interact?

Dominant language
No language data
Stars
6
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tox-dev/workflow

All issues in tox-dev/workflow

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.