Skip to content

Commit 7c11eac

Browse files
committed
Merge branch 'master' into arm
2 parents 22b943a + 54d57d7 commit 7c11eac

10 files changed

+116
-83
lines changed

.github/workflows/docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
docs:
13-
name: tox -e docs
13+
name: nox -s docs
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install --upgrade tox
27+
python -m pip install --upgrade nox
2828
2929
- name: Build documentation
30-
run: python -m tox -e docs
30+
run: python -m nox -s docs

.github/workflows/lint.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
lint:
13-
name: tox -e lint
13+
name: nox -s lint
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -24,10 +24,10 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install --upgrade tox
27+
python -m pip install --upgrade nox
2828
29-
- name: Run `tox -e lint`
30-
run: python -m tox -e lint
29+
- name: Run `nox -s lint`
30+
run: python -m nox -s lint
3131

3232
build:
3333
name: Build sdist and wheel

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*.egg
33
*.py[co]
44

5-
.tox/
5+
.[nt]ox/
66
.cache/
77
.coverage
88
.idea

.travis.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@ python: 3.8
55
matrix:
66
include:
77
- python: 2.7
8-
env: TOXENV=py27
8+
env: NOXSESSION=tests-2.7
99
- python: pypy
10-
env: TOXENV=pypy
10+
env: NOXSESSION=tests-pypy
1111
- python: pypy3
12-
env: TOXENV=pypy3
12+
env: NOXSESSION=tests-pypy3
1313
- python: 3.4
14-
env: TOXENV=py34
14+
env: NOXSESSION=tests-3.4
1515
- python: 3.5
16-
env: TOXENV=py35
16+
env: NOXSESSION=tests-3.5
1717
- python: 3.6
18-
env: TOXENV=py36
18+
env: NOXSESSION=tests-3.6
1919
- python: 3.7
20-
env: TOXENV=py37
20+
env: NOXSESSION=tests-3.7
2121
- python: 3.8
22-
env: TOXENV=py38
23-
- env: TOXENV=lint
24-
- env: TOXENV=docs
22+
env: NOXSESSION=tests-3.8
23+
- env: NOXSESSION=lint
24+
- env: NOXSESSION=docs
2525

2626
install:
27-
- pip install tox
27+
- pyenv global 3.7.1
28+
- python3.7 -m pip install nox
2829

2930
script:
30-
- tox
31+
- python3.7 -m nox
3132

3233
notifications:
3334
irc:

CHANGELOG.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
---------
33

4+
*unreleased*
5+
~~~~~~~~~~~~
6+
7+
No changes yet.
8+
49
20.1 - 2020-01-24
510
~~~~~~~~~~~~~~~~~~~
611

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ include LICENSE LICENSE.APACHE LICENSE.BSD
44
include .coveragerc
55
include .flake8
66
include .pre-commit-config.yaml
7-
include tox.ini
87

98
recursive-include docs *
109
recursive-include tests *.py
1110
recursive-include tests hello-world-*
1211

12+
exclude noxfile.py
1313
exclude .travis.yml
1414
exclude dev-requirements.txt
1515
exclude tests/build-hello-world.sh

docs/development/getting-started.rst

+27-18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Getting started
33

44
Working on packaging requires the installation of a small number of
55
development dependencies. To see what dependencies are required to
6-
run the tests manually, please look at the ``tox.ini`` file.
6+
run the tests manually, please look at the ``noxfile.py`` file.
77

88
Running tests
99
~~~~~~~~~~~~~
@@ -16,54 +16,63 @@ automatically, so all you have to do is:
1616
1717
$ python -m pytest
1818
...
19-
62746 passed in 220.43 seconds
19+
29204 passed, 4 skipped, 1 xfailed in 83.98 seconds
2020
2121
This runs the tests with the default Python interpreter. This also allows
2222
you to run select tests instead of the entire test suite.
2323

2424
You can also verify that the tests pass on other supported Python interpreters.
25-
For this we use `tox`_, which will automatically create a `virtualenv`_ for
25+
For this we use `nox`_, which will automatically create a `virtualenv`_ for
2626
each supported Python version and run the tests. For example:
2727

