Skip to content

Commit

Permalink
Merge branch 'master' into arm
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhdev committed Jan 28, 2020
2 parents 22b943a + 54d57d7 commit 7c11eac
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 83 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
docs:
name: tox -e docs
name: nox -s docs
runs-on: ubuntu-latest

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install --upgrade nox
- name: Build documentation
run: python -m tox -e docs
run: python -m nox -s docs
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
lint:
name: tox -e lint
name: nox -s lint
runs-on: ubuntu-latest

steps:
Expand All @@ -24,10 +24,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install --upgrade nox
- name: Run `tox -e lint`
run: python -m tox -e lint
- name: Run `nox -s lint`
run: python -m nox -s lint

build:
name: Build sdist and wheel
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.egg
*.py[co]

.tox/
.[nt]ox/
.cache/
.coverage
.idea
Expand Down
25 changes: 13 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,30 @@ python: 3.8
matrix:
include:
- python: 2.7
env: TOXENV=py27
env: NOXSESSION=tests-2.7
- python: pypy
env: TOXENV=pypy
env: NOXSESSION=tests-pypy
- python: pypy3
env: TOXENV=pypy3
env: NOXSESSION=tests-pypy3
- python: 3.4
env: TOXENV=py34
env: NOXSESSION=tests-3.4
- python: 3.5
env: TOXENV=py35
env: NOXSESSION=tests-3.5
- python: 3.6
env: TOXENV=py36
env: NOXSESSION=tests-3.6
- python: 3.7
env: TOXENV=py37
env: NOXSESSION=tests-3.7
- python: 3.8
env: TOXENV=py38
- env: TOXENV=lint
- env: TOXENV=docs
env: NOXSESSION=tests-3.8
- env: NOXSESSION=lint
- env: NOXSESSION=docs

install:
- pip install tox
- pyenv global 3.7.1
- python3.7 -m pip install nox

script:
- tox
- python3.7 -m nox

notifications:
irc:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
---------

*unreleased*
~~~~~~~~~~~~

No changes yet.

20.1 - 2020-01-24
~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ include LICENSE LICENSE.APACHE LICENSE.BSD
include .coveragerc
include .flake8
include .pre-commit-config.yaml
include tox.ini

recursive-include docs *
recursive-include tests *.py
recursive-include tests hello-world-*

exclude noxfile.py
exclude .travis.yml
exclude dev-requirements.txt
exclude tests/build-hello-world.sh
Expand Down
45 changes: 27 additions & 18 deletions docs/development/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Getting started

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

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

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

.. code-block:: console
$ tox
$ nox -s tests
...
py27: commands succeeded
ERROR: pypy: InterpreterNotFound: pypy
ERROR: py34: InterpreterNotFound: python3.4
ERROR: py35: InterpreterNotFound: python3.5
py36: commands succeeded
ERROR: py37: InterpreterNotFound: python3.7
docs: commands succeeded
pep8: commands succeeded
nox > Ran multiple sessions:
nox > * tests-2.7: success
nox > * tests-3.4: skipped
nox > * tests-3.5: success
nox > * tests-3.6: success
nox > * tests-3.7: success
nox > * tests-3.8: success
nox > * tests-pypy: skipped
nox > * tests-pypy3: skipped
You may not have all the required Python versions installed, in which case you
will see one or more ``InterpreterNotFound`` errors.

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

If you wish to run the linting rules, you may use `pre-commit`_ or run
``nox -s lint``.

.. code-block:: console
$ nox -s lint
...
nox > Session lint was successful.
Building documentation
~~~~~~~~~~~~~~~~~~~~~~

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

Use `tox`_ to build the documentation. For example:
Use `nox`_ to build the documentation. For example:

.. code-block:: console
$ tox -e docs
$ nox -s docs
...
docs: commands succeeded
congratulations :)
nox > Session docs was successful.
The HTML documentation index can now be found at
``docs/_build/html/index.html``.

.. _`pytest`: https://pypi.org/project/pytest/
.. _`tox`: https://pypi.org/project/tox/
.. _`nox`: https://pypi.org/project/nox/
.. _`virtualenv`: https://pypi.org/project/virtualenv/
.. _`pip`: https://pypi.org/project/pip/
.. _`sphinx`: https://pypi.org/project/Sphinx/
Expand Down
2 changes: 1 addition & 1 deletion docs/development/submitting-patches.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Code
----

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

`Write comments as complete sentences.`_
Expand Down
61 changes: 61 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# mypy: disallow-untyped-defs=False, disallow-untyped-calls=False

import glob
import shutil

import nox

nox.options.sessions = ["lint"]
nox.options.reuse_existing_virtualenvs = True


@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "pypy", "pypy3"])
def tests(session):
def coverage(*args):
session.run("python", "-m", "coverage", *args)

session.install("coverage<5.0.0", "pretend", "pytest", "pip>=9.0.2")

if "pypy" not in session.python:
coverage("run", "--source", "packaging/", "-m", "pytest", "--strict")
coverage("report", "-m", "--fail-under", "100")
else:
# Don't do coverage tracking for PyPy, since it's SLOW.
session.run("pytest", "--capture=no", "--strict", *session.posargs)


@nox.session(python="3.8")
def lint(session):
# Run the linters (via pre-commit)
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files")

# Check the distribution
session.install("setuptools", "readme_renderer", "twine", "wheel")
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
session.run("twine", "check", *glob.glob("dist/*"))


@nox.session(python="3.8")
def docs(session):
shutil.rmtree("docs/_build", ignore_errors=True)
session.install("sphinx", "sphinx-rtd-theme")

variants = [
# (builder, dest)
("html", "html"),
("latex", "latex"),
("doctest", "html"),
]

for builder, dest in variants:
session.run(
"sphinx-build",
"-W",
"-b",
builder,
"-d",
"docs/_build/doctrees/" + dest,
"docs", # source directory
"docs/_build/" + dest, # output directory
)
43 changes: 0 additions & 43 deletions tox.ini

This file was deleted.

0 comments on commit 7c11eac

Please sign in to comment.