Migrate to pyproject config

master
Luke Murphy 3 years ago
parent 8a3a4f1b0b
commit fee2b1c8ba
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
  1. 2
      README.md
  2. 1
      {{cookiecutter.package}}/CHANGELOG.md
  3. 1
      {{cookiecutter.package}}/MANIFEST.in
  4. 12
      {{cookiecutter.package}}/README.md
  5. 4
      {{cookiecutter.package}}/mypy.ini
  6. 76
      {{cookiecutter.package}}/pyproject.toml
  7. 46
      {{cookiecutter.package}}/setup.cfg
  8. 3
      {{cookiecutter.package}}/setup.py
  9. 10
      {{cookiecutter.package}}/test/test_version.py
  10. 48
      {{cookiecutter.package}}/tox.ini
  11. 11
      {{cookiecutter.package}}/{{cookiecutter.package}}/__init__.py

@ -19,6 +19,8 @@ standardised and reliable.
## Usage
```sh
$ python -m pip install --user pipx
$ pipx install cookiecutter
$ cookiecutter https://git.autonomic.zone/decentral1se/pypkgtemplate.git
```

@ -0,0 +1 @@
# {{cookiecutter.package}} 0.1.0 (UNRELEASED)

@ -1 +0,0 @@
include LICENSE README.md CHANGELOG.md

@ -1,3 +1,15 @@
# {{cookiecutter.package}}
## {{cookiecutter.package_description}}
## Install
```sh
$ pip install {{ cookiecutter.package }}
```
## Example
```python
print("TODO")
```

@ -1,4 +0,0 @@
[mypy]
python_version = 3.8
platform = linux
ignore_missing_imports = True

@ -1,11 +1,75 @@
[build-system]
requires = [
"setuptools",
"setuptools-scm",
"wheel",
]
build-backend = "setuptools.build_meta"
requires = ["poetry>=1.0.9,<2.0"]
build-backend = "poetry.masonry.api"
[tool.poetry]
name = "{{cookiecutter.package}}"
version = "0.1.0"
description = "{{cookiecutter.package_description}}"
authors = ["{{cookiecutter.author}} <{{cookiecutter.author_email}}>"]
maintainers = ["{{cookiecutter.author}} <{{cookiecutter.author_email}}>"]
license = "GPLv3"
readme = "README.md"
repository = "{{cookiecutter.git_hosting_url}}"
keywords = []
[tool.poetry.dependencies]
python = "^3.6"
[tool.poetry.dev-dependencies]
black = "^19.10b0"
flake8 = "^3.8.3"
isort = "^5.0.2"
[tool.black]
line-length = 80
target-version = ["py38"]
include = '\.pyi?$'
[tool.isort]
include_trailing_comma = true
known_first_party = "{{cookiecutter.package}}"
known_third_party = "pytest"
line_length = 80
multi_line_output = 3
skip = ".tox"
[tool.tox]
legacy_tox_ini = """
[tox]
envlist =
{py36,py37,py38}
lint
sort
format
type
skip_missing_interpreters = True
isolated_build = True
[testenv]
deps =
pytest
pytest-cov
pytest-mock
commands = pytest test/ --cov={toxinidir}/{{cookiecutter.package}}/ --no-cov-on-fail {posargs}
[testenv:lint]
skipdist = True
deps = flake8
commands = flake8 {posargs:--max-line-length 80} {{cookiecutter.package}}/ test/
[testenv:sort]
skipdist = True
deps = isort
commands = isort {posargs:-c} {{cookiecutter.package}}/ test/
[testenv:format]
skipdist = True
deps = black
commands = black {posargs:--check} {{cookiecutter.package}}/ test/
[testenv:type]
skipdist = True
deps = mypy
commands = mypy {posargs:--ignore-missing-imports} {{cookiecutter.package}}/ test/
"""

@ -1,46 +0,0 @@
[tool:pytest]
testpaths = test
[flake8]
max-line-length = 80
[isort]
known_first_party = {{cookiecutter.package}}
known_third_party = pytest
line_length = 80
multi_line_output = 3
skip = .venv, .tox
include_trailing_comma = True
[metadata]
name = {{cookiecutter.package}}
author = {{cookiecutter.author}}
author_email = {{cookiecutter.author_email}}
maintainer = {{cookiecutter.author}}
maintainer_email = {{cookiecutter.author_email}}
url = {{cookiecutter.git_hosting_url}}
project_urls =
Source Code = {{cookiecutter.git_hosting_url}}
description = {{cookiecutter.package_description}}
long_description = file: README.md
license = GPLv3
license_file = LICENSE
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
[options]
use_scm_version = True
python_requires = >=3.6
setup_requires =
setuptools_scm
setuptools_scm_git_archive
package_dir =
= .
packages = find:
zip_safe = False
[options.packages.find]
where = .

@ -1,3 +0,0 @@
from setuptools import setup
setup(use_scm_version=True)

@ -1,10 +0,0 @@
"""Version test module."""
def test_version_fails_gracefully(mocker):
target = 'pkg_resources.get_distribution'
mocker.patch(target, side_effect=Exception())
from {{cookiecutter.package}}.__init__ import __version__
assert __version__ == 'unknown'

@ -1,48 +0,0 @@
[tox]
envlist =
{py36,py37,py38}
lint
sort
format
type
skip_missing_interpreters = True
isolated_build = True
[testenv]
deps =
pytest
pytest-cov
pytest-mock
commands = pytest test/ --cov={toxinidir}/{{cookiecutter.package}}/ --no-cov-on-fail {posargs}
[testenv:lint]
skipdist = True
deps = flake8
commands = flake8 {posargs} {{cookiecutter.package}}/ test/
[testenv:sort]
skipdist = True
deps = isort
commands = isort {posargs:-rc -c} -sp setup.cfg {{cookiecutter.package}}/ test/
[testenv:format]
skipdist = True
basepython = python3.8
deps = black
commands = black {posargs:--check} {{cookiecutter.package}}/ test/
[testenv:type]
basepython = python3.8
skipdist = True
deps = mypy
commands = mypy {{cookiecutter.package}}/ test/
[testenv:release]
deps = twine
commands =
rm -rf {toxworkdir}/dist
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_wheel
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_egg
twine upload {toxworkdir}/dist/*
whitelist_externals =
rm

@ -1,12 +1 @@
"""{{cookiecutter.package}} module."""
try:
import pkg_resources
except ImportError:
pass
try:
__version__ = pkg_resources.get_distribution('{{cookiecutter.package}}').version
except Exception:
__version__ = 'unknown'

Loading…
Cancel
Save