Environment
Qiskit Terra version : main
Python version : n/a
Operating system : Linux
What is happening?
If one uses tox4, the environment is recreated each time one switches from the black to lint environment, or vice versa.
$ tox -eblack
black: recreate env because env type changed from {'name': 'lint', 'type': 'VirtualEnvRunner'} to {'name': 'black', 'type': 'VirtualEnvRunner'}
black: remove tox env folder .tox/lint
black: install_deps> pip install -c/home/garrison/Qiskit/qiskit-terra/constraints.txt -U setuptools_rust -r /home/garrison/Qiskit/qiskit-terra/requirements.txt -r /home/garrison/Qiskit/qiskit-terra/requirements-dev.txt
[...]
$ tox -elint
lint: recreate env because env type changed from {'name': 'black', 'type': 'VirtualEnvRunner'} to {'name': 'lint', 'type': 'VirtualEnvRunner'}
lint: remove tox env folder .tox/lint
lint: install_deps> pip install -c/home/garrison/Qiskit/qiskit-terra/constraints.txt -U setuptools_rust -r /home/garrison/Qiskit/qiskit-terra/requirements.txt -r /home/garrison/Qiskit/qiskit-terra/requirements-dev.txt
[...]
How can we reproduce the issue?
See above
What should happen?
Environment should not be re-created
Any suggestions?
Several options of how to fix this:
Do not set both environments to the same envdir in tox.ini
Work around this using generative section names, in the way I did at Fix {black,lint} environment re-creation on tox4 qiskit-community/quantum-prototype-template#28 . (I have not tested this since the issue I flagged in that PR was supposedly fixed in tox4.)
@pedrorrivero has used tox-ignore-env-name-mismatch in recent projects (e.g., pyproject-qiskit , staged-primitives ) to deal with this issue.
Environment
What is happening?
If one uses tox4, the environment is recreated each time one switches from the
blacktolintenvironment, or vice versa.How can we reproduce the issue?
See above
What should happen?
Environment should not be re-created
Any suggestions?
Several options of how to fix this:
envdirintox.ini