diff --git a/{{cookiecutter.project_slug}}/.coveragerc b/{{cookiecutter.project_slug}}/.coveragerc index 8b68000f616100a6d91e965e54f6c938102110ea..6e4efbc0a8253453723ad265fbc2b52311dbf369 100644 --- a/{{cookiecutter.project_slug}}/.coveragerc +++ b/{{cookiecutter.project_slug}}/.coveragerc @@ -2,11 +2,8 @@ source = {{cookiecutter.project_slug}} [report] -include = - {{cookiecutter.project_slug}}/* omit = - tests/* - {{cookiecutter.project_slug}}/version.py + src/{{cookiecutter.project_slug}}/version.py exclude_lines = pragma: no cover raise AssertionError diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 1a358041230d37b56ec548879fad9e04ea166c03..db3aa84e4dc9da8db55647a24b8a0eff9c410016 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -4,7 +4,7 @@ __pycache__/ *.pyxbldc # Version info -{{cookiecutter.project_slug}}/version.py +src/{{cookiecutter.project_slug}}/version.py # Build stuff build/ diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile index 3b920bf23be14ac7e2578fadecbec24bd02323b3..734df429cb45509f75bc4c9f65676ec2caed5f45 100644 --- a/{{cookiecutter.project_slug}}/Makefile +++ b/{{cookiecutter.project_slug}}/Makefile @@ -1,5 +1,3 @@ -PKGNAME={{cookiecutter.project_slug}} - install: pip install . @@ -10,10 +8,10 @@ clean: python setup.py clean --all test: - py.test --junitxml=./reports/junit.xml -o junit_suite_name=$(PKGNAME) tests + py.test --junitxml=./reports/junit.xml -o junit_suite_name={{cookiecutter.project_slug}} tests test-cov: - py.test --cov ./$(PKGNAME) --cov-report term-missing --cov-report xml:reports/coverage.xml --cov-report html:reports/coverage tests + py.test --cov src/{{cookiecutter.project_slug}} --cov-report term-missing --cov-report xml:reports/coverage.xml --cov-report html:reports/coverage tests test-loop: py.test tests @@ -30,11 +28,9 @@ docstyle: lint: py.test --pylint -dependencies: - pip install -Ur requirements.txt - .PHONY: black black: + black --exclude 'version.py' src/{{cookiecutter.project_slug}} black examples black tests black doc/conf.py @@ -42,10 +38,11 @@ black: .PHONY: black-check black-check: + black --check --exclude 'version.py' src/{{cookiecutter.project_slug}} black --check examples black --check tests black --check doc/conf.py black --check setup.py -.PHONY: all clean install install-dev test test-nocov flake8 pep8 dependencies docstyle black black-check +.PHONY: all clean install install-dev test test-nocov flake8 pep8 docstyle black black-check diff --git a/{{cookiecutter.project_slug}}/doc/conf.py b/{{cookiecutter.project_slug}}/doc/conf.py index 17611f866f39f4801d14296280d3632cc102a7e2..b25bab7d988737c5e91bb5c13c64d8ada047f420 100644 --- a/{{cookiecutter.project_slug}}/doc/conf.py +++ b/{{cookiecutter.project_slug}}/doc/conf.py @@ -48,7 +48,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'version.py'] # AutoAPI autoapi_type = "python" -autoapi_dirs = ['../{{cookiecutter.project_slug}}'] +autoapi_dirs = ['../src/{{cookiecutter.project_slug}}'] autoapi_options = ["members", "undoc-members", "show-module-summary"] autoapi_include_summaries = True diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index f4fcb17e4637ab92dabec5a7b22149794ebd602d..36dec2d6caaa384c58df7ff1a684f2edd72925fe 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -2,4 +2,4 @@ requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] [tool.setuptools_scm] -write_to = "{{cookiecutter.project_slug}}/version.py" +write_to = "src/{{cookiecutter.project_slug}}/version.py" diff --git a/{{cookiecutter.project_slug}}/requirements/dev.txt b/{{cookiecutter.project_slug}}/requirements/dev.txt deleted file mode 100644 index 924a58562fdbb56400240f9754c8e87322afe449..0000000000000000000000000000000000000000 --- a/{{cookiecutter.project_slug}}/requirements/dev.txt +++ /dev/null @@ -1,15 +0,0 @@ -black -matplotlib -numpydoc -pillow -pytest -pytest-cov -pytest-flake8 -pytest-pylint -pytest-watch -sphinx -sphinx-autoapi -sphinx-gallery>=0.1.12 -sphinx_rtd_theme -sphinxcontrib-versioning -wheel diff --git a/{{cookiecutter.project_slug}}/requirements/install.txt b/{{cookiecutter.project_slug}}/requirements/install.txt deleted file mode 100644 index cba8d8860740c8cc71720b2c8640c6b4d47ca4e2..0000000000000000000000000000000000000000 --- a/{{cookiecutter.project_slug}}/requirements/install.txt +++ /dev/null @@ -1 +0,0 @@ -setuptools_scm diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4cd424acb3304a96f5f83df0ac23057c57afa7b5 --- /dev/null +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -0,0 +1,98 @@ +[metadata] +name = {{cookiecutter.project_slug}} +description = {{cookiecutter.description}} +long_description = file: README.rst +long_description_content_type = text/x-rst +url = {{cookiecutter.gitlab_repo_path}} +author = {{cookiecutter.author}} +author_email = {{cookiecutter.email}} +maintainer = {{cookiecutter.author}} +maintainer_email = {{cookiecutter.email}} +license = MIT +license_file = LICENSE +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: Science/Research + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Topic :: Scientific/Engineering +keywords = + neutrino + astroparticle + physics + HEP + +[options] +packages = find: +install_requires = + setuptools_scm +python_requires = >=3.6 +include_package_data = True +package_dir = + =src + +[options.packages.find] +where = src + +[options.extras_require] +all = + black + matplotlib + numpydoc + pillow + pytest + pytest-cov + pytest-flake8 + pytest-pylint + pytest-watch + sphinx + sphinx-autoapi + sphinx-gallery>=0.1.12 + sphinx_rtd_theme + sphinxcontrib-versioning + wheel +dev = + black + matplotlib + numpydoc + pillow + pytest + pytest-cov + pytest-flake8 + pytest-pylint + pytest-watch + sphinx + sphinx-autoapi + sphinx-gallery>=0.1.12 + sphinx_rtd_theme + sphinxcontrib-versioning + wheel + +[options.package_data] +* = *.py.typed + +[bdist_wheel] +universal = 1 + +[tool:pytest] +junit_family = xunit2 +addopts = -vv -rs -Wd +testpaths = + tests + +[check-manifest] +ignore = + src/{{cookiecutter.project_slug}}/version.py + +[tool:isort] +profile = black +multi_line_output = 3 diff --git a/{{cookiecutter.project_slug}}/setup.py b/{{cookiecutter.project_slug}}/setup.py index 20f24c7da070a3291c7403f18a7b01a3fb588dad..c82334553632d12caf96bd3d3d332d9683d2635c 100644 --- a/{{cookiecutter.project_slug}}/setup.py +++ b/{{cookiecutter.project_slug}}/setup.py @@ -1,43 +1,4 @@ #!/usr/bin/env python -# Filename: setup.py -""" -The {{cookiecutter.project_slug}} setup script. - -""" from setuptools import setup -import os - - -def read_requirements(kind): - """Return a list of stripped lines from a file""" - with open(os.path.join("requirements", kind + ".txt")) as fobj: - return [l.strip() for l in fobj.readlines()] - - -try: - with open("README.rst") as fh: - long_description = fh.read() -except UnicodeDecodeError: - long_description = "{{cookiecutter.description}}" -setup( - name='{{cookiecutter.project_slug}}', - url='{{cookiecutter.gitlab_repo_path}}', - description='{{cookiecutter.description}}', - long_description=long_description, - author='{{cookiecutter.author}}', - author_email='{{cookiecutter.email}}', - packages=['{{cookiecutter.project_slug}}'], - include_package_data=True, - platforms='any', - setup_requires=['setuptools_scm'], - use_scm_version=True, - python_requires='>=3.6', - install_requires=read_requirements("install"), - extras_require={kind: read_requirements(kind) for kind in ["dev"]}, - classifiers=[ - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'Programming Language :: Python', - ], -) +setup() diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py similarity index 100% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py rename to {{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/calc.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/calc.py similarity index 100% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/calc.py rename to {{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/calc.py diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/utils.py similarity index 100% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils.py rename to {{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/utils.py