Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 13, 2019
2 parents 7060ec2 + 9314eb4 commit f5f5d35
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 35 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
7 changes: 3 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[flake8]
max-line-length = 88
ignore =
# Allow tabs for indentation
W191
# Workaround for https://github.com/PyCQA/pycodestyle/issues/836
E117
# W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513
W503
# W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545
W504
# Black creates whitespace before colon
E203
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.9b0
hooks:
- id: black
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist: xenial
sudo: false
language: python

python:
Expand All @@ -14,11 +13,6 @@ jobs:
if: tag IS present
python: *latest_py3
before_script: skip
env:
- TWINE_USERNAME=jaraco
# TWINE_PASSWORD
- secure: n8qS4Tr+fQV89M4jtpdVG/eIb3Rcg9gmqGMDwn1C+OkNjr4MKZ2jJTO+bSecKz1k3XCoBaclJgAngm+2NxwgjJTWA+M+tOr9c5bAnu+5nSf+2izJULi7TSDyDHAob3YVtVZRbEOp5RgiRBvjLe5q0ZusZa+cA+61mlqJ1IdOoWGc6oQC2Q/dM7Zb6db7PXeUegb3Vs6wn0UrUEXxSXCePatNMeq1RkvVShoj1VzC2+jWBDI0NEFB8DxnfPgByxi/kVAjxVMmrKWZKahZ9RTUtmdIP2NvzF4/MJzVIXiwAOF9fivE1Yw5dMtRTEpuUp/SnIqwuNo+GON4vNNNBWEwG+CmUPKuPzi9m/z4ZcpzUA7c0RcSdiMjnUFQ7CzzNLt8LCNIPzbR3YMi6TCi0v4rs3uzhDknGbFEB1yR1i8yA7ICQPjX4Us6AHnBIBGfnC2p3JUBBKp/Hdkoo8+qwjGrdjUYAl1zhyoR29Ot4DuA+Bi+KytEakOugDyV/R/rqmbqy6HdwZRJnIt7cJK05AvedBqsMhgBwZ4xf1zFRqKGW1XoFMAEeoRxtn1lhKgpZp8lA/T9sZVymyUH+AQj/oIDAcH00vOYUvYUajL9rEet2WPdBwqhD3YwWxJQGOTxGeI/I/G4PvmgeEnw2HK4Q8EWmZYJu7XwiRn8zdQEeBr4Lvo=
- TOX_TESTENV_PASSENV="TWINE_USERNAME TWINE_PASSWORD"
script: tox -e release

cache: pip
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
.. image:: https://img.shields.io/travis/jaraco/jaraco.collections/master.svg
:target: https://travis-ci.org/jaraco/jaraco.collections

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

.. .. image:: https://img.shields.io/appveyor/ci/jaraco/skeleton/master.svg
.. :target: https://ci.appveyor.com/project/jaraco/skeleton/branch/master
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
26 changes: 16 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

extensions = ["sphinx.ext.autodoc", "jaraco.packaging.sphinx", "rst.linker"]
extensions = [
'sphinx.ext.autodoc',
'jaraco.packaging.sphinx',
'rst.linker',
]

master_doc = "index"

link_files = {
"../CHANGES.rst": dict(
using=dict(GH="https://github.com"),
'../CHANGES.rst': dict(
using=dict(
GH='https://github.com',
),
replace=[
dict(
pattern=r"(Issue #|\B#)(?P<issue>\d+)",
url="{package_url}/issues/{issue}",
pattern=r'(Issue #|\B#)(?P<issue>\d+)',
url='{package_url}/issues/{issue}',
),
dict(
pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n',
with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
),
dict(
pattern=r"PEP[- ](?P<pep_number>\d+)",
url="https://www.python.org/dev/peps/pep-{pep_number:0>4}/",
pattern=r'PEP[- ](?P<pep_number>\d+)',
url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
),
],
)
),
}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = ["setuptools>=34.4", "wheel", "setuptools_scm>=1.15"]
build-backend = "setuptools.build_meta"

[tool.black]
skip-string-normalization = true
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules --flake8
addopts=--doctest-modules --flake8 --black --cov
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
filterwarnings=
ignore:Possible nested set::pycodestyle:113
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ testing =
pytest >= 3.5, !=3.7.3
pytest-checkdocs
pytest-flake8
pytest-black-multipy
pytest-cov

# local

Expand Down
29 changes: 19 additions & 10 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 @@ -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,6 +112,14 @@ 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`.
Expand All @@ -126,3 +129,9 @@ In addition to building the sphinx docs scaffolded in `docs/`, the docs build a
## 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
```
17 changes: 14 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[tox]
envlist = python
minversion = 2.4
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
tox-venv


[testenv]
deps =
setuptools>=31.0.1
pip_version = pip
commands =
pytest {posargs}
usedevelop = True
Expand All @@ -22,9 +30,12 @@ commands =
skip_install = True
deps =
pep517>=0.5
# workaround for https://github.com/pypa/twine/issues/423
git+https://github.com/pypa/twine
twine>=1.13
path.py
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 f5f5d35

Please sign in to comment.