-
Looking at hatch context variables documented in https://hatch.pypa.io/latest/config/environment/overview/ I can't seem to find a way to also write out the python version for the lock file. |
Beta Was this translation helpful? Give feedback.
Answered by
oprypin
Dec 11, 2023
Replies: 1 comment 4 replies
-
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 |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
ketozhang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
I was also writing this example:
but actually the latter part is redundant, the version is part of the env anyway and then it's part of the filename twice