[thought] `python-version` input -> hook
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tox-dev/workflow
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement help wanted question
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in tox-dev/workflow
Similar issues
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskOpenlesson-submission needs-ac pending-review
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Ikalus1988/MisakaNet#2870 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
n8n-io/terraform-aws-n8n#175 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
digital-go-jp/abr-geocoder#402 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
influxdata/helm-charts#856 ·
Maintainers usually reply within 5 days