├── requirements.txt
├── setup.cfg
├── test-requirements.txt
├── circle.yml
├── tox.ini
├── .gitignore
├── setup.py
├── README.rst
├── README.md
├── test_tox_pyenv.py
├── tox_pyenv.py
└── LICENSE
/requirements.txt:
--------------------------------------------------------------------------------
1 | tox>=2.0
2 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [wheel]
2 | universal = 1
3 |
--------------------------------------------------------------------------------
/test-requirements.txt:
--------------------------------------------------------------------------------
1 | mock>=2.0.0
2 | nose==1.3.7
3 | pycodestyle>=2.3.1
4 | pylint>=1.7.2
5 |
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | python:
3 | version: '2.7.11'
4 | environment:
5 | TOX_PYPY: 'pypy-2.5.0'
6 | TOX_PY: '2.7.11'
7 | TOX_PY26: '2.6.8'
8 | TOX_PY27: '2.7.9'
9 | TOX_PY33: '3.3.3'
10 | TOX_PY34: '3.4.3'
11 | TOX_PY35: '3.5.0'
12 |
13 | dependencies:
14 | override:
15 | - pip -V
16 | - pip install -U pip
17 | - pip install -U tox
18 | - pip install -U .
19 | - pyenv local $TOX_PY35 $TOX_PY34 $TOX_PY33 $TOX_PY27 $TOX_PY26 $TOX_PYPY
20 |
21 | test:
22 | override:
23 | - tox -v --recreate
24 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | envlist = style,py,py26,py27,py33,py34,py35,pypy
3 |
4 | [testenv]
5 | whitelist_externals = env
6 | install_command = pip install -U {opts} {packages}
7 | setenv= TOX_ENV_NAME={envname}
8 | passenv = TOX_*
9 | deps = -r{toxinidir}/requirements.txt
10 | -r{toxinidir}/test-requirements.txt
11 | commands = python -V
12 | env
13 | nosetests {posargs} --verbose --nocapture --logging-level=DEBUG
14 |
15 |
16 | [testenv:style]
17 | deps = -r{toxinidir}/requirements.txt
18 | -r{toxinidir}/test-requirements.txt
19 | basepython = python2.7
20 | commands =
21 | pycodestyle tox_pyenv.py test_tox_pyenv.py
22 | pylint tox_pyenv.py
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | # Distribution / packaging
9 | .Python
10 | env/
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | *.egg-info/
23 | .installed.cfg
24 | *.egg
25 |
26 | # PyInstaller
27 | # Usually these files are written by a python script from a template
28 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
29 | *.manifest
30 | *.spec
31 |
32 | # Installer logs
33 | pip-log.txt
34 | pip-delete-this-directory.txt
35 |
36 | # Unit test / coverage reports
37 | htmlcov/
38 | .tox/
39 | .coverage
40 | .coverage.*
41 | .cache
42 | nosetests.xml
43 | coverage.xml
44 | *,cover
45 |
46 | # Translations
47 | *.mo
48 | *.pot
49 |
50 | # Django stuff:
51 | *.log
52 |
53 | # Sphinx documentation
54 | docs/_build/
55 |
56 | # PyBuilder
57 | target/
58 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import os
4 | from setuptools import setup
5 | import subprocess
6 | import sys
7 |
8 |
9 | here = os.path.dirname(os.path.realpath(__file__))
10 | with open(os.path.join(here, 'tox_pyenv.py'), 'r') as abt:
11 | marker, about, abt = '# __about__', {}, abt.read()
12 | assert abt.count('# __about__') == 2
13 | abt = abt[abt.index(marker):abt.rindex(marker)]
14 | exec(abt, about)
15 |
16 |
17 | # Add the commit hash to the keywords for sanity.
18 | if any(k in ' '.join(sys.argv).lower() for k in ['upload', 'dist']):
19 | try:
20 | current_commit = subprocess.check_output(
21 | ['git', 'rev-parse', 'HEAD']).strip()
22 | except (OSError, subprocess.CalledProcessError):
23 | pass
24 | else:
25 | if current_commit and len(current_commit) == 40:
26 | about['__keywords__'].append(current_commit[:8])
27 |
28 |
29 | # pandoc --from=markdown_github --to=rst README.md --output=README.rst
30 | with open(os.path.join(here, 'README.rst')) as rdme:
31 | LONG_DESCRIPTION = rdme.read()
32 |
33 |
34 | ENTRY_POINTS = {
35 | 'tox': [
36 | 'pyenv = tox_pyenv',
37 | ]
38 | }
39 |
40 | INSTALL_REQUIRES = [
41 | 'tox>=2.0'
42 | ]
43 |
44 | TESTS_REQUIRE = [
45 | 'mock>=2.0.0',
46 | 'pycodestyle>=2.3.1',
47 | 'pylint>=1.7.2',
48 | ]
49 |
50 | CLASSIFIERS = [
51 | 'Intended Audience :: Developers',
52 | 'License :: OSI Approved :: Apache Software License',
53 | 'Operating System :: OS Independent',
54 | 'Topic :: Software Development',
55 | 'Programming Language :: Python',
56 | 'Programming Language :: Python :: 2',
57 | 'Programming Language :: Python :: 2.6',
58 | 'Programming Language :: Python :: 2.7',
59 | 'Programming Language :: Python :: 3',
60 | 'Programming Language :: Python :: 3.3',
61 | 'Programming Language :: Python :: 3.4',
62 | 'Programming Language :: Python :: 3.5',
63 | 'Programming Language :: Python :: Implementation :: CPython',
64 | 'Programming Language :: Python :: Implementation :: PyPy',
65 | ]
66 |
67 |
68 | package_attributes = {
69 | 'author': about['__author__'],
70 | 'author_email': about['__email__'],
71 | 'classifiers': CLASSIFIERS,
72 | 'description': about['__summary__'],
73 | 'entry_points': ENTRY_POINTS,
74 | 'install_requires': INSTALL_REQUIRES,
75 | 'keywords': ' '.join(about['__keywords__']),
76 | 'license': about['__license__'],
77 | 'long_description': LONG_DESCRIPTION,
78 | 'name': about['__title__'],
79 | 'tests_require': TESTS_REQUIRE,
80 | 'py_modules': ['tox_pyenv'],
81 | 'url': about['__url__'],
82 | 'version': about['__version__'],
83 | }
84 |
85 | setup(**package_attributes)
86 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | tox-pyenv
2 | =========
3 |
4 | | |latest| |Circle CI|
5 |
6 | Plugin that tells `tox `__ to
7 | use `pyenv which `__
8 | to `find python
9 | executables `__
10 |
11 | Your project's `circle.yml `__
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 |
14 | In order for ``tox`` to have the versions of python you want available,
15 | set them using
16 | `pyenv local `__
17 |
18 | .. code:: yaml
19 |
20 | dependencies:
21 | override:
22 | - pip install tox tox-pyenv
23 | - pyenv local 2.7.9 3.4.3 3.5.0
24 |
25 | The versions passed to ``pyenv local`` must be
26 | `installed `__
27 | for this to work. See `CircleCI Preinstalled Python
28 | Versions <#circleci-preinstalled-python-versions>`__ for a list.
29 |
30 | Corresponding `tox.ini `__
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32 |
33 | .. code:: ini
34 |
35 | [tox]
36 | envlist = py27,py34,py35
37 |
38 | The result of the setup above means running ``tox`` will run tests
39 | against python 2.7.9, python 3.4.3 and python 3.5.0, assuming those
40 | versions of python have been
41 | `pyenv install `__\ed.
42 |
43 | notes
44 | ^^^^^
45 |
46 | If you want tox to *exclusively* use ``pyenv which`` to find
47 | executables, you will need use the ``--tox-pyenv-no-fallback`` command
48 | line option, or set ``tox_pyenv_fallback=False`` in your tox.ini. By
49 | default, if ``tox-pyenv`` fails to find a python executable it will
50 | fallback to tox's built-in strategy.
51 |
52 | CircleCI Preinstalled Python Versions
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | Here is the list of python versions that are *pre-installed* in the
56 | CircleCI build environment (as of 09/27/2017):
57 |
58 | ::
59 |
60 | $ pyenv versions
61 | system
62 | 2.6.6
63 | 2.6.8
64 | 2.7
65 | 2.7.10
66 | 2.7.11
67 | 2.7.3
68 | 2.7.4
69 | 2.7.5
70 | 2.7.6
71 | 2.7.7
72 | 2.7.8
73 | * 2.7.9 (set by /home/ubuntu/.pyenv/version)
74 | 3.1.5
75 | 3.2
76 | 3.2.5
77 | 3.3.0
78 | 3.3.2
79 | 3.3.3
80 | 3.4.0
81 | 3.4.1
82 | 3.4.2
83 | 3.4.3
84 | 3.5.0
85 | pypy-2.2.1
86 | pypy-2.3.1
87 | pypy-2.4.0
88 | pypy-2.5.0
89 |
90 | If the version you need isn't in the list, such as Python ``3.6-dev``
91 | include an ``install`` step:
92 |
93 | ::
94 |
95 | dependencies:
96 | override:
97 | - pip install tox tox-pyenv
98 | - pyenv install --skip-existing 3.6-dev
99 | - pyenv local 3.6-dev
100 |
101 | .. |latest| image:: https://img.shields.io/pypi/v/tox-pyenv.svg
102 | :target: https://pypi.python.org/pypi/tox-pyenv
103 | .. |Circle CI| image:: https://circleci.com/gh/samstav/tox-pyenv/tree/master.svg?style=shield
104 | :target: https://circleci.com/gh/samstav/tox-pyenv/tree/master
105 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # tox-pyenv
2 |
3 | > tox 4 delegates the Python discovery job to virtualenv: tox.wiki/en/latest/plugins.html#tox-get-python-executable
4 | > A special tox plugin like this is no longer needed.
5 |
6 | > How to migrate:
7 |
8 | > Uninstall tox-pyenv.
9 | > Install virtualenv-pyenv.
10 | > Set the discovery mechanism to pyenv. Both export VIRTUALENV_DISCOVERY=pyenv in a shell and setenv = VIRTUALENV_DISCOVERY=pyenv in a tox config do the job. Another option is a virtualenv.ini config file: virtualenv.pypa.io/en/latest/cli_interface.html#conf-file
11 |
12 |
13 | [](https://pypi.python.org/pypi/tox-pyenv)
14 | [](https://circleci.com/gh/samstav/tox-pyenv/tree/master)
15 |
16 | Plugin that tells [tox](https://tox.readthedocs.org/en/latest/) to use [`pyenv which`](https://github.com/yyuu/pyenv/blob/master/COMMANDS.md#pyenv-which) to [find python executables](https://testrun.org/tox/latest/plugins.html#tox.hookspecs.tox_get_python_executable)
17 |
18 | ### Why does this exist?
19 |
20 | See the full story here https://github.com/samstav/circleci-python-sandbox/issues/1
21 |
22 |
23 | ### Your project's [circle.yml](https://circleci.com/docs/configuration)
24 |
25 | In order for `tox` to have the versions of python you want available, set them using [`pyenv local`](https://github.com/yyuu/pyenv/blob/master/COMMANDS.md#pyenv-local)
26 |
27 | ```yaml
28 | dependencies:
29 | override:
30 | - pip install tox tox-pyenv
31 | - pyenv local 2.7.9 3.4.3 3.5.0
32 | ```
33 |
34 | The versions passed to `pyenv local` must be [installed](https://github.com/yyuu/pyenv/blob/master/COMMANDS.md#pyenv-install) for this to work. See [CircleCI Preinstalled Python Versions](#circleci-preinstalled-python-versions) for a list.
35 |
36 | ### Corresponding [tox.ini](https://tox.readthedocs.org/en/latest/config.html)
37 |
38 | ```ini
39 | [tox]
40 | envlist = py27,py34,py35
41 | ```
42 |
43 | The result of the setup above means running `tox` will run tests against python 2.7.9, python 3.4.3 and python 3.5.0, assuming those versions of python have been [`pyenv install`ed](https://github.com/yyuu/pyenv/blob/master/COMMANDS.md#pyenv-install)
44 |
45 | ### Notes
46 |
47 | If you want tox to _exclusively_ use `pyenv which` to find executables, you will need use the `--tox-pyenv-no-fallback` command line option, or set `tox_pyenv_fallback=False` in your tox.ini. By default, if `tox-pyenv` fails to find a python executable it will fallback to tox's built-in strategy.
48 |
49 | ### CircleCI Preinstalled Python Versions
50 |
51 | Here is the list of python versions that are *pre-installed* in the CircleCI build environment (as of 09/27/2017):
52 |
53 | ```
54 | $ pyenv versions
55 | system
56 | 2.6.6
57 | 2.6.8
58 | 2.7
59 | 2.7.10
60 | 2.7.11
61 | 2.7.3
62 | 2.7.4
63 | 2.7.5
64 | 2.7.6
65 | 2.7.7
66 | 2.7.8
67 | * 2.7.9 (set by /home/ubuntu/.pyenv/version)
68 | 3.1.5
69 | 3.2
70 | 3.2.5
71 | 3.3.0
72 | 3.3.2
73 | 3.3.3
74 | 3.4.0
75 | 3.4.1
76 | 3.4.2
77 | 3.4.3
78 | 3.5.0
79 | pypy-2.2.1
80 | pypy-2.3.1
81 | pypy-2.4.0
82 | pypy-2.5.0
83 | ```
84 |
85 | If the version you need isn't in the list, such as Python `3.6-dev` include an `install` step:
86 |
87 | ```
88 | dependencies:
89 | override:
90 | - pip install tox tox-pyenv
91 | - pyenv install --skip-existing 3.6-dev
92 | - pyenv local 3.6-dev
93 | ```
94 |
--------------------------------------------------------------------------------
/test_tox_pyenv.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 |
3 | import errno
4 | import os
5 | import platform
6 | import subprocess
7 | import sys
8 | import unittest
9 |
10 | import mock
11 |
12 | import tox_pyenv
13 |
14 | try:
15 | unicode
16 | except NameError:
17 | unicode = str
18 |
19 |
20 | def touni(s, enc='utf8', err='strict'):
21 | if isinstance(s, bytes):
22 | return s.decode(enc, err)
23 | else:
24 | return unicode(s or ("" if s is None else s))
25 |
26 |
27 | class MockTestenvConfig(object):
28 | def __init__(self, basepython):
29 | self.basepython = basepython
30 | self.tox_pyenv_fallback = True
31 |
32 |
33 | class TestToxPyenvNoPyenv(unittest.TestCase):
34 |
35 | def setUp(self):
36 | def _mock_popen_func(cmd, *args, **kw):
37 | if all(x in cmd for x in ['which', '*TEST*']):
38 | raise OSError(errno.ENOENT, 'No such file or directory')
39 | self.fail('Unexpected call to Popen')
40 | # return self.popen_patcher.temp_original(*args, **kw)
41 | self.popen_patcher = mock.patch.object(
42 | tox_pyenv.subprocess, 'Popen', autospec=True,
43 | side_effect=_mock_popen_func,
44 | )
45 | self.popen_patcher.start()
46 | self.warning_patcher = mock.patch.object(
47 | tox_pyenv.LOG, 'warning', autospec=True,
48 | )
49 | self.warning_patcher.start()
50 |
51 | def tearDown(self):
52 | self.popen_patcher.stop()
53 | self.warning_patcher.stop()
54 |
55 | def test_logs_if_no_pyenv_binary(self):
56 | mock_test_env_config = MockTestenvConfig('*TEST*')
57 | tox_pyenv.tox_get_python_executable(mock_test_env_config)
58 | expected_popen = [
59 | mock.call(
60 | [mock.ANY, 'which', '*TEST*'],
61 | stderr=-1, stdout=-1,
62 | universal_newlines=True
63 | )
64 | ]
65 | self.assertEqual(
66 | tox_pyenv.subprocess.Popen.call_args_list,
67 | expected_popen
68 | )
69 | expected_warn = [
70 | mock.call("pyenv doesn't seem to be installed, you "
71 | "probably don't want this plugin installed either.")
72 | ]
73 | self.assertEqual(tox_pyenv.LOG.warning.call_args_list, expected_warn)
74 |
75 |
76 | class TestThings(unittest.TestCase):
77 |
78 | def test_the_answer(self):
79 |
80 | self.assertEqual(42, 42)
81 |
82 | def test_is_precisely_correct_version(self):
83 |
84 | toxenvname = 'TOX_%s' % os.environ['TOX_ENV_NAME'].upper().strip()
85 | expected_string = os.environ[toxenvname].strip(' "\'')
86 | print('\n\nTOX ENV NAME: %s' % toxenvname)
87 | if platform.python_implementation() == 'PyPy':
88 | actual_list = [str(_).strip() for _ in sys.pypy_version_info[:3]]
89 | expected_string = expected_string.split('-')[1].strip(' "\'')
90 | print('\nExpected version for this tox env: PyPy %s'
91 | % expected_string)
92 | print('Actual version for this tox env: PyPy %s'
93 | % '.'.join(actual_list))
94 | else:
95 | print('\nExpected version for this tox env: Python %s'
96 | % expected_string)
97 | print('Actual version for this tox env: Python %s'
98 | % platform.python_version())
99 | actual_list = list(platform.python_version_tuple())
100 | expected_list = expected_string.split('.')
101 |
102 | print('\n\nPYTHON VERSION (verbose)')
103 | print('*************************')
104 | print(sys.version)
105 | print('\n')
106 | self.assertEqual(actual_list, expected_list)
107 |
108 | def test_what_python(self):
109 |
110 | print('\nwhich python')
111 | subprocess.call('which python', stderr=subprocess.STDOUT, shell=True)
112 | print('\ntype python')
113 | subprocess.call('type python', stderr=subprocess.STDOUT, shell=True)
114 | print('\nwhereis python')
115 | subprocess.call('whereis python', stderr=subprocess.STDOUT, shell=True)
116 | print('\n')
117 |
118 |
119 | if __name__ == '__main__':
120 |
121 | unittest.main(verbosity=3)
122 |
--------------------------------------------------------------------------------
/tox_pyenv.py:
--------------------------------------------------------------------------------
1 | """tox-pyenv
2 |
3 | Plugin for the tox_get_python_executable using tox's plugin system:
4 |
5 | https://testrun.org/tox/latest/plugins.html#tox.hookspecs.tox_get_python_executable
6 |
7 | Modified to instead use `pyenv which` to locate the
8 | appropriate python executable. This takes the place
9 | of the standard behavior in tox. The built-in default
10 | for the tox_get_python_exeucutable function
11 | is the following (for sys.platform != 'win32'):
12 |
13 | @hookimpl
14 | def tox_get_python_executable(envconfig):
15 | return py.path.local.sysfind(envconfig.basepython)
16 |
17 | which uses the 'py' package's sysfind():
18 |
19 | https://pylib.readthedocs.org/en/latest/path.html#py._path.local.LocalPath.sysfind
20 |
21 | If `pyenv`'s shims are not at the very front of your path,
22 | sysfind might lookup the global system version of python
23 | instead of preferring a version specified by using `pyenv local`
24 | or `pyenv global`. This plugin changes the way tox finds
25 | your python executable to exclusively use `pyenv which`.
26 |
27 | https://github.com/yyuu/pyenv/blob/master/COMMANDS.md#pyenv-which
28 |
29 | """
30 |
31 | # __about__
32 | __title__ = 'tox-pyenv'
33 | __summary__ = ('tox plugin that makes tox use `pyenv which` '
34 | 'to find python executables')
35 | __url__ = 'https://github.com/samstav/tox-pyenv'
36 | __version__ = '1.1.0'
37 | __author__ = 'Sam Stavinoha'
38 | __email__ = 'smlstvnh@gmail.com'
39 | __keywords__ = ['tox', 'pyenv', 'python']
40 | __license__ = 'Apache License, Version 2.0'
41 | # __about__
42 |
43 |
44 | import logging
45 | import subprocess
46 |
47 | import py
48 | from tox import hookimpl as tox_hookimpl
49 |
50 | LOG = logging.getLogger(__name__)
51 |
52 |
53 | class ToxPyenvException(Exception):
54 |
55 | """Base class for exceptions from this plugin."""
56 |
57 |
58 | class PyenvMissing(ToxPyenvException, RuntimeError):
59 |
60 | """The pyenv program is not installed."""
61 |
62 |
63 | class PyenvWhichFailed(ToxPyenvException):
64 |
65 | """Calling `pyenv which` failed."""
66 |
67 |
68 | @tox_hookimpl
69 | def tox_get_python_executable(envconfig):
70 | """Return a python executable for the given python base name.
71 |
72 | The first plugin/hook which returns an executable path will determine it.
73 |
74 | ``envconfig`` is the testenv configuration which contains
75 | per-testenv configuration, notably the ``.envname`` and ``.basepython``
76 | setting.
77 | """
78 | try:
79 | # pylint: disable=no-member
80 | pyenv = (getattr(py.path.local.sysfind('pyenv'), 'strpath', 'pyenv')
81 | or 'pyenv')
82 | cmd = [pyenv, 'which', envconfig.basepython]
83 | pipe = subprocess.Popen(
84 | cmd,
85 | stdout=subprocess.PIPE,
86 | stderr=subprocess.PIPE,
87 | universal_newlines=True
88 | )
89 | out, err = pipe.communicate()
90 | except OSError:
91 | err = '\'pyenv\': command not found'
92 | LOG.warning(
93 | "pyenv doesn't seem to be installed, you probably "
94 | "don't want this plugin installed either."
95 | )
96 | else:
97 | if pipe.poll() == 0:
98 | return out.strip()
99 | else:
100 | if not envconfig.tox_pyenv_fallback:
101 | raise PyenvWhichFailed(err)
102 | LOG.debug("`%s` failed thru tox-pyenv plugin, falling back. "
103 | "STDERR: \"%s\" | To disable this behavior, set "
104 | "tox_pyenv_fallback=False in your tox.ini or use "
105 | " --tox-pyenv-no-fallback on the command line.",
106 | ' '.join([str(x) for x in cmd]), err)
107 |
108 |
109 | def _setup_no_fallback(parser):
110 | """Add the option, --tox-pyenv-no-fallback.
111 |
112 | If this option is set, do not allow fallback to tox's built-in
113 | strategy for looking up python executables if the call to `pyenv which`
114 | by this plugin fails. This will allow the error to raise instead
115 | of falling back to tox's default behavior.
116 | """
117 |
118 | cli_dest = 'tox_pyenv_fallback'
119 | halp = ('If `pyenv which {basepython}` exits non-zero when looking '
120 | 'up the python executable, do not allow fallback to tox\'s '
121 | 'built-in default logic.')
122 | # Add a command-line option.
123 | tox_pyenv_group = parser.argparser.add_argument_group(
124 | title='{0} plugin options'.format(__title__),
125 | )
126 | tox_pyenv_group.add_argument(
127 | '--tox-pyenv-no-fallback', '-F',
128 | dest=cli_dest,
129 | default=True,
130 | action='store_false',
131 | help=halp
132 | )
133 |
134 | def _pyenv_fallback(testenv_config, value):
135 | cli_says = getattr(testenv_config.config.option, cli_dest)
136 | return cli_says or value
137 |
138 | # Add an equivalent tox.ini [testenv] section option.
139 | parser.add_testenv_attribute(
140 | name=cli_dest,
141 | type="bool",
142 | postprocess=_pyenv_fallback,
143 | default=False,
144 | help=('If `pyenv which {basepython}` exits non-zero when looking '
145 | 'up the python executable, allow fallback to tox\'s '
146 | 'built-in default logic.'),
147 | )
148 |
149 |
150 | @tox_hookimpl
151 | def tox_addoption(parser):
152 | """Add command line option to the argparse-style parser object."""
153 | _setup_no_fallback(parser)
154 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------