Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 15, 2019
2 parents d327573 + 266a9c1 commit 3609c52
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 41 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit = .tox/*

[report]
show_missing = True
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.9b0
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ dist: xenial
language: python

python:
- 2.7
- 3.6
- &latest_py3 3.7
- &latest_py3 3.8

jobs:
fast_finish: true
Expand All @@ -13,11 +12,6 @@ jobs:
if: tag IS present
python: *latest_py3
before_script: skip
env:
- TWINE_USERNAME=jaraco
# TWINE_PASSWORD
- secure: LgWaTSefcY70T5A4I9uhrZ47sVLrz4rACZHkit+rvrItpfddOP+CZcq0LA26+JaRbzJVJK7qmrzm0zBh3Ptv9usUXOeujNUI8fhuys7KtJWZq2niilo41BNhTZFocDFjezAljXSa2q633nbQ2iHP0f+3RqsCKD6N0hl+C3Sgk2Zm45/95aMzHnktzxvo0U7VcKOpR+b9Sf/YM11KCyZLCu9zzUrrohQ3tCuSbxmIpzskWcf2+vM8ZIbG7ayqjkp8Ty2h/Xl1zSFKvWF1RcNoH69JjEpzK3VbAyTDbSYOlVMT/i6QozpTO9Lhbs3ug6OOQSNbiHxam/bB5JMcyulWIr3Wn22ThAQJdVBBbEgQGMZH7B1hgILvDC8LPNB683eCbalBksSNaLZZnyZPgvlygKBqCkZh6MYZlbXTmWw1FJsaWyfXijufHoZ/eCBRZl3SO/hJxLr7rYJtLb595O0Mi1bux9tY5w0ejbQSs1zoTBl9lK67DHBwpEqBZsotHKVNsFLO7VIoWEOsNL3ZfLNYtste6Kfw56xV7PxzBtSTIBSyhXxpWNfhVOrbFu1p2wgwjBtvBw0URVgRahzZbDSDFxTnbVgRz9HSA1QT0u3aVkqJ46WXo8O9Lkfto0Leqy2pgxEY+0L0Eejw4rp6vn+KJZo4MC+9KGlAmZGWMCTHA20=
- TOX_TESTENV_PASSENV="TWINE_USERNAME TWINE_PASSWORD"
script: tox -e release

cache: pip
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:target: https://travis-ci.org/jaraco/pip-run

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:target: https://github.com/psf/black
:alt: Code style: Black

.. image:: https://img.shields.io/appveyor/ci/jaraco/pip-run/master.svg
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ environment:

matrix:
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python38-x64"

install:
# symlink python from a directory with a space
Expand All @@ -18,7 +18,7 @@ cache:
- '%LOCALAPPDATA%\pip\Cache'

test_script:
- "python -m pip install tox tox-venv"
- "python -m pip install -U tox tox-venv virtualenv"
- "tox"

version: '{build}'
8 changes: 1 addition & 7 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules --flake8 --black
addopts=--doctest-modules --flake8 --black --cov
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
filterwarnings=
ignore:Possible nested set::pycodestyle:113
ignore:Using or importing the ABCs::flake8:410
# workaround for https://sourceforge.net/p/docutils/bugs/348/
ignore:'U' mode is deprecated::docutils.io
# workaround for https://gitlab.com/pycqa/flake8/issues/275
ignore:You passed a bytestring as `filenames`.::flake8
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3

[options]
packages = find:
include_package_data = true
py_modules = pip-run
python_requires = >=2.7
python_requires = >=3.6
install_requires = pip
setup_requires = setuptools_scm >= 1.15.0

[options.extras_require]
testing =
# upstream
pytest >= 3.5, !=3.7.3
pytest-checkdocs
pytest-checkdocs >= 1.2.3
pytest-flake8
pytest-black-multipy
pytest-cov

# local

Expand Down
33 changes: 21 additions & 12 deletions skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ The features/techniques employed by the skeleton include:
- setuptools declarative configuration using setup.cfg
- tox for running tests
- A README.rst as reStructuredText with some popular badges, but with readthedocs and appveyor badges commented out
- A CHANGES.rst file intended for publishing release notes about the project.
- A CHANGES.rst file intended for publishing release notes about the project
- Use of [black](https://black.readthedocs.io/en/stable/) for code formatting (disabled on unsupported Python 3.5 and earlier)

## Packaging Conventions

Expand Down Expand Up @@ -84,7 +85,7 @@ The skeleton assumes the developer has [tox](https://pypi.org/project/tox) insta

Other environments (invoked with `tox -e {name}`) supplied include:

- a `build-docs` environment to build the documentation
- a `docs` environment to build the documentation
- a `release` environment to publish the package to PyPI

A pytest.ini is included to define common options around running tests. In particular:
Expand All @@ -97,18 +98,12 @@ A pytest.ini is included to define common options around running tests. In parti

Relies a .flake8 file to correct some default behaviors:

- allow tabs for indentation (legacy for jaraco projects)
- disable mutually incompatible rules W503 and W504.
- disable mutually incompatible rules W503 and W504
- support for black format

## Continuous Integration

The project is pre-configured to run tests in [Travis-CI](https://travis-ci.org) (.travis.yml). Any new project must be enabled either through their web site or with the `travis enable` command. In addition to running tests, an additional deploy stage is configured to automatically release tagged commits. The username and password for PyPI must be configured for each project using the `travis` command and only after the travis project is created. As releases are cut with [twine](https://pypi.org/project/twine), the two values are supplied through the `TWINE_USERNAME` and `TWINE_PASSWORD`. To configure the latter as a secret, run the following command:

```
echo "TWINE_PASSWORD={password}" | travis encrypt
```

Or disable it in the CI definition and configure it through the web UI.
The project is pre-configured to run tests in [Travis-CI](https://travis-ci.org) (.travis.yml). Any new project must be enabled either through their web site or with the `travis enable` command.

Features include:
- test against Python 2 and 3
Expand All @@ -117,12 +112,26 @@ Features include:

Also provided is a minimal template for running under Appveyor (Windows).

### Continuous Deployments

In addition to running tests, an additional deploy stage is configured to automatically release tagged commits to PyPI using [API tokens](https://pypi.org/help/#apitoken). The release process expects an authorized token to be configured with Travis as the TWINE_PASSWORD environment variable. After the Travis project is created, configure the token through the web UI or with a command like the following (bash syntax):

```
TWINE_PASSWORD={token} travis env copy TWINE_PASSWORD
```

## Building Documentation

Documentation is automatically built by [Read the Docs](https://readthedocs.org) when the project is registered with it, by way of the .readthedocs.yml file. To test the docs build manually, a tox env may be invoked as `tox -e build-docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`.
Documentation is automatically built by [Read the Docs](https://readthedocs.org) when the project is registered with it, by way of the .readthedocs.yml file. To test the docs build manually, a tox env may be invoked as `tox -e docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`.

In addition to building the sphinx docs scaffolded in `docs/`, the docs build a `history.html` file that first injects release dates and hyperlinks into the CHANGES.rst before incorporating it as history in the docs.

## Cutting releases

By default, tagged commits are released through the continuous integration deploy stage.

Releases may also be cut manually by invoking the tox environment `release` with the PyPI token set as the TWINE_PASSWORD:

```
TWINE_PASSWORD={token} tox -e release
```
23 changes: 16 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,39 @@ envlist = python
minversion = 3.2
# https://github.com/jaraco/skeleton/issues/6
tox_pip_extensions_ext_venv_update = true
# Ensure that a late version of pip is used even on tox-venv.
requires =
tox-pip-version>=0.0.6
tox-venv


[testenv]
deps =
setuptools>=31.0.1
pip_version = pip
commands =
pytest {posargs}
usedevelop = True
extras = testing

[testenv:build-docs]
[testenv:docs]
extras =
docs
testing
docs
testing
changedir = docs
commands =
python -m sphinx . {toxinidir}/build/html
python -m sphinx . {toxinidir}/build/html

[testenv:release]
skip_install = True
deps =
pep517>=0.5
# workaround for https://github.com/pypa/twine/issues/423
git+https://github.com/pypa/twine
path.py
twine[keyring]>=1.13
path
passenv =
TWINE_PASSWORD
setenv =
TWINE_USERNAME = {env:TWINE_USERNAME:__token__}
commands =
python -c "import path; path.Path('dist').rmtree_p()"
python -m pep517.build .
Expand Down

0 comments on commit 3609c52

Please sign in to comment.