Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#8 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
github-actions, python
领域
ci-cd, devops

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
没有语言数据
星标
6
派生
2
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tox-dev/workflow 的其他 Issue

查看 tox-dev/workflow 的全部 Issue

相似的 Issue

更多 DevOps Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。