Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substitute variables into requirements #129

Open
lordmauve opened this issue Oct 4, 2024 · 0 comments
Open

Substitute variables into requirements #129

lordmauve opened this issue Oct 4, 2024 · 0 comments

Comments

@lordmauve
Copy link
Contributor

Description

I am using pip-tools to compile requirements from pyproject.toml and write to requirements.txt files.

A once task to pip-compile the requirements, e.g.

[tool.thx.jobs.pip-compile]
run = "pip-compile -o requirements/dev.txt --extra dev --generate-hashes pyproject.toml"
once = true

has the drawback that some requirements are specified as

exceptiongroup; python_version<3.11

and these requirements will only be pinned if this task is run on an interpreter older than 3.11. once = true runs on the highest version, so will typically fail to pin things.

once = true might be better to run on the lowest version, but really, the only correct solution is to pin dependencies for each interpreter. However this will require being able to substitute the python_version into the requirements:

[tool.thx]
python_versions = ["3.12", "3.11", "3.10"]

# Requirements to use for all jobs
requirements = ["requirements/dev-{python_version}.txt"]

[tool.thx.jobs.pip-compile]
run = "pip-compile -o requirements/dev-{python_version}.txt --extra dev --generate-hashes pyproject.toml"

Details

  • OS: Linux
  • Python version: 3.12
  • thx version: 0.6.0
  • Can you repro on main? Yes
  • Can you repro in a clean virtualenv? Yes
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

No branches or pull requests

1 participant