Skip to content

Commit

Permalink
tox 4 - first version
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Aug 22, 2019
1 parent 31b93fa commit d35a8d7
Show file tree
Hide file tree
Showing 181 changed files with 5,230 additions and 14,221 deletions.
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: 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
24 changes: 11 additions & 13 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,34 @@ 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`)
32 changes: 0 additions & 32 deletions src/tox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
"""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
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

0 comments on commit d35a8d7

Please sign in to comment.