How do I map the pyenv to tox if I use tox in poetry #4044
ralf-kowatsch
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
My setup is
pyproject.tom
`
[tool.tox]
env_list = ["3.11.16", "3.12.14", "coverage-report"] # We have to specify the python versions explicitly to get around acivating multiple versions in the shim.
[tool.tox.env_run_base]
pass_env = ["*"]
package = "editable"
deps = ["coverage[toml]", "unittest-xml-reporting", "python-dotenv"]
commands = [
["coverage", "run", "--data-file=.coverage.{envname}"],
]
[tool.tox.env.coverage-report]
depends = ["3.11.15", "3.12.13"]
skip_install = true
pass_env = ["*"]
deps = ["coverage[toml]", "unittest-xml-reporting"]
commands = [
["coverage", "combine"],
["coverage", "xml", "-o", "coverage.xml"]
]
`
and a Makefile
`
PYTHON_VERSION := $(shell cat .python-version)
PYENV_VERSIONS := 3.14.7 3.12.14 3.11.16 3.9.25
all: setup_environment
clean:
poetry run pre-commit uninstall
git clean -fdX
setup_environment: check
pyenv install $(PYENV_VERSIONS) --skip-existing
&& pyenv global $(PYENV_VERSIONS)
&& poetry env use $(PYTHON_VERSION)
&& poetry install
&& poetry run pre-commit install
check: pyenv_exists poetry_exists is_git
pyenv_exists: ; @which pyenv > /dev/null
poetry_exists: ; @which poetry > /dev/null
is_git: ; @git rev-parse --git-dir > /dev/null
`
It seems that py311,py312 in env_list does not work, tox cant find the python interpreter, falls back to the default interpreter and does not choose the expected python version. What do I do wrong?
All reactions