Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - tox 4 #1400

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ __pycache__
credentials.json

pip-wheel-metadata
.DS_Store
3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
include CHANGELOG.rst
include README.rst
include CONTRIBUTORS
include LICENSE
include setup.py
include tox.ini
graft docs
graft tests

global-exclude __pycache__
global-exclude *.py[cod]
8 changes: 1 addition & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,17 @@ jobs:
image: [linux]
py37:
image: [linux, windows, macOs]
py27:
image: [linux, windows, macOs]
pypy:
image: [linux]
pypy3:
image: [linux]
py36:
image: [linux, windows, macOs]
py35:
image: [linux, windows, macOs]
py34:
image: [linux, windows, macOs]
dev: null
package_description: null
coverage:
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
for_envs: [py37, py36, py35, py34, py27]
for_envs: [py38, py37, py36, py35]

- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
- template: publish-pypi.yml@tox
Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def generate_draft_news():

generate_draft_news()

project = u"tox"
project = "tox"
_full_version = tox.__version__
release = _full_version.split("+", 1)[0]
version = ".".join(release.split(".")[:2])

author = "holger krekel and others"
year = date.today().year
copyright = u"2010-{}, {}".format(year, author)
copyright = "2010-{}, {}".format(year, author)

master_doc = "index"
source_suffix = ".rst"
Expand Down Expand Up @@ -82,8 +82,8 @@ def generate_draft_news():
html_show_sourcelink = False
html_static_path = ["_static"]
htmlhelp_basename = "{}doc".format(project)
latex_documents = [("index", "tox.tex", u"{} Documentation".format(project), author, "manual")]
man_pages = [("index", project, u"{} Documentation".format(project), [author], 1)]
latex_documents = [("index", "tox.tex", "{} Documentation".format(project), author, "manual")]
man_pages = [("index", project, "{} Documentation".format(project), [author], 1)]
epub_title = project
epub_author = author
epub_publisher = author
Expand Down
3 changes: 0 additions & 3 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,4 @@ Other Rules and notes
cli
===

.. autoprogram:: tox.cli:cli
:prog: tox

.. include:: links.rst
15 changes: 2 additions & 13 deletions docs/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,11 @@ You can and publish it like:
Hook specifications and related API
-----------------------------------

.. automodule:: tox.hookspecs
.. automodule:: tox.plugin.spec
:members:

.. autoclass:: tox.config.Parser()
.. autoclass:: tox.config.sets.ConfigSet
:members:

.. autoclass:: tox.config.Config()
:members:

.. autoclass:: tox.config.TestenvConfig()
:members:

.. autoclass:: tox.venv.VirtualEnv()
:members:

.. autoclass:: tox.session.Session()
:members:

.. include:: links.rst
29 changes: 13 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
[metadata]
name = tox
description = tox is a generic virtualenv management and test command line tool
long_description = file: README.md
long_description_content_type = text/markdown
keywords = virtual, environments, isolated, testing
maintainer = Bernat Gabor, Oliver Bestwalter, Anthony Asottile
author = Holger Krekel, Oliver Bestwalter, Bernát Gábor and others
author = Holger Krekel, Oliver Bestwalter, Bernat Gabor and others
maintainer-email = tox-dev@python.org
url = http://tox.readthedocs.org
project_urls =
Expand Down Expand Up @@ -36,41 +35,39 @@ classifiers =

[options]
packages = find:
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
python_requires = >=3.5
install_requires =
importlib-metadata >= 0.12, <1;python_version<"3.8"
packaging >= 14
pluggy >= 0.12.0, <1
py >= 1.4.17, <2
six >= 1.0.0, <2
virtualenv >= 14.0.0
toml >=0.9.4
filelock >= 3.0.0, <4
appdirs >= 1.4.3, <2
virtualenv
colorama
toml

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
tox=tox:cmdline
tox-quickstart=tox._quickstart:main
tox = tox.run:run

[options.extras_require]
testing =
freezegun >= 0.3.11, <1
pathlib2 >= 2.3.3, <3
pytest >= 4.0.0, <6
pytest-cov >= 2.5.1, <3
pytest-mock >= 1.10.0, <2
pytest-xdist >= 1.22.2, <2
pytest-randomly >= 1.2.3, <2
psutil >= 5.6.1, < 6; python_version != "3.4"
flaky >= 3.4.0, < 4
pytest-timeout
pytest-xdist
psutil
setuptools >= 41.0.0
wheel >= 0.30.0
docs =
sphinx >= 2.0.0, < 3
towncrier >= 18.5.0
pygments-github-lexers >= 0.0.5
sphinxcontrib-autoprogram >= 0.1.5
importlib-metadata >= 0.12, <1;python_version<"3.8"

