├── .gitattributes ├── {{cookiecutter.project_name}} ├── .gitattributes ├── src │ └── {{cookiecutter.package_name}} │ │ ├── py.typed │ │ └── __init__.py ├── tests │ ├── __init__.py │ └── test_{{cookiecutter.package_name}}.py ├── docs │ ├── index.md │ ├── gen_ref_pages.py │ └── assets │ │ └── logo.svg ├── .github │ ├── dependabot.yml │ └── workflows │ │ ├── update-template.yaml │ │ ├── docs.yml │ │ ├── release.yml │ │ └── tests.yml ├── mkdocs.yml ├── {% if cookiecutter.license == 'MIT' -%} LICENSE {%- endif %} ├── .pre-commit-config.yaml ├── noxfile.py ├── .gitignore ├── README.rst ├── CONTRIBUTING.rst ├── pyproject.toml ├── CODE_OF_CONDUCT.rst └── {% if cookiecutter.license == 'Apache-2.0' -%} LICENSE {%- endif %} ├── .github ├── dependabot.yml └── workflows │ └── tests.yml ├── pyproject.toml ├── hooks └── post_gen_project.py ├── cookiecutter.json ├── LICENSE.rst ├── renovate.json ├── README.rst ├── .pre-commit-config.yaml ├── action.yml └── CODE_OF_CONDUCT.rst /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/src/{{cookiecutter.package_name}}/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/src/{{cookiecutter.package_name}}/__init__.py: -------------------------------------------------------------------------------- 1 | """{{cookiecutter.friendly_name}}.""" 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Test suite for the {{cookiecutter.package_name}} package.""" 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/docs/index.md: -------------------------------------------------------------------------------- 1 | # Welcome to {{cookiecutter.friendly_name}} 2 | 3 | - [API Reference](./reference/{{cookiecutter.package_name}}/index.md) 4 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/tests/test_{{cookiecutter.package_name}}.py: -------------------------------------------------------------------------------- 1 | """Tests for `{{ cookiecutter.package_name }}` package.""" 2 | 3 | 4 | def test_something(): 5 | """Test something.""" 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - directory: "/{{cookiecutter.project_name}}" 5 | package-ecosystem: "pip" 6 | schedule: 7 | interval: "weekly" 8 | labels: 9 | - "maintenance" 10 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.ruff] 2 | extend-exclude = ["[{][{]cookiecutter.project_name[}][}]/noxfile.py"] 3 | 4 | [tool.codespell] 5 | ignore-words-list = " " 6 | skip = "CODE_OF_CONDUCT.rst,{{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst" 7 | -------------------------------------------------------------------------------- /hooks/post_gen_project.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | from pathlib import Path 3 | 4 | 5 | if not {{cookiecutter.docs}}: # noqa: F821 6 | shutil.rmtree("docs") 7 | (Path(".github") / "workflows" / "docs.yml").unlink() 8 | Path("mkdocs.yml").unlink() 9 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - directory: "/" 5 | package-ecosystem: "pip" 6 | schedule: 7 | interval: "weekly" 8 | labels: 9 | - "maintenance" 10 | 11 | - directory: "/" 12 | package-ecosystem: "github-actions" 13 | schedule: 14 | interval: "weekly" 15 | labels: 16 | - "maintenance" 17 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/update-template.yaml: -------------------------------------------------------------------------------- 1 | name: Update template 2 | 3 | on: 4 | schedule: 5 | - cron: '5 1 * * *' # every day at 01:05 6 | workflow_dispatch: 7 | 8 | jobs: 9 | update: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out the repository 13 | uses: actions/checkout@v4 14 | 15 | - name: Update template 16 | uses: iterative/py-template@main 17 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | docs: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out the repository 13 | uses: actions/checkout@v4 14 | with: 15 | fetch-depth: 0 16 | 17 | - name: Set up Python 18 | uses: actions/setup-python@v5 19 | with: 20 | python-version: '3.13' 21 | 22 | - name: Configure git 23 | run: | 24 | git config user.name 'github-actions[bot]' 25 | git config user.email 'github-actions[bot]@users.noreply.github.com' 26 | 27 | - name: Publish docs 28 | run: | 29 | pip install '.[docs]' 30 | mkdocs gh-deploy 31 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: "{{cookiecutter.friendly_name}}" 2 | 3 | theme: 4 | name: material 5 | logo: assets/logo.svg 6 | favicon: assets/logo.svg 7 | palette: 8 | primary: white 9 | accent: deep purple 10 | icon: 11 | repo: fontawesome/brands/github 12 | 13 | repo_url: https://github.com/iterative/{{cookiecutter.project_name}} 14 | repo_name: iterative/{{cookiecutter.project_name}} 15 | 16 | extra: 17 | social: 18 | - icon: fontawesome/brands/github 19 | link: https://github.com/iterative/ 20 | 21 | plugins: 22 | - search 23 | - gen-files: 24 | scripts: 25 | - docs/gen_ref_pages.py 26 | - section-index 27 | - mkdocstrings: 28 | handlers: 29 | python: 30 | options: 31 | show_submodules: no 32 | 33 | watch: 34 | - src/{{cookiecutter.package_name}} 35 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/docs/gen_ref_pages.py: -------------------------------------------------------------------------------- 1 | """Generate the code reference pages.""" 2 | 3 | from pathlib import Path 4 | 5 | import mkdocs_gen_files 6 | 7 | for path in sorted(Path("src").rglob("*.py")): 8 | module_path = path.relative_to("src").with_suffix("") 9 | doc_path = path.relative_to("src").with_suffix(".md") 10 | full_doc_path = Path("reference", doc_path) 11 | 12 | parts = list(module_path.parts) 13 | 14 | if parts[-1] == "__init__": 15 | parts = parts[:-1] 16 | doc_path = doc_path.with_name("index.md") 17 | full_doc_path = full_doc_path.with_name("index.md") 18 | elif parts[-1] == "__main__": 19 | continue 20 | 21 | with mkdocs_gen_files.open(full_doc_path, "w") as fd: 22 | identifier = ".".join(parts) 23 | print("::: " + identifier, file=fd) 24 | 25 | mkdocs_gen_files.set_edit_path(full_doc_path, path) 26 | -------------------------------------------------------------------------------- /cookiecutter.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_name": "py-template", 3 | "package_name": "{{ cookiecutter.project_name.replace('-', '_') }}", 4 | "friendly_name": "{{ cookiecutter.project_name.replace('-', ' ').title() }}", 5 | "author": "Iterative", 6 | "email": "support@dvc.org", 7 | "github_user": "iterative", 8 | "version": "0.0.0", 9 | "copyright_year": "{% now 'utc', '%Y' %}", 10 | "license": [ 11 | "Apache-2.0", 12 | "MIT" 13 | ], 14 | "docs": false, 15 | "short_description": "", 16 | "development_status": [ 17 | "Development Status :: 1 - Planning", 18 | "Development Status :: 2 - Pre-Alpha", 19 | "Development Status :: 3 - Alpha", 20 | "Development Status :: 4 - Beta", 21 | "Development Status :: 5 - Production/Stable", 22 | "Development Status :: 6 - Mature", 23 | "Development Status :: 7 - Inactive" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | release: 5 | types: [published] 6 | workflow_dispatch: 7 | 8 | env: 9 | FORCE_COLOR: "1" 10 | 11 | jobs: 12 | release: 13 | environment: pypi 14 | permissions: 15 | contents: read 16 | id-token: write 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Check out the repository 20 | uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Set up Python 3.10 25 | uses: actions/setup-python@v5 26 | with: 27 | python-version: '3.13' 28 | 29 | - name: Upgrade pip and nox 30 | run: | 31 | pip install --upgrade pip nox 32 | pip --version 33 | nox --version 34 | 35 | - name: Build package 36 | run: nox -s build 37 | 38 | - name: Upload package 39 | if: github.event_name == 'release' 40 | uses: pypa/gh-action-pypi-publish@release/v1 41 | -------------------------------------------------------------------------------- /LICENSE.rst: -------------------------------------------------------------------------------- 1 | MIT License 2 | =========== 3 | 4 | Copyright © 2020 Claudio Jolowicz 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | **The software is provided "as is", without warranty of any kind, express or 17 | implied, including but not limited to the warranties of merchantability, 18 | fitness for a particular purpose and noninfringement. In no event shall the 19 | authors or copyright holders be liable for any claim, damages or other 20 | liability, whether in an action of contract, tort or otherwise, arising from, 21 | out of or in connection with the software or the use or other dealings in the 22 | software.** 23 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/{% if cookiecutter.license == 'MIT' -%} LICENSE {%- endif %}: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) {{ cookiecutter.copyright_year }} {{ cookiecutter.author }} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["group:all", ":dependencyDashboard"], 3 | "enabledManagers": ["github-actions", "pre-commit", "regex"], 4 | "github-actions": { 5 | "fileMatch": [ 6 | "^{{cookiecutter.project_name}}\/((workflow-templates|\\.github\/workflows)\/[^/]+\\.ya?ml$|action\\.ya?ml$)" 7 | ] 8 | }, 9 | "pre-commit": { 10 | "enabled": true, 11 | "fileMatch": [ 12 | "^.pre-commit-config.yaml$", 13 | "^{{cookiecutter.project_name}}/.pre-commit-config.yaml$" 14 | ] 15 | }, 16 | "includeForks": true, 17 | "regexManagers": [ 18 | { 19 | "fileMatch": [ 20 | "^.pre-commit-config.yaml$", 21 | "^{{cookiecutter.project_name}}/.pre-commit-config.yaml$" 22 | ], 23 | "matchStrings": [ 24 | "\\s*- (?.*?)==(?.*?)\\s+" 25 | ], 26 | "datasourceTemplate": "pypi" 27 | }, 28 | { 29 | "fileMatch": ["action.yml"], 30 | "matchStrings": [ 31 | "(?\\S+)==(?.*?)\\s+#\\s*renovate:\\s*?datasource=pypi" 32 | ], 33 | "datasourceTemplate": "pypi" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | default_language_version: 2 | python: python3 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v5.0.0 6 | hooks: 7 | - id: check-added-large-files 8 | - id: check-case-conflict 9 | - id: check-docstring-first 10 | - id: check-executables-have-shebangs 11 | - id: check-json 12 | - id: check-merge-conflict 13 | args: ['--assume-in-merge'] 14 | - id: check-toml 15 | - id: check-yaml 16 | - id: end-of-file-fixer 17 | - id: mixed-line-ending 18 | args: ['--fix=lf'] 19 | - id: sort-simple-yaml 20 | - id: trailing-whitespace 21 | - repo: https://github.com/astral-sh/ruff-pre-commit 22 | rev: 'v0.11.8' 23 | hooks: 24 | - id: ruff 25 | args: [--fix, --exit-non-zero-on-fix] 26 | - id: ruff-format 27 | - repo: https://github.com/codespell-project/codespell 28 | rev: v2.4.1 29 | hooks: 30 | - id: codespell 31 | additional_dependencies: ["tomli"] 32 | - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks 33 | rev: v2.14.0 34 | hooks: 35 | - id: pretty-format-toml 36 | args: [--autofix, --no-sort] 37 | - id: pretty-format-yaml 38 | args: [--autofix, --indent, '2', '--offset', '2', --preserve-quotes] 39 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | py-template 3 | =============================== 4 | 5 | Python template based on `cookiecutter-hypermodern-python`__. 6 | 7 | __ https://cookiecutter-hypermodern-python.readthedocs.io/ 8 | 9 | Usage 10 | ===== 11 | 12 | .. code:: console 13 | 14 | $ cruft create https://github.com/iterative/py-template 15 | 16 | 17 | Features 18 | ======== 19 | 20 | .. features-begin 21 | 22 | - Test automation with Nox_ 23 | - Linting with pre-commit_ and ruff_ 24 | - Continuous integration with `GitHub Actions`_ 25 | - Documentation with Sphinx_ and `Read the Docs`_ using the furo_ theme 26 | - Automated uploads to PyPI_ 27 | - Automated dependency updates with Dependabot_ 28 | - Testing with pytest_ 29 | - Code coverage with Coverage.py_ 30 | - Coverage reporting with Codecov_ 31 | - Static type-checking with mypy_ 32 | - Automated Python syntax upgrades with pyupgrade_ 33 | - setuptools as backend, build as frontend 34 | 35 | The template supports Python 3.8, 3.9, 3.10 and 3.11. 36 | 37 | .. features-end 38 | 39 | .. references-begin 40 | 41 | .. _Codecov: https://codecov.io/ 42 | .. _Cookiecutter: https://github.com/audreyr/cookiecutter 43 | .. _Coverage.py: https://coverage.readthedocs.io/ 44 | .. _Dependabot: https://dependabot.com/ 45 | .. _GitHub Actions: https://github.com/features/actions 46 | .. _Nox: https://nox.thea.codes/ 47 | .. _PyPI: https://pypi.org/ 48 | .. _Read the Docs: https://readthedocs.org/ 49 | .. _mypy: http://mypy-lang.org/ 50 | .. _pre-commit: https://pre-commit.com/ 51 | .. _pytest: https://docs.pytest.org/en/latest/ 52 | .. _pyupgrade: https://github.com/asottile/pyupgrade 53 | .. _ruff: https://github.com/astral-sh/ruff 54 | 55 | .. references-end 56 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | workflow_dispatch: 8 | 9 | env: 10 | FORCE_COLOR: "1" 11 | 12 | concurrency: 13 | group: {% raw %}${{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | tests: 18 | timeout-minutes: 10 19 | runs-on: {% raw %}${{ matrix.os }}{% endraw %} 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | os: [ubuntu-20.04, windows-latest, macos-latest] 24 | pyv: ['3.8', '3.9', '3.10', '3.11', '3.12'] 25 | include: 26 | - {os: ubuntu-latest, pyv: 'pypy3.8'} 27 | 28 | steps: 29 | - name: Check out the repository 30 | uses: actions/checkout@v4 31 | with: 32 | fetch-depth: 0 33 | 34 | - name: Set up Python {% raw %}${{ matrix.pyv }}{% endraw %} 35 | uses: actions/setup-python@v5 36 | with: 37 | python-version: {% raw %}${{ matrix.pyv }}{% endraw %} 38 | 39 | - name: Upgrade pip and nox 40 | run: | 41 | python -m pip install --upgrade pip nox 42 | pip --version 43 | nox --version 44 | 45 | - name: Lint code 46 | run: nox -s lint 47 | 48 | - name: Run tests 49 | run: nox -s tests-{% raw %}${{ matrix.nox_pyv || matrix.pyv }}{% endraw %} -- --cov-report=xml 50 | 51 | - name: Upload coverage report 52 | uses: codecov/codecov-action@v5 53 | 54 | - name: Build package 55 | run: nox -s build 56 | 57 | {% if cookiecutter.docs != "False" %} 58 | - name: Build docs 59 | run: nox -s docs 60 | {% endif -%} 61 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | default_language_version: 2 | python: python3 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v5.0.0 6 | hooks: 7 | - id: check-added-large-files 8 | - id: check-case-conflict 9 | - id: check-docstring-first 10 | - id: check-executables-have-shebangs 11 | - id: check-json 12 | - id: check-merge-conflict 13 | args: ['--assume-in-merge'] 14 | - id: check-toml 15 | exclude: "{{cookiecutter.project_name}}/pyproject.toml" 16 | - id: check-yaml 17 | exclude: "{{cookiecutter.project_name}}/" 18 | - id: debug-statements 19 | exclude: "{{cookiecutter.project_name}}/noxfile.py" 20 | - id: end-of-file-fixer 21 | - id: mixed-line-ending 22 | args: ['--fix=lf'] 23 | - id: sort-simple-yaml 24 | - id: trailing-whitespace 25 | - repo: https://github.com/astral-sh/ruff-pre-commit 26 | rev: 'v0.11.8' 27 | hooks: 28 | - id: ruff 29 | args: [--fix, --exit-non-zero-on-fix, "--config=pyproject.toml"] 30 | - id: ruff-format 31 | args: ["--config=pyproject.toml"] 32 | - repo: https://github.com/codespell-project/codespell 33 | rev: v2.4.1 34 | hooks: 35 | - id: codespell 36 | additional_dependencies: ["tomli"] 37 | - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks 38 | rev: v2.14.0 39 | hooks: 40 | - id: pretty-format-toml 41 | args: [--autofix, --no-sort] 42 | exclude: "{{cookiecutter.project_name}}/pyproject.toml" 43 | - id: pretty-format-yaml 44 | args: [--autofix, --indent, '2', '--offset', '2', --preserve-quotes] 45 | exclude: "{{cookiecutter.project_name}}" 46 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/docs/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/noxfile.py: -------------------------------------------------------------------------------- 1 | """Automation using nox.""" 2 | 3 | import glob 4 | import os 5 | 6 | import nox 7 | 8 | nox.options.reuse_existing_virtualenvs = True 9 | nox.options.sessions = "lint", "tests" 10 | locations = "src", "tests" 11 | 12 | 13 | {% if cookiecutter.docs != "False" -%} 14 | @nox.session 15 | def docs(session: nox.Session) -> None: 16 | session.install(".[docs]") 17 | session.run("mkdocs", "build") 18 | 19 | 20 | {% endif -%} 21 | @nox.session( 22 | python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9", "pypy3.10"], 23 | ) 24 | def tests(session: nox.Session) -> None: 25 | session.install(".[tests]") 26 | session.run( 27 | "pytest", 28 | "--cov", 29 | "--cov-config=pyproject.toml", 30 | *session.posargs, 31 | env={"COVERAGE_FILE": f".coverage.{session.python}"}, 32 | ) 33 | 34 | 35 | @nox.session 36 | def lint(session: nox.Session) -> None: 37 | session.install("pre-commit") 38 | session.install("-e", ".[dev]") 39 | 40 | args = *(session.posargs or ("--show-diff-on-failure",)), "--all-files" 41 | session.run("pre-commit", "run", *args) 42 | session.run("python", "-m", "mypy") 43 | 44 | 45 | @nox.session 46 | def build(session: nox.Session) -> None: 47 | session.install("build", "setuptools", "twine") 48 | session.run("python", "-m", "build") 49 | dists = glob.glob("dist/*") 50 | session.run("twine", "check", *dists, silent=True) 51 | 52 | 53 | @nox.session 54 | def dev(session: nox.Session) -> None: 55 | """Sets up a python development environment for the project.""" 56 | args = session.posargs or ("venv",) 57 | venv_dir = os.fsdecode(os.path.abspath(args[0])) 58 | 59 | session.log(f"Setting up virtual environment in {venv_dir}") 60 | session.install("virtualenv") 61 | session.run("virtualenv", venv_dir, silent=True) 62 | 63 | python = os.path.join(venv_dir, "bin/python") 64 | session.run(python, "-m", "pip", "install", "-e", ".[dev]", external=True) 65 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | workflow_dispatch: 8 | schedule: 9 | - cron: '5 1 * * *' # every day at 01:05 10 | 11 | env: 12 | FORCE_COLOR: "1" 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | tests: 20 | timeout-minutes: 10 21 | runs-on: ubuntu-latest 22 | strategy: 23 | matrix: 24 | context: 25 | - {project_name: testing-123} 26 | - {project_name: testing-123-with-docs, docs: true} 27 | 28 | name: ${{ matrix.context.project_name }} 29 | steps: 30 | - name: Check out the repository 31 | uses: actions/checkout@v4 32 | with: 33 | fetch-depth: 0 34 | 35 | - name: Setup nox 36 | uses: wntrblm/nox@2025.05.01 37 | with: 38 | python-versions: "3.8, 3.9, 3.10, 3.11, 3.12, pypy-3.8, pypy-3.9, pypy-3.10" 39 | 40 | - name: Generate template via cruft 41 | run: | 42 | pip install cruft 43 | cruft create -y --extra-context '${{ toJSON(matrix.context) }}' . 44 | 45 | - name: Show directory structure and file contents 46 | run: | 47 | cd ${{ matrix.context.project_name }} 48 | echo "::group::tree" && tree -a && echo "::endgroup::" 49 | echo "::group::.cruft.json" && cat .cruft.json && echo "::endgroup::" 50 | echo "::group::pyproject.toml" && cat pyproject.toml && echo "::endgroup::" 51 | echo "::group::CONTRIBUTING.rst" && cat CONTRIBUTING.rst && echo "::endgroup::" 52 | echo "::group::noxfile.py" && cat noxfile.py && echo "::endgroup::" 53 | echo "::group::tests.yml" && cat .github/workflows/tests.yml && echo "::endgroup::" 54 | 55 | - name: Initialize repository 56 | run: | 57 | cd ${{ matrix.context.project_name }} 58 | git init 59 | git config user.name 'github-actions[bot]' 60 | git config user.email 'github-actions[bot]@users.noreply.github.com' 61 | git add . 62 | git commit -m "init" 63 | 64 | - name: Run nox 65 | run: | 66 | cd ${{ matrix.context.project_name }} 67 | nox 68 | nox -s lint build dev ${{ matrix.context.docs && 'docs'}} 69 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Update iterative/py-template 2 | description: "Update py-template generated template" 3 | branding: 4 | icon: package 5 | color: purple 6 | inputs: 7 | token: 8 | description: 'GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)' 9 | default: ${{ github.token }} 10 | 11 | runs: 12 | using: composite 13 | steps: 14 | - name: Set up Python 15 | uses: actions/setup-python@v5 16 | with: 17 | python-version: '3.13' 18 | 19 | - name: Install cruft 20 | shell: bash 21 | run: pip install cruft==2.16.0 # renovate: datasource=pypi 22 | 23 | - name: Update template via cruft 24 | shell: bash 25 | id: cruft 26 | run: | 27 | echo "template=$(cat .cruft.json | jq '.template' -r)" >> $GITHUB_OUTPUT 28 | echo "old_commit=$(cat .cruft.json | jq '.commit' -r)" >> $GITHUB_OUTPUT 29 | cruft update -y 30 | echo "new_commit=$(cat .cruft.json | jq '.commit' -r)" >> $GITHUB_OUTPUT 31 | 32 | - name: Check current state 33 | shell: bash 34 | run: | 35 | git status --untracked-files=all 36 | git diff 37 | 38 | - name: Try to apply reject hunks 39 | shell: bash 40 | id: apply-rejects 41 | run: | 42 | for reject in $(git ls-files --others --exclude-standard '*.rej'); do 43 | file=${reject%.rej} 44 | cat ${reject} 45 | patch -p1 --merge --no-backup-if-mismatch ${file} < ${reject} || echo " - \`${file}\`" >> /tmp/conflicts 46 | rm ${reject} 47 | echo 48 | 49 | echo 'conflicts<> $GITHUB_OUTPUT 50 | test -f /tmp/conflicts && cat /tmp/conflicts >> $GITHUB_OUTPUT 51 | echo 'EOF' >> $GITHUB_OUTPUT 52 | done 53 | 54 | - name: Check diff 55 | id: diff 56 | shell: bash 57 | run: | 58 | git status --untracked-files=all 59 | echo 'changes<> $GITHUB_OUTPUT 60 | git diff >> $GITHUB_OUTPUT 61 | echo 'EOF' >> $GITHUB_OUTPUT 62 | 63 | - name: Create PR 64 | if: ${{ steps.diff.outputs.changes != '' }} 65 | uses: peter-evans/create-pull-request@v7 66 | with: 67 | token: ${{ inputs.token }} 68 | commit-message: update template 69 | title: update template 70 | draft: true 71 | body: | 72 | Automated changes to update template with ${{ steps.cruft.outputs.template }}. 73 | 74 | ${{ steps.apply-rejects.outputs.conflicts != '' && 'There may be merge conflicts in these files that may need to be resolved manually:' || '' }} 75 | ${{ steps.apply-rejects.outputs.conflicts }} 76 | 77 | __See Changelog__: ${{ steps.cruft.outputs.template }}/compare/${{ steps.cruft.outputs.old_commit }}...${{ steps.cruft.outputs.new_commit }}. 78 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | 134 | # pytype static type analyzer 135 | .pytype/ 136 | 137 | # Cython debug symbols 138 | cython_debug/ 139 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/README.rst: -------------------------------------------------------------------------------- 1 | {%- macro heading(text) -%} 2 | {{text}} 3 | {% for _ in text %}={% endfor %} 4 | {%- endmacro -%} 5 | {{ heading(cookiecutter.friendly_name) }} 6 | 7 | |PyPI| |Status| |Python Version| |License| 8 | 9 | |Tests| |Codecov| |pre-commit| |Black| 10 | 11 | .. |PyPI| image:: https://img.shields.io/pypi/v/{{cookiecutter.project_name}}.svg 12 | :target: https://pypi.org/project/{{cookiecutter.project_name}}/ 13 | :alt: PyPI 14 | .. |Status| image:: https://img.shields.io/pypi/status/{{cookiecutter.project_name}}.svg 15 | :target: https://pypi.org/project/{{cookiecutter.project_name}}/ 16 | :alt: Status 17 | .. |Python Version| image:: https://img.shields.io/pypi/pyversions/{{cookiecutter.project_name}} 18 | :target: https://pypi.org/project/{{cookiecutter.project_name}} 19 | :alt: Python Version 20 | .. |License| image:: https://img.shields.io/pypi/l/{{cookiecutter.project_name}} 21 | :target: https://opensource.org/licenses/{{cookiecutter.license}} 22 | :alt: License 23 | .. |Tests| image:: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/workflows/Tests/badge.svg 24 | :target: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/actions?workflow=Tests 25 | :alt: Tests 26 | .. |Codecov| image:: https://codecov.io/gh/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/branch/main/graph/badge.svg 27 | :target: https://app.codecov.io/gh/{{cookiecutter.github_user}}/{{cookiecutter.project_name}} 28 | :alt: Codecov 29 | .. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white 30 | :target: https://github.com/pre-commit/pre-commit 31 | :alt: pre-commit 32 | .. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg 33 | :target: https://github.com/psf/black 34 | :alt: Black 35 | 36 | 37 | Features 38 | -------- 39 | 40 | * TODO 41 | 42 | 43 | Requirements 44 | ------------ 45 | 46 | * TODO 47 | 48 | 49 | Installation 50 | ------------ 51 | 52 | You can install *{{cookiecutter.friendly_name}}* via pip_ from PyPI_: 53 | 54 | .. code:: console 55 | 56 | $ pip install {{cookiecutter.project_name}} 57 | 58 | 59 | Usage 60 | ----- 61 | 62 | 63 | Contributing 64 | ------------ 65 | 66 | Contributions are very welcome. 67 | To learn more, see the `Contributor Guide`_. 68 | 69 | 70 | License 71 | ------- 72 | 73 | Distributed under the terms of the `{{cookiecutter.license.replace("-", " ")}} license`_, 74 | *{{cookiecutter.friendly_name}}* is free and open source software. 75 | 76 | 77 | Issues 78 | ------ 79 | 80 | If you encounter any problems, 81 | please `file an issue`_ along with a detailed description. 82 | 83 | 84 | .. _{{cookiecutter.license.replace("-", " ")}} license: https://opensource.org/licenses/{{cookiecutter.license}} 85 | .. _PyPI: https://pypi.org/ 86 | .. _file an issue: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/issues 87 | .. _pip: https://pip.pypa.io/ 88 | .. github-only 89 | .. _Contributor Guide: CONTRIBUTING.rst 90 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributor Guide 2 | ================= 3 | 4 | Thank you for your interest in improving this project. 5 | This project is open-source under the `{{cookiecutter.license.replace("-", " ")}} license`_ and 6 | welcomes contributions in the form of bug reports, feature requests, and pull requests. 7 | 8 | Here is a list of important resources for contributors: 9 | 10 | - `Source Code`_ 11 | {%- if cookiecutter.docs != "False" %} 12 | - `Documentation`_ 13 | {%- endif %} 14 | - `Issue Tracker`_ 15 | - `Code of Conduct`_ 16 | 17 | .. _{{cookiecutter.license.replace("-", " ")}} license: https://opensource.org/licenses/{{cookiecutter.license}} 18 | .. _Source Code: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}} 19 | {%- if cookiecutter.docs != "False" %} 20 | .. _Documentation: https://docs.iterative.ai/{{ cookiecutter.project_name }} 21 | {%- endif %} 22 | .. _Issue Tracker: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/issues 23 | 24 | How to report a bug 25 | ------------------- 26 | 27 | Report bugs on the `Issue Tracker`_. 28 | 29 | When filing an issue, make sure to answer these questions: 30 | 31 | - Which operating system and Python version are you using? 32 | - Which version of this project are you using? 33 | - What did you do? 34 | - What did you expect to see? 35 | - What did you see instead? 36 | 37 | The best way to get your bug fixed is to provide a test case, 38 | and/or steps to reproduce the issue. 39 | 40 | 41 | How to request a feature 42 | ------------------------ 43 | 44 | Request features on the `Issue Tracker`_. 45 | 46 | 47 | How to set up your development environment 48 | ------------------------------------------ 49 | 50 | You need Python 3.8+ and the following tools: 51 | 52 | - Nox_ 53 | 54 | Install the package with development requirements: 55 | 56 | .. code:: console 57 | 58 | $ pip install nox 59 | 60 | .. _Nox: https://nox.thea.codes/ 61 | 62 | 63 | How to test the project 64 | ----------------------- 65 | 66 | Run the full test suite: 67 | 68 | .. code:: console 69 | 70 | $ nox 71 | 72 | List the available Nox sessions: 73 | 74 | .. code:: console 75 | 76 | $ nox --list-sessions 77 | 78 | You can also run a specific Nox session. 79 | For example, invoke the unit test suite like this: 80 | 81 | .. code:: console 82 | 83 | $ nox --session=tests 84 | 85 | Unit tests are located in the ``tests`` directory, 86 | and are written using the pytest_ testing framework. 87 | 88 | .. _pytest: https://pytest.readthedocs.io/ 89 | 90 | 91 | How to submit changes 92 | --------------------- 93 | 94 | Open a `pull request`_ to submit changes to this project. 95 | 96 | Your pull request needs to meet the following guidelines for acceptance: 97 | 98 | - The Nox test suite must pass without errors and warnings. 99 | - Include unit tests. This project maintains 100% code coverage. 100 | - If your changes add functionality, update the documentation accordingly. 101 | 102 | Feel free to submit early, though—we can always iterate on this. 103 | 104 | To run linting and code formatting checks, you can invoke a `lint` session in nox: 105 | 106 | .. code:: console 107 | 108 | $ nox -s lint 109 | 110 | It is recommended to open an issue before starting work on anything. 111 | This will allow a chance to talk it over with the owners and validate your approach. 112 | 113 | .. _pull request: https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/pulls 114 | .. github-only 115 | .. _Code of Conduct: CODE_OF_CONDUCT.rst 116 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=48", "setuptools_scm[toml]>=6.3.1"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "{{ cookiecutter.project_name }}" 7 | description = "{{ cookiecutter.short_description or cookiecutter.friendly_name }}" 8 | readme = "README.rst" 9 | license = {text = "{{ cookiecutter.license }}"} 10 | authors = [{name = "{{ cookiecutter.author }}", email = "{{ cookiecutter.email }}"}] 11 | classifiers = [ 12 | "Programming Language :: Python :: 3", 13 | "Programming Language :: Python :: 3.8", 14 | "Programming Language :: Python :: 3.9", 15 | "Programming Language :: Python :: 3.10", 16 | "Programming Language :: Python :: 3.11", 17 | "Programming Language :: Python :: 3.12", 18 | "{{cookiecutter.development_status}}" 19 | ] 20 | requires-python = ">=3.8" 21 | dynamic = ["version"] 22 | dependencies = [] 23 | 24 | [project.urls] 25 | Issues = "https://github.com/{{cookiecutter.github_user}}/{{ cookiecutter.project_name }}/issues" 26 | Source = "https://github.com/{{cookiecutter.github_user}}/{{ cookiecutter.project_name }}" 27 | 28 | [project.optional-dependencies] 29 | {%- if cookiecutter.docs != "False" %} 30 | docs = [ 31 | "mkdocs==1.6.1", 32 | "mkdocs-gen-files==0.5.0", 33 | "mkdocs-material==9.5.36", 34 | "mkdocs-section-index==0.3.9", 35 | "mkdocstrings-python==1.11.1" 36 | ] 37 | {%- endif %} 38 | tests = [ 39 | "pytest==7.2.0", 40 | "pytest-sugar==0.9.5", 41 | "pytest-cov==3.0.0", 42 | "pytest-mock==3.8.2", 43 | "mypy==1.9.0" 44 | ] 45 | dev = [ 46 | "{{ cookiecutter.project_name }}[tests]", 47 | {%- if cookiecutter.docs != "False" %} 48 | "{{ cookiecutter.project_name }}[docs]" 49 | {%- endif %} 50 | ] 51 | 52 | [tool.setuptools_scm] 53 | 54 | [tool.setuptools.packages.find] 55 | where = ["src"] 56 | namespaces = false 57 | 58 | [tool.pytest.ini_options] 59 | addopts = "-ra" 60 | 61 | [tool.coverage.run] 62 | branch = true 63 | source = ["{{cookiecutter.package_name}}", "tests"] 64 | 65 | [tool.coverage.paths] 66 | source = ["src", "*/site-packages"] 67 | 68 | [tool.coverage.report] 69 | show_missing = true 70 | exclude_lines = [ 71 | "pragma: no cover", 72 | "if __name__ == .__main__.:", 73 | "if typing.TYPE_CHECKING:", 74 | "if TYPE_CHECKING:", 75 | "raise NotImplementedError", 76 | "raise AssertionError", 77 | "@overload" 78 | ] 79 | 80 | [tool.mypy] 81 | # Error output 82 | show_column_numbers = true 83 | show_error_codes = true 84 | show_error_context = true 85 | show_traceback = true 86 | pretty = true 87 | check_untyped_defs = false 88 | # Warnings 89 | warn_no_return = true 90 | warn_redundant_casts = true 91 | warn_unreachable = true 92 | files = ["src", "tests"] 93 | 94 | [tool.codespell] 95 | ignore-words-list = " " 96 | skip = "CODE_OF_CONDUCT.rst" 97 | 98 | [tool.ruff] 99 | output-format = "full" 100 | show-fixes = true 101 | 102 | [tool.ruff.lint] 103 | ignore = [ 104 | "S101", # assert 105 | "PLR2004", # magic-value-comparison 106 | "PLW2901", # redefined-loop-name 107 | "ISC001", # single-line-implicit-string-concatenation 108 | "SIM105", # suppressible-exception 109 | "SIM108", # if-else-block-instead-of-if-exp 110 | "D203", # one blank line before class 111 | "D213" # multi-line-summary-second-line 112 | ] 113 | select = ["ALL"] 114 | 115 | [tool.ruff.lint.per-file-ignores] 116 | "noxfile.py" = ["D", "PTH"] 117 | "tests/**" = ["S", "ARG001", "ARG002", "ANN"] 118 | {%- if cookiecutter.docs %} 119 | "docs/**" = ["INP"] 120 | {%- endif %} 121 | 122 | [tool.ruff.lint.flake8-type-checking] 123 | strict = true 124 | 125 | [tool.ruff.lint.isort] 126 | known-first-party = ["{{ cookiecutter.package_name }}"] 127 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.rst: -------------------------------------------------------------------------------- 1 | Contributor Covenant Code of Conduct 2 | ==================================== 3 | 4 | Our Pledge 5 | ---------- 6 | 7 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 8 | 9 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 10 | 11 | 12 | Our Standards 13 | ------------- 14 | 15 | Examples of behavior that contributes to a positive environment for our community include: 16 | 17 | - Demonstrating empathy and kindness toward other people 18 | - Being respectful of differing opinions, viewpoints, and experiences 19 | - Giving and gracefully accepting constructive feedback 20 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 21 | - Focusing on what is best not just for us as individuals, but for the overall community 22 | 23 | Examples of unacceptable behavior include: 24 | 25 | - The use of sexualized language or imagery, and sexual attention or 26 | advances of any kind 27 | - Trolling, insulting or derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or email 30 | address, without their explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | Enforcement Responsibilities 35 | ---------------------------- 36 | 37 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 38 | 39 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 40 | 41 | 42 | Scope 43 | ----- 44 | 45 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 46 | 47 | 48 | Enforcement 49 | ----------- 50 | 51 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at info@dvc.org. All complaints will be reviewed and investigated promptly and fairly. 52 | 53 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 54 | 55 | 56 | Enforcement Guidelines 57 | ---------------------- 58 | 59 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 60 | 61 | 62 | 1. Correction 63 | ~~~~~~~~~~~~~ 64 | 65 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 66 | 67 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 68 | 69 | 70 | 2. Warning 71 | ~~~~~~~~~~ 72 | 73 | **Community Impact**: A violation through a single incident or series of actions. 74 | 75 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 76 | 77 | 78 | 3. Temporary Ban 79 | ~~~~~~~~~~~~~~~~ 80 | 81 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 82 | 83 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 84 | 85 | 86 | 4. Permanent Ban 87 | ~~~~~~~~~~~~~~~~ 88 | 89 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 90 | 91 | **Consequence**: A permanent ban from any sort of public interaction within the community. 92 | 93 | 94 | Attribution 95 | ----------- 96 | 97 | This Code of Conduct is adapted from the `Contributor Covenant `__, version 2.0, 98 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct/. 99 | 100 | Community Impact Guidelines were inspired by `Mozilla’s code of conduct enforcement ladder `__. 101 | 102 | .. _homepage: https://www.contributor-covenant.org 103 | 104 | For answers to common questions about this code of conduct, see the FAQ at 105 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 106 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst: -------------------------------------------------------------------------------- 1 | Contributor Covenant Code of Conduct 2 | ==================================== 3 | 4 | Our Pledge 5 | ---------- 6 | 7 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 8 | 9 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 10 | 11 | 12 | Our Standards 13 | ------------- 14 | 15 | Examples of behavior that contributes to a positive environment for our community include: 16 | 17 | - Demonstrating empathy and kindness toward other people 18 | - Being respectful of differing opinions, viewpoints, and experiences 19 | - Giving and gracefully accepting constructive feedback 20 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 21 | - Focusing on what is best not just for us as individuals, but for the overall community 22 | 23 | Examples of unacceptable behavior include: 24 | 25 | - The use of sexualized language or imagery, and sexual attention or 26 | advances of any kind 27 | - Trolling, insulting or derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or email 30 | address, without their explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | Enforcement Responsibilities 35 | ---------------------------- 36 | 37 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 38 | 39 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 40 | 41 | 42 | Scope 43 | ----- 44 | 45 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 46 | 47 | 48 | Enforcement 49 | ----------- 50 | 51 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at {{cookiecutter.email}}. All complaints will be reviewed and investigated promptly and fairly. 52 | 53 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 54 | 55 | 56 | Enforcement Guidelines 57 | ---------------------- 58 | 59 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 60 | 61 | 62 | 1. Correction 63 | ~~~~~~~~~~~~~ 64 | 65 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 66 | 67 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 68 | 69 | 70 | 2. Warning 71 | ~~~~~~~~~~ 72 | 73 | **Community Impact**: A violation through a single incident or series of actions. 74 | 75 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 76 | 77 | 78 | 3. Temporary Ban 79 | ~~~~~~~~~~~~~~~~ 80 | 81 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 82 | 83 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 84 | 85 | 86 | 4. Permanent Ban 87 | ~~~~~~~~~~~~~~~~ 88 | 89 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 90 | 91 | **Consequence**: A permanent ban from any sort of public interaction within the community. 92 | 93 | 94 | Attribution 95 | ----------- 96 | 97 | This Code of Conduct is adapted from the `Contributor Covenant `__, version 2.0, 98 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct/. 99 | 100 | Community Impact Guidelines were inspired by `Mozilla’s code of conduct enforcement ladder `__. 101 | 102 | .. _homepage: https://www.contributor-covenant.org 103 | 104 | For answers to common questions about this code of conduct, see the FAQ at 105 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 106 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/{% if cookiecutter.license == 'Apache-2.0' -%} LICENSE {%- endif %}: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {{ cookiecutter.copyright_year }} {{ cookiecutter.author }}. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------