Skip to content

How to use python version in lock filename? #44

Answered by oprypin
ketozhang asked this question in Q&A
Discussion options

You must be logged in to vote

I think the only way to get the Python version is through the matrix.

Example how to get it into the env name -> into the lock filename:

[tool.hatch.envs.exampleenv]
type = "pip-compile"
[[tool.hatch.envs.exampleenv.matrix]]
python = ["3.11"]

I was also writing this example:

[tool.hatch.envs.exampleenv]
type = "pip-compile"
lock-filename = "requirements/requirements-{env_name}.{matrix:examplevarname}.txt"
[[tool.hatch.envs.exampleenv.matrix]]
examplevarname = ["3.11"]

but actually the latter part is redundant, the version is part of the env anyway and then it's part of the filename twice

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ketozhang
Comment options

@oprypin
Comment options

@juftin
Comment options

@ketozhang
Comment options

Answer selected by ketozhang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants