diff --git a/README.md b/README.md index 2e867b9..49e37ec 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/{{cookiecutter.package}}/CHANGELOG.md b/{{cookiecutter.package}}/CHANGELOG.md index e69de29..2d61eb5 100644 --- a/{{cookiecutter.package}}/CHANGELOG.md +++ b/{{cookiecutter.package}}/CHANGELOG.md @@ -0,0 +1 @@ +# {{cookiecutter.package}} 0.1.0 (UNRELEASED) diff --git a/{{cookiecutter.package}}/MANIFEST.in b/{{cookiecutter.package}}/MANIFEST.in deleted file mode 100644 index ae15510..0000000 --- a/{{cookiecutter.package}}/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE README.md CHANGELOG.md diff --git a/{{cookiecutter.package}}/README.md b/{{cookiecutter.package}}/README.md index d5480e2..afab97d 100644 --- a/{{cookiecutter.package}}/README.md +++ b/{{cookiecutter.package}}/README.md @@ -1,3 +1,15 @@ # {{cookiecutter.package}} ## {{cookiecutter.package_description}} + +## Install + +```sh +$ pip install {{ cookiecutter.package }} +``` + +## Example + +```python +print("TODO") +``` diff --git a/{{cookiecutter.package}}/mypy.ini b/{{cookiecutter.package}}/mypy.ini deleted file mode 100644 index ab4ef1a..0000000 --- a/{{cookiecutter.package}}/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] -python_version = 3.8 -platform = linux -ignore_missing_imports = True diff --git a/{{cookiecutter.package}}/pyproject.toml b/{{cookiecutter.package}}/pyproject.toml index 50cb059..e9f8d8f 100644 --- a/{{cookiecutter.package}}/pyproject.toml +++ b/{{cookiecutter.package}}/pyproject.toml @@ -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/ +""" diff --git a/{{cookiecutter.package}}/setup.cfg b/{{cookiecutter.package}}/setup.cfg deleted file mode 100644 index 01a97fe..0000000 --- a/{{cookiecutter.package}}/setup.cfg +++ /dev/null @@ -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 = . diff --git a/{{cookiecutter.package}}/setup.py b/{{cookiecutter.package}}/setup.py deleted file mode 100644 index d5d43d7..0000000 --- a/{{cookiecutter.package}}/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup(use_scm_version=True) diff --git a/{{cookiecutter.package}}/test/test_version.py b/{{cookiecutter.package}}/test/test_version.py deleted file mode 100644 index 8902ba3..0000000 --- a/{{cookiecutter.package}}/test/test_version.py +++ /dev/null @@ -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' diff --git a/{{cookiecutter.package}}/tox.ini b/{{cookiecutter.package}}/tox.ini deleted file mode 100644 index a8914bb..0000000 --- a/{{cookiecutter.package}}/tox.ini +++ /dev/null @@ -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 diff --git a/{{cookiecutter.package}}/{{cookiecutter.package}}/__init__.py b/{{cookiecutter.package}}/{{cookiecutter.package}}/__init__.py index 84d80db..b07bad0 100644 --- a/{{cookiecutter.package}}/{{cookiecutter.package}}/__init__.py +++ b/{{cookiecutter.package}}/{{cookiecutter.package}}/__init__.py @@ -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'