2828
.. code-block:: console
2929
30-
$ tox
30+
$ nox -s tests
3131
...
32-
py27: commands succeeded
33-
ERROR: pypy: InterpreterNotFound: pypy
34-
ERROR: py34: InterpreterNotFound: python3.4
35-
ERROR: py35: InterpreterNotFound: python3.5
36-
py36: commands succeeded
37-
ERROR: py37: InterpreterNotFound: python3.7
38-
docs: commands succeeded
39-
pep8: commands succeeded
32+
nox > Ran multiple sessions:
33+
nox > * tests-2.7: success
34+
nox > * tests-3.4: skipped
35+
nox > * tests-3.5: success
36+
nox > * tests-3.6: success
37+
nox > * tests-3.7: success
38+
nox > * tests-3.8: success
39+
nox > * tests-pypy: skipped
40+
nox > * tests-pypy3: skipped
4041
4142
You may not have all the required Python versions installed, in which case you
4243
will see one or more ``InterpreterNotFound`` errors.
4344

44-
If you wish to run just the linting rules, you may use `pre-commit`_.
45+
Running linters
46+
~~~~~~~~~~~~~~~
4547

48+
If you wish to run the linting rules, you may use `pre-commit`_ or run
49+
``nox -s lint``.
50+
51+
.. code-block:: console
52+
53+
$ nox -s lint
54+
...
55+
nox > Session lint was successful.
4656
4757
Building documentation
4858
~~~~~~~~~~~~~~~~~~~~~~
4959

5060
packaging documentation is stored in the ``docs/`` directory. It is
5161
written in `reStructured Text`_ and rendered using `Sphinx`_.
5262

53-
Use `tox`_ to build the documentation. For example:
63+
Use `nox`_ to build the documentation. For example:
5464

5565
.. code-block:: console
5666
57-
$ tox -e docs
67+
$ nox -s docs
5868
...
59-
docs: commands succeeded
60-
congratulations :)
69+
nox > Session docs was successful.
6170
6271
The HTML documentation index can now be found at
6372
``docs/_build/html/index.html``.
6473

6574
.. _`pytest`: https://pypi.org/project/pytest/
66-
.. _`tox`: https://pypi.org/project/tox/
75+
.. _`nox`: https://pypi.org/project/nox/
6776
.. _`virtualenv`: https://pypi.org/project/virtualenv/
6877
.. _`pip`: https://pypi.org/project/pip/
6978
.. _`sphinx`: https://pypi.org/project/Sphinx/

docs/development/submitting-patches.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Code
1919
----
2020

2121
This project's source is auto-formatted with |black|. You can check if your
22-
code meets our requirements by running our linters against it with ``tox -e
22+
code meets our requirements by running our linters against it with ``nox -s
2323
lint`` or ``pre-commit run --all-files``.
2424

2525
`Write comments as complete sentences.`_

noxfile.py

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# mypy: disallow-untyped-defs=False, disallow-untyped-calls=False
2+
3+
import glob
4+
import shutil
5+
6+
import nox
7+
8+
nox.options.sessions = ["lint"]
9+
nox.options.reuse_existing_virtualenvs = True
10+
11+
12+
@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "pypy", "pypy3"])
13+
def tests(session):
14+
def coverage(*args):
15+
session.run("python", "-m", "coverage", *args)
16+
17+
session.install("coverage<5.0.0", "pretend", "pytest", "pip>=9.0.2")
18+
19+
if "pypy" not in session.python:
20+
coverage("run", "--source", "packaging/", "-m", "pytest", "--strict")
21+
coverage("report", "-m", "--fail-under", "100")
22+
else:
23+
# Don't do coverage tracking for PyPy, since it's SLOW.
24+
session.run("pytest", "--capture=no", "--strict", *session.posargs)
25+
26+
27+
@nox.session(python="3.8")
28+
def lint(session):
29+
# Run the linters (via pre-commit)
30+
session.install("pre-commit")
31+
session.run("pre-commit", "run", "--all-files")
32+
33+
# Check the distribution
34+
session.install("setuptools", "readme_renderer", "twine", "wheel")
35+
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
36+
session.run("twine", "check", *glob.glob("dist/*"))
37+
38+
39+
@nox.session(python="3.8")
40+
def docs(session):
41+
shutil.rmtree("docs/_build", ignore_errors=True)
42+
session.install("sphinx", "sphinx-rtd-theme")
43+
44+
variants = [
45+
# (builder, dest)
46+
("html", "html"),
47+
("latex", "latex"),
48+
("doctest", "html"),
49+
]
50+
51+
for builder, dest in variants:
52+
session.run(
53+
"sphinx-build",
54+
"-W",
55+
"-b",
56+
builder,
57+
"-d",
58+
"docs/_build/doctrees/" + dest,
59+
"docs", # source directory
60+
"docs/_build/" + dest, # output directory
61+
)

tox.ini

-43
This file was deleted.

0 commit comments

Comments
 (0)