[bdist_wheel]
universal = 1
101 changes: 101 additions & 0 deletions src/new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# External facing
0. ``Python 3.5+`` only.
1. Lazy configuration - everything is materialized only when needed (don't ever generate data that will not be used - general speed improvement)
2. built-in wheel build support - no longer generates sdist only
3. library dependency changes are now detected (no longer need to recreate tox-env when adding a new dependency to your library) - use PEP-517 meta data generation to acquire these
4. CLI arguments rewrite - all defaults now are override-able either via global ini, or env var
5. allow overriding all configuration values from the cli
6. tox now supports sub-commands - still defaults to run sequential the envs (we plan to add additional commands later - e.g. configuration validation):
- the list envs has migrated to the `list` sub-command from -a (`l` shortcut)
- the show config has migrated to the `config` sub-command form `--showconfig` (`c` shortcut)
- the run parallel has migrated to `run-parallel` sub-command form `-p` (`p` shortcut)
- the run sequential has migrated to `run` sub-command form non other commands (`r` shortcut)
7. while executing subprocess calls the standard error no longer gets forwarded to the standard output but correctly to the standard error (previously this was only true for
non captured commands)
8. ``basepython`` is now a list, the first successfully detected python will be used to generate python environment

# Internal
0. ``Python 3.5+`` only with type annotated code.
1. Separate core configuration concepts from the ini system (to allow introduction of new configuration)
2. so long `py` my good old friend, use `pathlib` always
3. Introduce the executor concept - replaces action, generalize to avoid ease of replacement with
4. Generalize tox environment concept to make it python agnostic
5. Separate the packaging environments versus run environments
6. Package environments are tied directly to run environments (multiple run environments may share the same packaging environment)
7. Use the logging framework to log - drop our custom reporter - default log level is `INFO`
8. Python discovery delegated to virtualenv - due to exposing that in virtualenv is WIP, and dependent on our release we vendor it for now
9. rewrite the internal cache log (log more, structured, phased)

```json
{
"ToxEnv": {
"name": "py37",
"type": "VirtualEnvRunner"
},
"Python": {
"version_info": [
3,
7,
4,
"final",
0
],
"executable": "/Users/bgabor8/git/github/tox/.tox/dev/bin/python"
},
"PythonRun": {
"deps": [
"pip==19.2.1"
],
"package_deps": [
"packaging>=14",
"pluggy<1,>=0.12.0",
"appdirs<2,>=1.4.3",
"virtualenv",
"importlib-metadata<1,>=0.12; python_version < \"3.8\"",
"freezegun<1,>=0.3.11",
"pytest<6,>=4.0.0",
"pytest-cov<3,>=2.5.1",
"pytest-mock<2,>=1.10.0"
]
}
}⏎
{
"ToxEnv": {
"name": ".package",
"type": "Pep517VirtualEnvPackageWheel"
},
"Python": {
"version_info": [
3,
7,
4,
"final",
0
],
"executable": "/Users/bgabor8/git/github/tox/.tox/dev/bin/python"
},
"PythonPackage": {
"requires": [
"setuptools >= 40.0.4",
"setuptools_scm >= 2.0.0, <4",
"wheel >= 0.29.0"
],
"build-requires": []
}
}
```

# TODO
* index url support for python pip
* introduce the run log concept
* handle provisioning
* make it parallel safe (packaging + logs)
* Make sure we're config compliant with tox 3 (excluding deprecated features) - CLI compliant is best effort
* Allow plugins generating new tox-environments (this will probably require a in-memory config)
* Rewrite documentation (generate configuration from code)

## Validate rewrite
* provide a pre-commit env generator plugin
* provide a sphinx doc env generator plugin
* Provide a tox environment that uses Docker images instead of virtual environments (this will validate the internal refactor)
* migrate some popular tox plugins to the new system (`tox-travis` + `tox-pipenv` + `tox-conda` + `tox-pyenv` + `tox-current-env`)
31 changes: 1 addition & 30 deletions src/tox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
"""Everything made explicitly available via `__all__` can be considered as part of the tox API.

We will emit deprecation warnings for one minor release before making changes to these objects.

If objects are marked experimental they might change between minor versions.

To override/modify tox behaviour via plugins see `tox.hookspec` and its use with pluggy.
"""
import pluggy

from . import exception
from .constants import INFO, PIP, PYTHON
from .hookspecs import hookspec
from .version import __version__

__all__ = (
"__version__", # tox version
"cmdline", # run tox as part of another program/IDE (same behaviour as called standalone)
"hookimpl", # Hook implementation marker to be imported by plugins
"exception", # tox specific exceptions
# EXPERIMENTAL CONSTANTS API
"PYTHON",
"INFO",
"PIP",
# DEPRECATED - will be removed from API in tox 4
"hookspec",
)

hookimpl = pluggy.HookimplMarker("tox")

# NOTE: must come last due to circular import
from .session import cmdline # isort:skip
__all__ = ("__version__",)
4 changes: 2 additions & 2 deletions src/tox/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tox
from tox.run import run

if __name__ == "__main__":
tox.cmdline()
run()
Loading