tox-dev / tox-pyenv Goto Github PK
View Code? Open in Web Editor NEWplugin that tells tox to use `pyenv which` to find python executables
License: Apache License 2.0
plugin that tells tox to use `pyenv which` to find python executables
License: Apache License 2.0
Hello, would you consider moving the project under the tox-dev umbrella? See documentation under https://tox.readthedocs.io/en/rewrite/plugins.html#adoption-of-a-plugin-under-tox-dev-github-organization
Furthermore, tox v4 is getting ready and we'd like to make sure this plugin is supported from day 1, we're collecting feature gaps for this under tox-dev/tox#1974. Would be great if you could join our development chat under https://discord.gg/tox so we can assist with this. If you do so please drop in a line in the #plugin
chat with the name of the repository you maintain. Thanks!
Sometimes I get this error on strerr, and I don't think this should happen:
No handlers could be found for logger "tox_pyenv"
Using pyenv
I have multiple interpreters installed
pyenv versions
system
3.6.10
3.7.6
3.8.0
* 3.8.1 (set by /home/varun/.pyenv/version)
However, when I run tox
, I get the output:
tox
GLOB sdist-make: /home/varun/projects/nuke/setup.py
py36 recreate: /home/varun/projects/nuke/.tox/py36
ERROR: InterpreterNotFound: python3.6
py37 recreate: /home/varun/projects/nuke/.tox/py37
ERROR: InterpreterNotFound: python3.7
py38 inst-nodeps: /home/varun/projects/nuke/.tox/.tmp/package/1/nuke-2.4.3.zip
py38 installed: args==0.1.0,attrs==19.3.0,Click==7.0,colorama==0.3.9,crayons==0.3.0,more-itertools==8.4.0,nuke @ file:///home/varun/projects/nuke/.tox/.tmp/package/1/nuke-2.4.3.zip,packaging==20.4,pluggy==0.13.1,py==1.4.34,pypandoc==1.4,pyparsing==2.4.7,pytest==5.4.3,six==1.15.0,wcwidth==0.2.5
py38 run-test-pre: PYTHONHASHSEED='2434039302'
py38 run-test: commands[0] | pytest -s -v
tox
runs my tests with all the specified interpreters and doesn't complain about missing interpreters.
This is my tox.ini
file:
[tox]
envlist = py36, py37, py38
[testenv]
commands = pytest -s -v
deps =
pytest
-rrequirements.txt
This is the pip package installed
pip show tox-pyenv
Name: tox-pyenv
Version: 1.1.0
Summary: tox plugin that makes tox use `pyenv which` to find python executables
Home-page: https://github.com/samstav/tox-pyenv
Author: Sam Stavinoha
Author-email: [email protected]
License: Apache License, Version 2.0
Location: /home/varun/.pyenv/versions/3.8.1/lib/python3.8/site-packages
Requires: tox
Required-by:
and I am on Arch Linux.
Am I doing something weird? I followed everything on the README.
At this moment there are manual steps one should take in order to install all python environments needed for testing using tox-pyenv. The project homepage specifies on how to install these on CircleCI on the home page.
How about if we can automatically install missing python interpreters so a simple execution of tox
would install them when they are missing.
This would make testing much easier on various CI systems (Travis, Jenkins) and even development environment.
If there are concerns regarding change of behaviour we could make this optional by adding an option named install_missing_interpreters = true
to tox.ini
.
Set tox_pyenv_fallback
in general testenv definition and test with tox --showconfig
.
Setting tox_pyenv_fallback
to both true
or false
results in tox_pyenv_fallback = True
output from tox --showconfig
.
Providing --tox-pyenv-no-fallback
on the command line allows testenv definition tox_pyenv_fallback
to take control...
If someone installs tox-pyenv module and pyenv tool is not present you endup with a totally broken tox which would fail to build any tox.ini file.
I think that tox-pyenv should only raise a warning if pyenv is not installed and avoid throwing an exception.
pyenv is used to get additional python interpreters on some platforms but this does not mean that they are really needed. If someone wants to fail on missing pyenv, you could add an enforcing option in the config.
Still, default behaviour should be not to break tox when pyenv is not installed.
[mini] err: File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
[mini] err: "__main__", fname, loader, pkg_name)
[mini] err: File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
[mini] err: exec code in run_globals
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/__main__.py", line 4, in <module>
[mini] err: main()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 39, in main
[mini] err: retcode = Session(config).runcommand()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 390, in runcommand
[mini] err: return self.subcommand_test()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 541, in subcommand_test
[mini] err: if self.setupenv(venv):
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 449, in setupenv
[mini] err: status = venv.update(action=action)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 161, in update
[mini] err: self.hook.tox_testenv_create(action=action, venv=self)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 745, in __call__
[mini] err: return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 339, in _hookexec
[mini] err: return self._inner_hookexec(hook, methods, kwargs)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 334, in <lambda>
[mini] err: _MultiCall(methods, kwargs, hook.spec_opts).execute()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 614, in execute
[mini] err: res = hook_impl.function(*args)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 398, in tox_testenv_create
[mini] err: config_interpreter = venv.getsupportedinterpreter()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 199, in getsupportedinterpreter
[mini] err: return self.envconfig.getsupportedinterpreter()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 623, in getsupportedinterpreter
[mini] err: info = self.config.interpreters.get_info(envconfig=self)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/interpreters.py", line 28, in get_info
[mini] err: executable = self.get_executable(envconfig)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox/interpreters.py", line 23, in get_executable
[mini] err: exe = self.hook.tox_get_python_executable(envconfig=envconfig)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 745, in __call__
[mini] err: return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 339, in _hookexec
[mini] err: return self._inner_hookexec(hook, methods, kwargs)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 334, in <lambda>
[mini] err: _MultiCall(methods, kwargs, hook.spec_opts).execute()
[mini] err: File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 614, in execute
[mini] err: res = hook_impl.function(*args)
[mini] err: File "/usr/local/lib/python2.7/dist-packages/tox_pyenv.py", line 83, in tox_get_python_executable
[mini] err: "pyenv doesn't seem to be installed, you probably "
[mini] err: tox_pyenv.PyenvMissing: pyenv doesn't seem to be installed, you probably don't want this plugin installed either.
Am I correct that the comment on README regarding "the list of python versions that are pre-installed in the CircleCI build environment (as of 09/27/2017)", does not apply in CircleCI 2.0?
Any recommendations on usage for CircleCI 2.0?
Thanks
Hello! I found this plugin when looking for doc about Python / tox usage in CircleCI. The current doc doesn’t explain clearly what problem it solves, and my tox config that doesn’t use it seems to work.
Currently if someone is installing tox-pyenv
on a system without pyenv
it will break any execution of tox
with an exception like:
15:36:20 File "/usr/lib/python2.7/site-packages/pluggy.py", line 596, in execute
15:36:20 res = hook_impl.function(*args)
15:36:20 File "/usr/lib/python2.7/site-packages/tox_pyenv.py", line 83, in tox_get_python_executable
15:36:20 "pyenv doesn't seem to be installed, you probably "
15:36:20 tox_pyenv.PyenvMissing: pyenv doesn't seem to be installed, you probably don't want this plugin installed either.
Giving an warning would be ok but failing execution is clearly a big issue, especially because tox would pass otherwise.
I tried to install with with conda, but get this problems:
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:
Specifications:
Looks like tox-pyenv
relies on the py
library but doesn't declare it explicitly as a dependency
Line 47 in 7391610
Since tox
itself is dropping py
, tox-pyenv
breaks with the latest release candidate.
Ping @gaborbernat as the common maintainer in both projects.
Looks like the current release 1.1.0 does NOT play nicely with tox 4.x.
In addition to the bug documented here:
#21
On adding the "py" package, the next error uncovered is:
(tox) root@9cb1a471f174:~# tox --version
ROOT: No tox.ini or setup.cfg or pyproject.toml found, assuming empty tox.ini at /root
Traceback (most recent call last):
File "/root/tox/bin/tox", line 8, in
sys.exit(run())
File "/root/tox/lib/python3.8/site-packages/tox/run.py", line 19, in run
result = main(sys.argv[1:] if args is None else args)
File "/root/tox/lib/python3.8/site-packages/tox/run.py", line 38, in main
state = setup_state(args)
File "/root/tox/lib/python3.8/site-packages/tox/run.py", line 53, in setup_state
options = get_options(*args)
File "/root/tox/lib/python3.8/site-packages/tox/config/cli/parse.py", line 38, in get_options
guess_verbosity, log_handler, source = _get_base(args)
File "/root/tox/lib/python3.8/site-packages/tox/config/cli/parse.py", line 61, in _get_base
MANAGER.load_plugins(source.path)
File "/root/tox/lib/python3.8/site-packages/tox/plugin/manager.py", line 83, in load_plugins
self._register_plugins(inline)
File "/root/tox/lib/python3.8/site-packages/tox/plugin/manager.py", line 37, in _register_plugins
self.manager.load_setuptools_entrypoints(NAME)
File "/root/tox/lib/python3.8/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
plugin = ep.load()
File "/root/.pyenv/versions/3.8.13/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/root/.pyenv/versions/3.8.13/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 843, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/tox/lib/python3.8/site-packages/tox_pyenv.py", line 48, in
from tox import hookimpl as tox_hookimpl
ImportError: cannot import name 'hookimpl' from 'tox' (/root/tox/lib/python3.8/site-packages/tox/init.py)
Maybe use detox
: https://pypi.python.org/pypi/detox/
As of tox 1.7.2, you can simply skip environments when the interpreter is missing, via the skip_missing_interpreters setting. However, when using tox-pyenv, this setting is ignored, and you receive a hard fail when a particular version isn't installed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.