├── .gitattributes
├── .github
└── workflows
│ ├── README.md
│ ├── docs_build_and _deploy.yml
│ └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── README.md
├── cookiecutter.json
├── docs
├── CNAME
├── Makefile
├── make.bat
├── requirements.txt
└── source
│ ├── _static
│ ├── css
│ │ └── custom.css
│ ├── dark-logo-niu.png
│ ├── favicon.ico
│ └── light-logo-niu.png
│ ├── _templates
│ ├── footer_end.html
│ ├── footer_start.html
│ └── sidebar-nav.html
│ ├── conf.py
│ ├── contributing.md
│ ├── index.md
│ ├── infrastructure.md
│ └── project_setup.md
├── hooks
└── post_gen_project.py
├── pyproject.toml
├── tests
└── test_cookiecutter.py
└── {{cookiecutter.package_name}}
├── .github
└── workflows
│ ├── docs_build_and_deploy.yml
│ └── test_and_deploy.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── MANIFEST.in
├── README.md
├── docs
├── Makefile
├── make.bat
├── requirements.txt
└── source
│ ├── api_index.rst
│ ├── conf.py
│ ├── getting_started.md
│ └── index.rst
├── licenses
├── Apache-2
├── BSD-3
├── GPL-3
├── LGPL-3
├── MIT
└── MPL-2
├── pyproject.toml
├── tests
├── __init__.py
├── test_integration
│ └── __init__.py
└── test_unit
│ ├── __init__.py
│ └── test_placeholder.py
└── {{cookiecutter.module_name}}
├── __init__.py
├── greetings.py
└── math.py
/.gitattributes:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/.gitattributes
--------------------------------------------------------------------------------
/.github/workflows/README.md:
--------------------------------------------------------------------------------
1 | ## Weekly scheduled run
2 |
3 | Tests are run on the `main` branch of the original fork of this repository on a weekly schedule, to ensure the cookiecutter template does not have outdated dependencies.
4 |
--------------------------------------------------------------------------------
/.github/workflows/docs_build_and _deploy.yml:
--------------------------------------------------------------------------------
1 | name: Build and Deploy Sphinx Docs
2 |
3 | # Generate the documentation on all merges to main, all pull requests, or by
4 | # manual workflow dispatch. The build job can be used as a CI check that the
5 | # docs still build successfully. The deploy job only runs when a tag is
6 | # pushed and actually moves the generated html to the gh-pages branch
7 | # (which triggers a GitHub pages deployment).
8 | on:
9 | push:
10 | branches:
11 | - main
12 | tags:
13 | - '*'
14 | pull_request:
15 | merge_group:
16 | workflow_dispatch:
17 |
18 | jobs:
19 | linting:
20 | # scheduled workflows should not run on forks
21 | if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
22 | runs-on: ubuntu-latest
23 | steps:
24 | - uses: neuroinformatics-unit/actions/lint@v2
25 |
26 | build_sphinx_docs:
27 | name: Build Sphinx Docs
28 | runs-on: ubuntu-latest
29 | steps:
30 | - uses: neuroinformatics-unit/actions/build_sphinx_docs@main
31 | with:
32 | python-version: 3.12
33 | use-make: true
34 |
35 | deploy_sphinx_docs:
36 | name: Deploy Sphinx Docs
37 | needs: build_sphinx_docs
38 | permissions:
39 | contents: write
40 | # Deploy on: main branch pushes OR tags OR manual trigger
41 | if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')) || github.event_name == 'workflow_dispatch'
42 | runs-on: ubuntu-latest
43 | steps:
44 | - uses: neuroinformatics-unit/actions/deploy_sphinx_docs@main
45 | with:
46 | secret_input: ${{ secrets.GITHUB_TOKEN }}
47 | use-make: true
48 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: tests
2 |
3 | on:
4 | push:
5 | pull_request:
6 | workflow_dispatch: # for occasional debugging
7 | schedule:
8 | # Every Sunday at 3 AM
9 | - cron: "0 3 * * 0"
10 |
11 | jobs:
12 | linting:
13 | # scheduled workflows should not run on forks
14 | if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: neuroinformatics-unit/actions/lint@v2
18 |
19 | test:
20 | needs: [linting]
21 | name: ${{ matrix.os }} py${{ matrix.python-version }}
22 | runs-on: ${{ matrix.os }}
23 | strategy:
24 | matrix:
25 | # Run all supported Python versions on linux
26 | python-version: ["3.11", "3.12", "3.13"]
27 | os: [ubuntu-latest]
28 | # Include one windows and macos run
29 | include:
30 | - os: macos-latest
31 | python-version: "3.13"
32 | - os: windows-latest
33 | python-version: "3.13"
34 |
35 | steps:
36 | - uses: actions/checkout@v3
37 | - name: Set up Python ${{ matrix.python-version }}
38 | uses: actions/setup-python@v4
39 | with:
40 | python-version: ${{ matrix.python-version }}
41 | - name: Install dependencies
42 | run: |
43 | python -m pip install --upgrade pip
44 | pip install pre-commit cookiecutter pyyaml pytest toml
45 | - name: Test with pytest
46 | run: |
47 | pytest
48 | - name: Report coverage to codecov
49 | uses: codecov/codecov-action@v2
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | tests/cookiecutter_test_configs.yaml
2 |
3 | # Byte-compiled / optimized / DLL files
4 | __pycache__/
5 | *.py[cod]
6 | *$py.class
7 |
8 | # C extensions
9 | *.so
10 |
11 | # Distribution / packaging
12 | .Python
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 | pip-wheel-metadata/
40 |
41 | # Unit test / coverage reports
42 | htmlcov/
43 | .tox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | .hypothesis/
51 | .pytest_cache/
52 |
53 | # Translations
54 | *.mo
55 | *.pot
56 |
57 | # Django stuff:
58 | *.log
59 | local_settings.py
60 | db.sqlite3
61 |
62 | # Flask stuff:
63 | instance/
64 | .webassets-cache
65 |
66 | # Scrapy stuff:
67 | .scrapy
68 |
69 | # Sphinx documentation
70 | docs/source/api/
71 | docs/source/release/
72 | docs/build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # pyenv
81 | .python-version
82 |
83 | # celery beat schedule file
84 | celerybeat-schedule
85 |
86 | # SageMath parsed files
87 | *.sage.py
88 |
89 | # Environments
90 | .env
91 | .venv
92 | env/
93 | venv/
94 | ENV/
95 | env.bak/
96 | venv.bak/
97 |
98 | # Spyder project settings
99 | .spyderproject
100 | .spyproject
101 |
102 | # Rope project settings
103 | .ropeproject
104 |
105 | # mkdocs documentation
106 | /site
107 |
108 | # mypy
109 | .mypy_cache/
110 |
111 | # Pycharm files
112 | .idea
113 |
114 | # OS stuff
115 | .DS_store
116 |
117 | # Benchmarking results
118 | .asv/
119 |
120 | # VSCode
121 | .vscode/
122 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | # Configuring https://pre-commit.ci/
2 | ci:
3 | autoupdate_schedule: monthly
4 |
5 | exclude: "conf.py"
6 |
7 | repos:
8 | - repo: https://github.com/pre-commit/pre-commit-hooks
9 | rev: v5.0.0
10 | hooks:
11 | - id: check-docstring-first
12 | - id: check-executables-have-shebangs
13 | - id: check-merge-conflict
14 | - id: end-of-file-fixer
15 | - id: mixed-line-ending
16 | args: [--fix=lf]
17 | - id: requirements-txt-fixer
18 | - id: trailing-whitespace
19 | - repo: https://github.com/astral-sh/ruff-pre-commit
20 | rev: v0.11.12
21 | hooks:
22 | - id: ruff
23 | args: [ --config=pyproject.toml ]
24 | - id: ruff-format
25 | args: [ --config=pyproject.toml ]
26 | - repo: https://github.com/codespell-project/codespell
27 | # Configuration for codespell is in pyproject.toml
28 | rev: v2.4.1
29 | hooks:
30 | - id: codespell
31 | additional_dependencies:
32 | - tomli
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2022, Adam Tyson
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | [](https://neuroinformatics.zulipchat.com/#narrow/channel/406003-Python-cookiecutter)
3 | [](https://opensource.org/licenses/BSD-3-Clause)
4 | [](https://github.com/astral-sh/ruff)
5 | [](https://github.com/pre-commit/pre-commit)
6 |
7 | # python-cookiecutter
8 |
9 | A tool to automatically create a Python project structure ready to release via GitHub and [PyPI](https://pypi.org/).
10 |
11 | **python-cookiecutter** automatically creates a structured project and sets up essential
12 | tools, including:
13 |
14 | - A blank `README.md` file for documentation.
15 | - A `LICENSE` file to define usage rights.
16 | - [Pre-commit hooks](https://pre-commit.com/) to maintain code
17 | quality.
18 | - Automatic versioning with
19 | [setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/).
20 | - A test setup using [pytest](https://docs.pytest.org/en/7.0.x/).
21 | - Automated formatting, testing, and publishing via [GitHub
22 | Actions](https://github.com/features/actions).
23 | - A documentation setup with
24 | [Sphinx](https://www.sphinx-doc.org/en/master/).
25 |
26 | ## Quick Install
27 |
28 | First, install cookiecutter in your desired environment. Running in the terminal in your environment, with Pip:
29 |
30 | ```sh
31 | pip install cookiecutter
32 |
33 | # or conda:
34 |
35 | conda install -c conda-forge cookiecutter
36 | ```
37 | ### Creating a cookiecutter project
38 |
39 | In the folder, you want to create the repo run:
40 |
41 | ```sh
42 | cookiecutter https://github.com/neuroinformatics-unit/python-cookiecutter
43 | ```
44 | You will be then asked a series of questions about how you want to set up your project.
45 |
46 | [View Full Documentation →](https://python-cookiecutter.neuroinformatics.dev)
47 |
48 | ## Contributing
49 |
50 | We welcome contributions! See our [Contribution Guidelines](https://python-cookiecutter.neuroinformatics.dev/contributing) for workflow details.
51 |
52 | ## License
53 | ⚖️ [BSD 3-Clause](./LICENSE)
54 |
--------------------------------------------------------------------------------
/cookiecutter.json:
--------------------------------------------------------------------------------
1 | {
2 | "full_name": "Python developer",
3 | "email": "yourname@example.com",
4 | "github_username_or_organization": "githubuser",
5 | "package_name": "python-package",
6 | "github_repository_url": ["https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.package_name}}", "provide later"],
7 | "module_name": "{{ cookiecutter.package_name|lower|replace('-', '_') }}",
8 | "short_description": "A simple Python package",
9 | "license": [
10 | "BSD-3",
11 | "MIT",
12 | "Mozilla Public License 2.0",
13 | "Apache Software License 2.0",
14 | "GNU LGPL v3.0",
15 | "GNU GPL v3.0"
16 | ],
17 | "create_docs": ["yes", "no"],
18 | "_copy_without_render": [".github/*"]
19 | }
20 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | python-cookiecutter.neuroinformatics.dev
2 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | %SPHINXBUILD% >NUL 2>NUL
14 | if errorlevel 9009 (
15 | echo.
16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17 | echo.installed, then set the SPHINXBUILD environment variable to point
18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
19 | echo.may add the Sphinx directory to PATH.
20 | echo.
21 | echo.If you don't have Sphinx installed, grab it from
22 | echo.https://www.sphinx-doc.org/
23 | exit /b 1
24 | )
25 |
26 | if "%1" == "" goto help
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | linkify-it-py
2 | myst-parser
3 | nbsphinx
4 | pydata-sphinx-theme
5 | setuptools-scm
6 | sphinx
7 | sphinx-autodoc-typehints
8 | sphinx-copybutton
9 | sphinx-design
10 | sphinx-gallery
11 | sphinx-notfound-page
12 | sphinx-sitemap
13 | sphinx-togglebutton
14 |
--------------------------------------------------------------------------------
/docs/source/_static/css/custom.css:
--------------------------------------------------------------------------------
1 | html[data-theme=dark] {
2 | --pst-color-primary: #04B46D;
3 | --pst-color-link: var(--pst-color-primary);
4 | }
5 |
6 | html[data-theme=light] {
7 | --pst-color-primary: #03A062;
8 | --pst-color-link: var(--pst-color-primary);
9 | }
10 |
11 | body .bd-article-container {
12 | max-width: 100em !important;
13 | }
14 |
15 | .col {
16 | flex: 0 0 50%;
17 | max-width: 50%;
18 | }
19 |
20 | .img-sponsor {
21 | height: 50px;
22 | padding-top: 5px;
23 | padding-right: 5px;
24 | padding-bottom: 5px;
25 | padding-left: 5px;
26 | }
27 |
28 | .things-in-a-row {
29 | display: flex;
30 | flex-wrap: wrap;
31 | justify-content: space-between;
32 | }
33 |
34 | /* grids to match theme colors */
35 | .sd-card-icon {
36 | color: var(--sd-color-primary);
37 | font-size: 1.5em;
38 | margin-bottom: 0.5rem;
39 | }
40 |
41 | .sd-card {
42 | padding: 1.5rem;
43 | transition: transform 0.2s;
44 | }
45 |
46 | .sd-card:hover {
47 | transform: translateY(-5px);
48 | }
49 |
50 | /* Ensuring content area uses full width when sidebar is hidden */
51 | .bd-page-width {
52 | max-width: 90% !important;
53 | }
54 |
55 | /* Hide sidebar on pages with hide-sidebar metadata */
56 | body[data-hide-sidebar="true"] .bd-sidebar-primary {
57 | display: none !important;
58 | }
59 |
60 | /* Expand content width when sidebar hidden */
61 | body[data-hide-sidebar="true"] .bd-main {
62 | flex-grow: 1;
63 | max-width: 75%;
64 | }
65 |
--------------------------------------------------------------------------------
/docs/source/_static/dark-logo-niu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/docs/source/_static/dark-logo-niu.png
--------------------------------------------------------------------------------
/docs/source/_static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/docs/source/_static/favicon.ico
--------------------------------------------------------------------------------
/docs/source/_static/light-logo-niu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/docs/source/_static/light-logo-niu.png
--------------------------------------------------------------------------------
/docs/source/_templates/footer_end.html:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/docs/source/_templates/footer_start.html:
--------------------------------------------------------------------------------
1 |
2 | {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
3 |
4 |
5 |
6 | {{ _("Built with the") }}
7 | PyData Sphinx Theme
8 | {{ theme_version }}.
9 |
10 |
--------------------------------------------------------------------------------
/docs/source/_templates/sidebar-nav.html:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | # conf.py
2 | # Configuration file for the Sphinx documentation builder.
3 | import setuptools_scm
4 |
5 |
6 | project = "python-cookiecutter"
7 | copyright = "2025, University College London"
8 | author = "Neuroinformatics Unit"
9 | try:
10 | full_version = setuptools_scm.get_version(root="../..", relative_to=__file__)
11 | # Splitting the release on '+' to remove the commit hash
12 | release = full_version.split('+', 1)[0]
13 | except LookupError:
14 | # if git is not initialised, still allow local build
15 | # with a dummy version
16 | release = "0.0.0"
17 |
18 | # -- General configuration ---------------------------------------------------
19 | extensions = [
20 | "myst_parser",
21 | "sphinx_design",
22 | "sphinx.ext.autodoc",
23 | "sphinx.ext.napoleon",
24 | "sphinx.ext.githubpages",
25 | "sphinx_autodoc_typehints",
26 | "sphinx.ext.autosummary",
27 | "sphinx.ext.viewcode",
28 | "sphinx.ext.intersphinx",
29 | "sphinx_sitemap",
30 | "nbsphinx",
31 | ]
32 |
33 | # Configure MyST Parser
34 | myst_enable_extensions = [
35 | "colon_fence",
36 | "deflist",
37 | "fieldlist",
38 | "html_admonition",
39 | "html_image",
40 | "linkify",
41 | "replacements",
42 | "smartquotes",
43 | "substitution",
44 | "tasklist",
45 | "attrs_inline"
46 | ]
47 |
48 | myst_heading_anchors = 4
49 |
50 | source_suffix = {
51 | '.md': 'markdown',
52 | '.rst': 'restructuredtext'
53 | }
54 |
55 | templates_path = ['_templates']
56 | exclude_patterns = [
57 | "**.ipynb_checkpoints",
58 | "**/includes/**",
59 | ]
60 |
61 | # -- HTML output options -----------------------------------------------------
62 | html_theme = 'pydata_sphinx_theme'
63 | html_logo = "_static/dark-logo-niu.png"
64 | html_static_path = ["_static"]
65 | html_title = "Python Cookiecutter"
66 | html_favicon = "_static/favicon.ico"
67 |
68 |
69 | html_theme_options = {
70 | "navbar_start": ["navbar-logo"],
71 | "navbar_center": ["navbar-nav"],
72 | "icon_links": [
73 | {
74 | "name": "GitHub",
75 | "url": "https://github.com/neuroinformatics-unit/python-cookiecutter",
76 | "icon": "fa-brands fa-github",
77 | "type": "fontawesome",
78 | },
79 | {
80 | "name": "Zulip (chat)",
81 | "url": "https://neuroinformatics.zulipchat.com/#narrow/channel/406003-Python-cookiecutter",
82 | "icon": "fa-solid fa-comments",
83 | "type": "fontawesome",
84 | },
85 | ],
86 | "logo": {
87 | "text": f"{project}",
88 | },
89 | "footer_start": ["footer_start"],
90 | "footer_end": ["footer_end"],
91 | "external_links": [],
92 | }
93 |
94 | # Sitemap configuration
95 | github_user = "neuroinformatics-unit"
96 | html_baseurl = "https://python-cookiecutter.neuroinformatics.dev"
97 | sitemap_url_scheme = "{link}"
98 |
99 |
100 | # -- HTML sidebar configuration ---------------------------------------------
101 | html_sidebars = {
102 | # Apply sidebar to ALL pages except index
103 | "**": ["sidebar-nav.html"],
104 | "index": []
105 | }
106 | html_show_sourcelink = False
107 |
108 |
109 | def setup(app):
110 | app.add_css_file("css/custom.css")
111 |
112 |
113 | # What to show on the 404 page
114 | notfound_context = {
115 | "title": "Page Not Found",
116 | "body": """
117 | Page Not Found
118 |
119 | Sorry, we couldn't find that page.
120 |
121 | We occasionally restructure the python-cookiecutter website, and some links may have broken.
122 |
123 | Try using the search box or go to the homepage.
124 | """,
125 | }
126 |
127 | # needed for GH pages (vs readthedocs),
128 | # because we have no '///' in the URL
129 | notfound_urls_prefix = None
130 |
131 | # The linkcheck builder will skip verifying that anchors exist when checking
132 | # these URLs
133 | linkcheck_anchors_ignore_for_url = [
134 | "https://neuroinformatics.zulipchat.com/",
135 | "https://neuroinformatics.zulipchat.com/#narrow/channel/406003-Python-cookiecutter",
136 | "https://github.com/pypa/setuptools_scm#default-versioning-scheme",
137 | ]
138 | # A list of regular expressions that match URIs that should not be checked
139 | linkcheck_ignore = [
140 | "https://github.com/",
141 | "https://opensource.org/license/bsd-3-clause/", # to avoid odd 403 error
142 | ]
143 |
--------------------------------------------------------------------------------
/docs/source/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Thank you for considering contributing to python-cookiecuttter! We welcome contributions that improve the project, whether it's code,
4 | documentation, or anything else.
5 |
6 | :::{note}
7 | To discuss contributing, you can join the [Zulip Channel](https://neuroinformatics.zulipchat.com/#narrow/channel/406003-Python-cookiecutter) here.
8 | :::
9 |
10 | Please follow the guidelines below to ensure a smooth process.
11 |
12 | 1. **Fork and Clone the Repository** Fork the main repository on
13 | GitHub, then clone your fork locally:
14 |
15 | ``` sh
16 | git clone https://github.com//python-cookiecutter.git
17 | cd python-cookiecutter
18 | ```
19 |
20 | 2. **Create a New Branch** Create and switch to a new branch for your
21 | changes:
22 |
23 | ``` sh
24 | git checkout -b my_new_feature
25 | ```
26 |
27 | 3. **Make Your Changes** Edit the content, code, or
28 | documentation as needed. When you're ready, add and commit your
29 | changes with a descriptive message:
30 |
31 | ``` sh
32 | git add .
33 | git commit -m "Describe your changes in short here"
34 | ```
35 |
36 | 4. **Push Your Branch and Create a Pull Request** Push the new branch
37 | to GitHub:
38 |
39 | ``` sh
40 | git push origin --set-upstream origin my_new_feature
41 | ```
42 |
43 | Then, open a pull request against the ``main`` branch of the main repository. This will automatically trigger a GitHub Action to verify that the builds correctly.
44 |
45 | 5. **Review and Merge** If the build checks pass, assign someone to review your pull request. Once approved and merged into the ``main`` branch, another GitHub Action will build and add your changes to the ``main`` branch.
46 |
47 |
48 | ## Documentation Local Testing
49 |
50 | If you are contributing to the Documentation, Before pushing your changes, you can test locally:
51 |
52 | - **First-Time Setup:** Install the required dependencies and build
53 | the docs:
54 |
55 | ``` sh
56 | pip install -r docs/requirements.txt
57 | sphinx-build docs/source docs/build
58 | ```
59 |
60 | Alternatively, you can use the following commands to install the
61 | dependencies and build the docs:
62 |
63 | ``` sh
64 | pip install -r docs/requirements.txt
65 | cd docs
66 | make html
67 | ```
68 |
69 | - **Rebuilding:** Each time you update the documentation,
70 | rebuild the docs by running:
71 |
72 | ``` sh
73 | rm -rf docs/build && sphinx-build docs/source docs/build
74 | ```
75 | or
76 |
77 | ```sh
78 | cd docs
79 | make clean && make html
80 | ```
81 |
82 | Then, open `docs/build/index.html` in your browser to preview the changes.
83 |
--------------------------------------------------------------------------------
/docs/source/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | hide-sidebar: true
3 | ---
4 |
5 | # python-cookiecutter
6 |
7 | A tool to automatically create a Python project structure ready to
8 | release via GitHub and [PyPI](https://pypi.org/).
9 |
10 | ## Getting Started
11 |
12 | **Python-cookiecutter** automatically creates a structured project and sets up essential
13 | tools, including:
14 |
15 | - A blank `README.md` file for documentation.
16 | - A `LICENSE` file to define usage rights.
17 | - [Pre-commit hooks](https://pre-commit.com/) to maintain code
18 | quality.
19 | - Automatic versioning with
20 | [setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/).
21 | - A test setup using [pytest](https://docs.pytest.org/en/7.0.x/).
22 | - Automated formatting, testing, and publishing via [GitHub
23 | Actions](https://github.com/features/actions).
24 | - A documentation setup with
25 | [Sphinx](https://www.sphinx-doc.org/en/master/).
26 |
27 |
28 | ::::{grid} 1 2 2 3
29 | :gutter: 3
30 | :class-container: sd-p-3
31 |
32 | :::{grid-item-card} {fas}`tools;sd-text-primary` Project Setup
33 | :link: project_setup
34 | :link-type: doc
35 | :text-align: center
36 |
37 | Installation and Setup
38 | :::
39 |
40 | :::{grid-item-card} {fas}`book-open;sd-text-primary` Infrastructure
41 | :link: infrastructure
42 | :link-type: doc
43 | :text-align: center
44 |
45 | Pre-commit hooks, Versioning, GitHub Actions & Documentation
46 | :::
47 |
48 | :::{grid-item-card} {fas}`handshake-angle;sd-text-primary` Contributing
49 | :link: contributing
50 | :link-type: doc
51 | :text-align: center
52 |
53 | How to improve the cookiecutter
54 | :::
55 | ::::
56 |
57 |
58 | ```{toctree}
59 | :maxdepth: 2
60 | :caption: Documentation
61 | :hidden:
62 |
63 | project_setup
64 | infrastructure
65 | contributing
66 | ```
67 |
--------------------------------------------------------------------------------
/docs/source/infrastructure.md:
--------------------------------------------------------------------------------
1 | # Infrastructure
2 |
3 | ## Tests
4 |
5 | Write your test methods and classes in the `test` folder. We are using [pytest](https://docs.pytest.org/en/7.2.x/getting-started.html).
6 | In your test module you can call your methods in a simple way:
7 |
8 | ```python
9 | # filename: test_math.py
10 | from my_awesome_software import math
11 |
12 | # here your test function
13 | ```
14 |
15 | If you're testing a small piece of code, make it a unit test. If you want to test whether two or more software units work well together, create an integration test.
16 |
17 | :::{important}
18 | Before committing your changes
19 | :::
20 |
21 | ### Run the tests
22 |
23 | Be sure that you have installed pytest and run it
24 | ```bash
25 | pip install pytest
26 | pytest
27 | ```
28 | You should also see coverage information.
29 |
30 | ### Install your package locally
31 |
32 | For a local, editable install, in the project directory, run:
33 | ```bash
34 | pip install -e .
35 | ```
36 |
37 | For a local, editable install with all the development tools (e.g. testing, formatting etc.) run:
38 | ```bash
39 | pip install -e '.[dev]'
40 | ```
41 |
42 | You might want to install your package in an _ad hoc_ environment.
43 |
44 | To test if the installation works, try to call your modules with python in another folder from the same environment.
45 | ```python
46 | from my_awesome_sofware.math import add_two_integers
47 | add_two_integers(1, 2)
48 | ```
49 |
50 | # Pre-commit hooks
51 |
52 | Running `pre-commit install` will set up [pre-commit hooks](https://pre-commit.com/) to ensure the code is
53 | formatted correctly. Currently, these are:
54 | * [ruff](https://github.com/charliermarsh/ruff) does a number of jobs, including linting, auto-formatting code (with `ruff-format`), and sorting import statements.
55 | * [mypy](https://mypy.readthedocs.io/en/stable/index.html) a static type checker
56 | * [check-manifest](https://github.com/mgedmin/check-manifest) to ensure that the right files are included in the pip package.
57 | * [codespell](https://github.com/codespell-project/codespell) to check for common misspellings.
58 |
59 |
60 | These will prevent code from being committed if any of these hooks fail. To run them individually:
61 | ```sh
62 | ruff check --fix # Lint all files in the current directory, and fix any fixable errors.
63 | ruff format # Format all files in the current directory.
64 | mypy -p my_awesome_software
65 | check-manifest
66 | codespell
67 | ```
68 |
69 | You can also execute all the hooks using
70 | ```sh
71 | pre-commit run
72 | ```
73 | or
74 | ```sh
75 | pre-commit run --all-files
76 | ```
77 |
78 | The best time to run this is after you have staged your changes, but before you commit them.
79 |
80 | In the case you see `mypy` failing with an error like `Library stubs not installed for this-package`, you do have to edit the `.pre-commit-config.yaml` file by adding the additional dependency to `mypy`:
81 | ``` sh
82 | - id: mypy
83 | additional_dependencies:
84 | - types-setuptools
85 | - types-this-package
86 | ```
87 |
88 | # Versioning
89 |
90 | We recommend the use of [semantic versioning](https://semver.org/), which uses a `MAJOR`.`MINOR`.`PATCH` versiong number where these mean:
91 |
92 | * PATCH = small bugfix
93 | * MINOR = new feature
94 | * MAJOR = breaking change
95 |
96 | ## Automated versioning
97 | [`setuptools_scm`](https://github.com/pypa/setuptools_scm) can be used to automatically version your package. It has been pre-configured in the `pyproject.toml` file. [`setuptools_scm` will automatically infer the version using git](https://github.com/pypa/setuptools_scm#default-versioning-scheme). To manually set a new semantic version, create a tag and make sure the tag is pushed to GitHub. Make sure you commit any changes you wish to be included in this version. E.g. to bump the version to `1.0.0`:
98 |
99 | ```sh
100 | git add .
101 | git commit -m "Add new changes"
102 | git tag -a v1.0.0 -m "Bump to version 1.0.0"
103 | git push --follow-tags
104 | ```
105 | :::{tip}
106 | It is also possible to perform this step by using the [GitHub web interface or CLI](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
107 | :::
108 |
109 | # GitHub actions workflow
110 |
111 | A GitHub actions workflow (`.github/workflows/test_and_deploy.yml`) has been set up to run (on each commit/PR):
112 | * Linting checks (pre-commit).
113 | * Testing (only if linting checks pass)
114 | * Release to PyPI (only if a git tag is present and if tests pass). Requires `TWINE_API_KEY` from PyPI to be set in repository secrets.
115 |
116 | This automation ensures that each commit or pull request is validated and that releases are published only when all checks pass.
117 |
118 | # Documentation
119 |
120 | Software documentation is important for effectively communicating how to use the software to others as well as to your future self.
121 |
122 | If you want to include documentation in your package, make sure to respond with `1 - Yes` when prompted during the `cookiecutter` setup. This will instantiate a `docs` folder with a skeleton documentation system, that you can build upon.
123 |
124 | The documentation source files are located in the `docs/source` folder and should be written in either [reStructuredText](https://docutils.sourceforge.io/rst.html) or [markdown](https://myst-parser.readthedocs.io/en/stable/syntax/typography.html). The `index.rst` file corresponds to the main page of the documentation website. Other `.rst` or `.md` files can be included in the main page via the `toctree` directive.
125 |
126 | The documentation is built using [Sphinx](https://www.sphinx-doc.org/en/master/) and the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/). The `docs/source/conf.py` file contains the `Sphinx` configuration.
127 |
128 | ## Building the documentation locally
129 | You can build and view the documentation website locally, on your machine. To do so, run the following commands from the root of your project:
130 |
131 | ```sh
132 | # Install the documentation build dependencies
133 | pip install -r docs/requirements.txt
134 | # Build the documentation
135 | sphinx-build docs/source docs/build
136 | ```
137 | This should create a `docs/build` folder. You can view the local build by opening `docs/build/index.html` in a browser.
138 | To refresh the documentation, after making changes, remove the `docs/build` folder and re-run the above command:
139 |
140 | ```sh
141 | rm -rf docs/build
142 | sphinx-build docs/source docs/build
143 | ```
144 |
145 | ## Publishing the documentation
146 | We have included an extra GitHub actions workflow in `.github/workflows/docs_build_and_deploy.yml` that will build the documentation and deploy it to [GitHub pages](https://pages.github.com/).
147 | * The build step is triggered every time a pull request is opened or a push is made to the `main` branch. This way you can make sure that the documentation does not break before merging your changes.
148 | * The deployment is triggered only when a tag is present (see [Automated versioning](#automated-versioning)). This ensures that new documentation versions are published in tandem with the release of a new package version on PyPI (see [GitHub actions workflow](#github-actions-workflow)).
149 | * The published docs are by default hosted at `https://.github.io//`. To enable hosting, you will need to go to the settings of your repository, and under the "Pages" section, select the `gh-pages` branch as the source for your GitHub pages site.
150 | * A popular alternative to GitHub pages for hosting the documentation is [Read the Docs](https://readthedocs.org/). To enable hosting on Read the Docs, you will need to create an account on the website and follow the instructions to link your GitHub repository to your Read the Docs account.
151 |
152 | ## Docstrings and API documentation
153 | The journey towards good documentation starts with writing docstrings for all functions in your module code. In the example `math.py` and `greetings.py` modules you will find some docstrings that you can use as a template. We have written the example docstrings following the [numpy style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html) but you may also choose another widely used style, such as the [Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).
154 |
155 | Once you have written docstrings for all your functions, API documentation can be automatically generated via the [Sphinx autodoc extension](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html). We have given examples of how to do this in the `docs/source/api_index.rst` file.
156 |
--------------------------------------------------------------------------------
/docs/source/project_setup.md:
--------------------------------------------------------------------------------
1 | # Project Setup
2 |
3 | This section describes how to set up your project using cookiecutter.
4 |
5 | ## Installation & Setup
6 |
7 | First, install cookiecutter in your desired environment. Running in the terminal in your environment:
8 |
9 | :::{note}
10 | You must have Python installed to use Cookiecutter
11 | :::
12 |
13 | using pip or conda:
14 |
15 | ::::{tab-set}
16 | :::{tab-item} pip
17 | Install using pip
18 | ```sh
19 | pip install cookiecutter
20 | ```
21 | :::
22 | :::{tab-item} conda
23 | Install using conda
24 | ```sh
25 | conda install -c conda-forge cookiecutter
26 | ```
27 | :::
28 | ::::
29 |
30 |
31 | ## Creating a Cookiecutter Project
32 |
33 | In the folder or directory, you want to create the project:
34 |
35 |
36 | Then Run the following command:
37 |
38 | ```sh
39 | cookiecutter https://github.com/neuroinformatics-unit/python-cookiecutter
40 | ```
41 |
42 | You will be then asked a series of questions about how you want to set up your project.
43 |
44 | For each one, type your answer, enter a single number (or just hit return) to choose from a default option.
45 |
46 | such as:
47 |
48 |
49 | * `full_name [Python developer]:` - e.g. `Adam Tyson`
50 | * `email [yourname@example.com]:` - e.g. `cookiecutter@adamltyson.com`
51 | * `github_username_or_organization [githubuser]:` - e.g. `adamltyson`
52 | * `package_name [python-package]:` - e.g. `my-awesome-software`
53 | * `Select github_repository_url:` - Default will be e.g. `https://github.com//my-awesome-software`, but you can also provide this later.
54 | * `module_name [my_awesome_software]:` - The default will be the same as `package_name` but with hyphens converted to underscores.
55 | * `short_description [A simple Python package]:` - Enter a simple, one-line description of your Python package.
56 | * `Select license:` - choose from:
57 | - `1 - BSD-3`
58 | - `2 - MIT`
59 | - `3 - Mozilla Public License 2.0`
60 | - `4 - Apache Software License 2.0`
61 | - `5 - GNU LGPL v3.0`
62 | - `6 - GNU GPL v3.0`
63 | * `Select create_docs:` - Whether to generate documentation using [Sphinx](https://www.sphinx-doc.org/en/master/), choose from:
64 | - `1 - Yes`
65 | - `2 - No`
66 |
67 | This is the structure cookiecutter will create:
68 | ```
69 | └── my-awesome-software/
70 | ├── LICENSE
71 | ├── MANIFEST.in
72 | ├── README.md
73 | ├── pyproject.toml
74 | ├── tox.ini
75 | ├── my_awesome_software/
76 | │ └── __init__.py
77 | └── tests/
78 | ├── __init__.py
79 | ├── test_integration/
80 | │ └── __init__.py
81 | └── test_unit/
82 | ├── __init__.py
83 | └── test_placeholder.py
84 | ```
85 |
86 | A project with this information will then be written to the current working directory.
87 |
88 | :::{important}
89 | If you respond positively to `Select create_docs:`, an additional `docs` folder will be created and two example Python modules (`math.py` and `greetings.py`) will be added to the above structure.
90 | :::
91 |
92 | ```
93 | └── my-awesome-software/
94 | └── docs/
95 | ├── make.bat
96 | ├── Makefile
97 | ├── requirements.txt
98 | └── source/
99 | ├── api_index.rst
100 | ├── conf.py
101 | ├── getting_started.md
102 | └── index.rst
103 | └── my_awesome_software/
104 | ├── __init__.py
105 | ├── greetings.py
106 | └── math.py
107 | ```
108 |
109 | ## Creating a GitHub Repository
110 |
111 | 1. **Sign In to GitHub:** Visit [GitHub](https://github.com) and sign in with your account.
112 |
113 |
114 | 2. **Create a New Repository:**
115 |
116 | - Click on the **+** icon in the upper-right corner of the page and select **New repository**.
117 | - Alternatively, you can navigate directly to: [New Repository](https://github.com/new)
118 |
119 | 3. **Fill in Repository Details:**
120 |
121 | - **Repository Name:** Enter a name for your project (e.g: ``my-awesome-software``).
122 | - **Description:** Optionally, provide a short description of your project.
123 | - **Repository Visibility:** Choose between **Public** or **Private**.
124 |
125 | - **Initialize Repository:** You may leave the repository empty (without a README, .gitignore, or license) if you plan to push your existing local project. If you prefer, you can initialize it with a README file.
126 |
127 | :::{warning}
128 | If you initialize with a README, you will need to pull those changes before pushing your local repository.
129 | :::
130 |
131 | 4. **Create the Repository:** Click the **Create repository** button. GitHub will then create your new repository and provide you
132 | with the repository URL (e.g.``https://github.com/your-username/my-awesome-software.git``).
133 |
134 | ## Initializing a Git Repository
135 |
136 | :::{note}
137 | When creating a cookiecutter project, it asks for a GitHub username or organization and package name. However this does not initialize a git repository.
138 | :::
139 |
140 | Navigate to your project folder and initialize git:
141 |
142 | ```sh
143 | cd my-awesome-software
144 | ```
145 | ```sh
146 | git init -b main
147 | ```
148 |
149 | If you're using an older Git version (``<2.28``), use:
150 |
151 | ```sh
152 | git init
153 | ```
154 | ```sh
155 | git checkout -b main
156 | ```
157 |
158 | Then, add and commit your changes:
159 |
160 | ```sh
161 | git add .
162 | ```
163 | ```sh
164 | git commit -m "Initial commit"
165 | ```
166 |
167 | Finally, add the remote origin and push to GitHub:
168 |
169 | ```sh
170 | git remote add origin https://github.com//my-awesome-software.git
171 | ```
172 | ```sh
173 | git push --set-upstream origin main
174 | ```
175 | That\'s it! Your project is now set up and ready to go. 🚀
176 |
177 | # Modules
178 |
179 | Your methods and classes would live inside the folder `my_awesome_software`. Split the functionalities into modules, and save them as `.py` files, e.g.:
180 | ```
181 | my_awesome_software
182 | ├── __init__.py
183 | ├── greetings.py
184 | └── math.py
185 | ```
186 |
187 | If you want to import methods and classes from one module to another you can use the dot:
188 | ```python
189 | # filename: greetings.py
190 | from .math import subtract_two_integers
191 | ```
192 |
193 | If you want to import all the modules when installing you can add the following to your `__init__.py`:
194 | ```python
195 | from . import *
196 | ```
197 |
198 | ## Add dependencies
199 | To ensure any dependencies are installed at the same time as installing
200 | your package, add them to your `pyproject.toml` file. E.g. to add `numpy`
201 | and `pandas` as dependencies, add them to the `dependencies = []` list under
202 | the `[project]` heading:
203 |
204 | ```toml
205 | dependencies = ["numpy", "pandas"]
206 | ```
207 |
--------------------------------------------------------------------------------
/hooks/post_gen_project.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 |
4 | create_docs = "{{ cookiecutter.create_docs }}"
5 | module_name = "{{ cookiecutter.module_name }}"
6 |
7 | if __name__ == "__main__":
8 | if create_docs != "yes":
9 | shutil.rmtree("docs", ignore_errors=True)
10 | os.remove(".github/workflows/docs_build_and_deploy.yml")
11 | os.remove(f"{module_name}/greetings.py")
12 | os.remove(f"{module_name}/math.py")
13 | shutil.rmtree("licenses", ignore_errors=True)
14 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.ruff]
2 | line-length = 79
3 | exclude = ["__init__.py", "build", ".eggs"]
4 | lint.select = ["I", "E", "F"]
5 | fix = true
6 |
7 | [tool.ruff.format]
8 | docstring-code-format = true # Also format code in docstrings
9 |
10 | [tool.codespell]
11 | # Ref: https://github.com/codespell-project/codespell#using-a-config-file
12 | skip = '.git'
13 | check-hidden = true
14 | # ignore-regex = ''
15 | # ignore-words-list = ''
16 |
--------------------------------------------------------------------------------
/tests/test_cookiecutter.py:
--------------------------------------------------------------------------------
1 | import os
2 | import platform
3 | import subprocess
4 | from pathlib import Path
5 |
6 | import pytest
7 | import toml
8 | import yaml
9 |
10 | # dependencies
11 | # pyyaml
12 | # cookiecutter
13 | # pytest
14 | # toml
15 |
16 | COOKIECUTTER_DIR = Path(__file__).parent.parent
17 | CONFIG_FILENAME = COOKIECUTTER_DIR / "tests" / "cookiecutter_test_configs.yaml"
18 |
19 |
20 | def create_test_configs(create_docs):
21 | """
22 | Dynamically create the config file for each test,
23 | to test different settings.
24 |
25 | NOTE:
26 | Need to be very careful with input to lists.
27 | If the option is not one of default options in the
28 | cookiecutter list, it will silently fail and just
29 | use the defaults.
30 | """
31 | test_dict = {
32 | "default_context": {
33 | "full_name": "Test Cookiecutter",
34 | "email": "testing@cookiecutter.com",
35 | "github_username_or_organization": "test_cookiecutter_username",
36 | "package_name": "test-cookiecutter",
37 | "github_repository_url": "https://github.com/"
38 | "{{cookiecutter.github_username_or_organization}}/"
39 | "{{cookiecutter.package_name}}",
40 | "module_name": "test_cookiecutter_module",
41 | "short_description": "Lets Test CookieCutter",
42 | "license": "MIT",
43 | "create_docs": "yes" if create_docs else "no",
44 | },
45 | }
46 | with open(CONFIG_FILENAME, "w") as config_file:
47 | yaml.dump(test_dict, config_file, sort_keys=False)
48 |
49 | return test_dict["default_context"]
50 |
51 |
52 | def load_pyproject_toml(package_path):
53 | """
54 | Load the pyproject.toml file from the
55 | created cookiecutter to check.
56 | """
57 | pyproject_path = package_path / "pyproject.toml"
58 | project_toml = toml.load(pyproject_path.as_posix())
59 | return project_toml
60 |
61 |
62 | def run_cookiecutter():
63 | """
64 | Run the cookiecutter to create the test
65 | project folder
66 | """
67 | subprocess.run(
68 | f"cookiecutter {COOKIECUTTER_DIR} "
69 | f"--config-file {CONFIG_FILENAME} "
70 | f"--no-input",
71 | shell=True,
72 | )
73 |
74 |
75 | @pytest.fixture(scope="function")
76 | def package_path_config_dict(tmp_path):
77 | """
78 | Fixture to build a cookiecutter project
79 | """
80 | config_dict = create_test_configs(create_docs=False)
81 |
82 | os.chdir(tmp_path)
83 |
84 | run_cookiecutter()
85 |
86 | package_path = tmp_path / config_dict["package_name"]
87 |
88 | return package_path, config_dict
89 |
90 |
91 | @pytest.fixture(scope="function")
92 | def pip_install(package_path_config_dict):
93 | """
94 | Fixture to build a cookiecutter project and
95 | install with pip
96 | """
97 | package_path, config_dict = package_path_config_dict
98 |
99 | uninstall_cmd = f"pip uninstall -y {config_dict['package_name']}"
100 | dev_formatting = ".[dev]" if platform.system() == "Windows" else "'.[dev]'"
101 | install_cmd = f"pip install -e {dev_formatting}"
102 |
103 | # Installs the package using pip
104 | os.chdir(package_path)
105 |
106 | # Uninstall and check package not installed
107 | subprocess.run("git init", shell=True)
108 |
109 | subprocess.run(uninstall_cmd, shell=True)
110 | result = subprocess.Popen(
111 | f"pip show {config_dict['package_name']}",
112 | shell=True,
113 | stderr=subprocess.PIPE,
114 | )
115 | __, stderr = result.communicate()
116 | assert (
117 | f"WARNING: Package(s) not found: "
118 | f"{config_dict['package_name']}" in stderr.decode("utf8")
119 | )
120 |
121 | # Install package
122 | subprocess.run(install_cmd, shell=True)
123 | yield config_dict
124 |
125 | # Uninstall package
126 | subprocess.run(uninstall_cmd, shell=True)
127 |
128 |
129 | def test_directory_names(package_path_config_dict):
130 | """
131 | Check that all expected directories are present
132 | in the created cookiecutter project
133 | """
134 | package_path = package_path_config_dict[0]
135 |
136 | assert package_path.exists()
137 |
138 | expected = [
139 | # Files
140 | ".github",
141 | ".gitignore",
142 | ".pre-commit-config.yaml",
143 | "LICENSE",
144 | "MANIFEST.in",
145 | "pyproject.toml",
146 | "README.md",
147 | Path("test_cookiecutter_module") / "__init__.py",
148 | # Directories
149 | "test_cookiecutter_module",
150 | "tests",
151 | ]
152 |
153 | for f in expected:
154 | assert (package_path / f).exists()
155 |
156 |
157 | def test_docs(package_path_config_dict):
158 | """
159 | Test that all files and configurations related
160 | to creating docs in the cookiecutter are
161 | set properly. First, check they are
162 | not set when docs are not created.
163 | Then, make a new cookiecutter project
164 | with docs and check all expected configs are there.
165 |
166 | NOTE:
167 | This assumes docs are not created by
168 | default in the fixture. So, the tests
169 | to check when creating a project
170 | with docs must come second.
171 | """
172 | package_path, config_dict = package_path_config_dict
173 |
174 | for true_if_create_docs in [False, True]:
175 | import shutil
176 |
177 | if true_if_create_docs:
178 | config_dict = create_test_configs(create_docs=True)
179 | shutil.rmtree(package_path)
180 | run_cookiecutter()
181 |
182 | assert (
183 | package_path / ".github/workflows/docs_build_and_deploy.yml"
184 | ).exists() is true_if_create_docs
185 | assert (package_path / "docs").exists() is true_if_create_docs
186 | assert (
187 | package_path / f"{config_dict['module_name']}/greetings.py"
188 | ).exists() is true_if_create_docs
189 | assert (
190 | package_path / f"{config_dict['module_name']}/math.py"
191 | ).exists() is true_if_create_docs
192 |
193 | with open(package_path / ".pre-commit-config.yaml") as file:
194 | line = file.read().splitlines()[0]
195 |
196 | assert (
197 | line == "exclude: 'conf.py'" if true_if_create_docs else line == ""
198 | )
199 |
200 | project_toml = load_pyproject_toml(package_path)
201 |
202 | assert (
203 | "github.io" in project_toml["project"]["urls"]["Documentation"]
204 | ) is true_if_create_docs
205 |
206 |
207 | def test_pyproject_toml(package_path_config_dict):
208 | """
209 | Check that all entries in the pyproject.toml
210 | of the created cookiecutter project match
211 | these settings specified (in --config-file)
212 | """
213 | package_path, config_dict = package_path_config_dict
214 |
215 | project_toml = load_pyproject_toml(package_path)
216 |
217 | assert project_toml["project"]["name"] == config_dict["package_name"]
218 |
219 | # some of these are hard coded from the cookiecutter
220 | # pyproject.toml has not asked user for
221 | assert (
222 | project_toml["project"]["authors"][0]["name"]
223 | == config_dict["full_name"]
224 | )
225 | assert (
226 | project_toml["project"]["authors"][0]["email"] == config_dict["email"]
227 | )
228 | assert project_toml["project"]["description"] == "Lets Test CookieCutter"
229 | assert project_toml["project"]["readme"] == "README.md"
230 | assert project_toml["project"]["requires-python"] == ">=3.11.0"
231 | assert (
232 | project_toml["project"]["license"]["text"] == "MIT"
233 | ) # parameterize this? test if url not given?
234 |
235 | assert project_toml["project"]["classifiers"] == [
236 | "Development Status :: 2 - Pre-Alpha",
237 | "Programming Language :: Python",
238 | "Programming Language :: Python :: 3",
239 | "Programming Language :: Python :: 3.11",
240 | "Programming Language :: Python :: 3.12",
241 | "Programming Language :: Python :: 3.13",
242 | "Operating System :: OS Independent",
243 | "License :: OSI Approved :: MIT License",
244 | ]
245 |
246 | test_repo_url = (
247 | f"https://github.com/"
248 | f"{config_dict['github_username_or_organization']}/"
249 | f"{config_dict['package_name']}"
250 | )
251 |
252 | assert project_toml["project"]["urls"]["Homepage"] == test_repo_url
253 |
254 | assert (
255 | project_toml["project"]["urls"]["Bug Tracker"]
256 | == test_repo_url + "/issues"
257 | )
258 |
259 | assert project_toml["project"]["urls"]["Source Code"] == test_repo_url
260 | assert (
261 | project_toml["project"]["urls"]["User Support"]
262 | == test_repo_url + "/issues"
263 | )
264 |
265 | assert len(project_toml["project"]["optional-dependencies"].keys()) == 1
266 |
267 | assert project_toml["project"]["optional-dependencies"]["dev"] == [
268 | "pytest",
269 | "pytest-cov",
270 | "coverage",
271 | "tox",
272 | "mypy",
273 | "pre-commit",
274 | "ruff",
275 | "setuptools-scm",
276 | ]
277 |
278 | assert project_toml["build-system"]["requires"] == [
279 | "setuptools>=64",
280 | "wheel",
281 | "setuptools-scm[toml]>=8",
282 | ]
283 |
284 | assert (
285 | project_toml["build-system"]["build-backend"]
286 | == "setuptools.build_meta"
287 | )
288 |
289 | assert project_toml["tool"]["setuptools"]["packages"]["find"][
290 | "include"
291 | ] == [config_dict["module_name"] + "*"]
292 |
293 | assert (
294 | project_toml["tool"]["pytest"]["ini_options"]["addopts"]
295 | == f"--cov={config_dict['module_name']}"
296 | )
297 | assert project_toml["tool"]["ruff"]
298 |
299 | assert "legacy_tox_ini" in project_toml["tool"]["tox"]
300 |
301 | assert project_toml["tool"]["codespell"]["skip"] == ".git"
302 | assert project_toml["tool"]["codespell"]["check-hidden"] is True
303 |
304 |
305 | def test_pip_install(pip_install):
306 | config_dict = pip_install
307 |
308 | result = subprocess.Popen(
309 | f"pip show {config_dict['package_name']}",
310 | shell=True,
311 | stdout=subprocess.PIPE,
312 | )
313 | stdout, __ = result.communicate()
314 |
315 | # Home-page is not in pip show output...
316 | show_details = stdout.decode("utf8")
317 | assert "Name: test-cookiecutter" in show_details
318 | assert "Version: 0.1.dev0" in show_details
319 | assert "Summary: Lets Test CookieCutter" in show_details
320 | assert (
321 | "Author-email: Test Cookiecutter "
322 | in show_details
323 | )
324 | assert "License: MIT" in show_details
325 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/.github/workflows/docs_build_and_deploy.yml:
--------------------------------------------------------------------------------
1 | name: Build Sphinx docs and deploy to GitHub Pages
2 |
3 | # Generate the documentation on all merges to main, all pull requests, or by
4 | # manual workflow dispatch. The build job can be used as a CI check that the
5 | # docs still build successfully. The deploy job only runs when a tag is
6 | # pushed and actually moves the generated html to the gh-pages branch
7 | # (which triggers a GitHub pages deployment).
8 | on:
9 | push:
10 | branches:
11 | - main
12 | tags:
13 | - '*'
14 | pull_request:
15 | workflow_dispatch:
16 |
17 |
18 | jobs:
19 | linting:
20 | # scheduled workflows should not run on forks
21 | if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
22 | runs-on: ubuntu-latest
23 | steps:
24 | - uses: neuroinformatics-unit/actions/lint@v2
25 |
26 | build_sphinx_docs:
27 | name: Build Sphinx Docs
28 | runs-on: ubuntu-latest
29 | steps:
30 | - uses: neuroinformatics-unit/actions/build_sphinx_docs@v2
31 |
32 | deploy_sphinx_docs:
33 | name: Deploy Sphinx Docs
34 | needs: build_sphinx_docs
35 | permissions:
36 | contents: write
37 | if: github.event_name == 'push' && github.ref_type == 'tag'
38 | runs-on: ubuntu-latest
39 | steps:
40 | - uses: neuroinformatics-unit/actions/deploy_sphinx_docs@v2
41 | with:
42 | secret_input: ${{ secrets.GITHUB_TOKEN }}
43 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/.github/workflows/test_and_deploy.yml:
--------------------------------------------------------------------------------
1 | name: tests
2 |
3 | on:
4 | push:
5 | branches:
6 | - '*'
7 | tags:
8 | - '*'
9 | pull_request:
10 |
11 | jobs:
12 | linting:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: neuroinformatics-unit/actions/lint@v2
16 |
17 | manifest:
18 | name: Check Manifest
19 | runs-on: ubuntu-latest
20 | steps:
21 | - uses: neuroinformatics-unit/actions/check_manifest@v2
22 |
23 | test:
24 | needs: [linting, manifest]
25 | name: ${{ matrix.os }} py${{ matrix.python-version }}
26 | runs-on: ${{ matrix.os }}
27 | strategy:
28 | matrix:
29 | # Run all supported Python versions on linux
30 | python-version: ["3.11", "3.12", "3.13"]
31 | os: [ubuntu-latest]
32 | # Include one windows and macos run
33 | include:
34 | - os: macos-latest
35 | python-version: "3.13"
36 | - os: windows-latest
37 | python-version: "3.13"
38 |
39 | steps:
40 | # Run tests
41 | - uses: neuroinformatics-unit/actions/test@v2
42 | with:
43 | python-version: ${{ matrix.python-version }}
44 |
45 | build_sdist_wheels:
46 | name: Build source distribution
47 | needs: [test]
48 | if: github.event_name == 'push' && github.ref_type == 'tag'
49 | runs-on: ubuntu-latest
50 | steps:
51 | - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2
52 |
53 |
54 | upload_all:
55 | name: Publish build distributions
56 | needs: [build_sdist_wheels]
57 | runs-on: ubuntu-latest
58 | steps:
59 | - uses: neuroinformatics-unit/actions/upload_pypi@v2
60 | with:
61 | secret-pypi-key: ${{ secrets.TWINE_API_KEY }}
62 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_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 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 |
27 | # PyInstaller
28 | # Usually these files are written by a python script from a template
29 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
30 | *.manifest
31 | *.spec
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *,cover
46 | .hypothesis/
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 | local_settings.py
55 |
56 | # Flask instance folder
57 | instance/
58 |
59 | # Sphinx documentation
60 | docs/_build/
61 |
62 | # MkDocs documentation
63 | /site/
64 |
65 | # PyBuilder
66 | target/
67 |
68 | # Pycharm and VSCode
69 | .idea/
70 | venv/
71 | .vscode/
72 |
73 | # IPython Notebook
74 | .ipynb_checkpoints
75 |
76 | # pyenv
77 | .python-version
78 |
79 | # OS
80 | .DS_Store
81 |
82 | # written by setuptools_scm
83 | **/_version.py
84 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | {% if cookiecutter.create_docs == "yes" -%}
2 | exclude: 'conf.py'
3 | {%- endif %}
4 |
5 | # Configuring https://pre-commit.ci/
6 | ci:
7 | autoupdate_schedule: monthly
8 |
9 | repos:
10 | - repo: https://github.com/pre-commit/pre-commit-hooks
11 | rev: v5.0.0
12 | hooks:
13 | - id: check-docstring-first
14 | - id: check-executables-have-shebangs
15 | - id: check-merge-conflict
16 | - id: check-toml
17 | - id: end-of-file-fixer
18 | - id: mixed-line-ending
19 | args: [--fix=lf]
20 | - id: requirements-txt-fixer
21 | - id: trailing-whitespace
22 | - repo: https://github.com/astral-sh/ruff-pre-commit
23 | rev: v0.11.12
24 | hooks:
25 | - id: ruff
26 | args: [ --config=pyproject.toml ]
27 | - id: ruff-format
28 | args: [ --config=pyproject.toml ]
29 | - repo: https://github.com/pre-commit/mirrors-mypy
30 | rev: v1.13.0
31 | hooks:
32 | - id: mypy
33 | additional_dependencies:
34 | - types-setuptools
35 | - repo: https://github.com/mgedmin/check-manifest
36 | rev: "0.50"
37 | hooks:
38 | - id: check-manifest
39 | args: [--no-build-isolation]
40 | additional_dependencies: [setuptools-scm, wheel]
41 | - repo: https://github.com/codespell-project/codespell
42 | # Configuration for codespell is in pyproject.toml
43 | rev: v2.4.1
44 | hooks:
45 | - id: codespell
46 | additional_dependencies:
47 | - tomli
48 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/LICENSE:
--------------------------------------------------------------------------------
1 | {%- if cookiecutter.license == "MIT" -%}
2 | {%- include 'licenses/MIT' %}
3 | {%- elif cookiecutter.license == "BSD-3" -%}
4 | {%- include 'licenses/BSD-3' %}
5 | {%- elif cookiecutter.license == "GNU GPL v3.0" -%}
6 | {%- include 'licenses/GPL-3' %}
7 | {%- elif cookiecutter.license == "GNU LGPL v3.0" -%}
8 | {%- include 'licenses/LGPL-3' %}
9 | {%- elif cookiecutter.license == "Apache Software License 2.0" -%}
10 | {%- include 'licenses/Apache-2' %}
11 | {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%}
12 | {%- include 'licenses/MPL-2' %}
13 | {%- endif -%}
14 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include LICENSE
2 | include README.md
3 | exclude .pre-commit-config.yaml
4 |
5 | recursive-exclude * __pycache__
6 | recursive-exclude * *.py[co]
7 | recursive-exclude docs *
8 | recursive-exclude tests *
9 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/README.md:
--------------------------------------------------------------------------------
1 | # {{cookiecutter.package_name}}
2 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | %SPHINXBUILD% >NUL 2>NUL
14 | if errorlevel 9009 (
15 | echo.
16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17 | echo.installed, then set the SPHINXBUILD environment variable to point
18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
19 | echo.may add the Sphinx directory to PATH.
20 | echo.
21 | echo.If you don't have Sphinx installed, grab it from
22 | echo.https://www.sphinx-doc.org/
23 | exit /b 1
24 | )
25 |
26 | if "%1" == "" goto help
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | linkify-it-py
2 | myst-parser
3 | nbsphinx
4 | pydata-sphinx-theme
5 | setuptools-scm
6 | sphinx
7 | sphinx-autodoc-typehints
8 | sphinx-sitemap
9 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/source/api_index.rst:
--------------------------------------------------------------------------------
1 | API
2 | ===
3 |
4 | math
5 | ----
6 |
7 | .. currentmodule:: {{cookiecutter.module_name}}.math
8 |
9 | .. autosummary::
10 | :toctree: api_generated
11 | :template: function.rst
12 |
13 | add_two_integers
14 | subtract_two_integers
15 |
16 | greetings
17 | ---------
18 |
19 | .. currentmodule:: {{cookiecutter.module_name}}.greetings
20 |
21 | .. autosummary::
22 | :toctree: api_generated
23 | :template: class.rst
24 |
25 | Greetings
26 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # For the full list of built-in configuration values, see the documentation:
4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
5 |
6 | # -- Project information -----------------------------------------------------
7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8 |
9 | import os
10 | import sys
11 |
12 | import setuptools_scm
13 |
14 | # Used when building API docs, put the dependencies
15 | # of any class you are documenting here
16 | autodoc_mock_imports = []
17 |
18 | # Add the module path to sys.path here.
19 | # If the directory is relative to the documentation root,
20 | # use os.path.abspath to make it absolute, like shown here.
21 | sys.path.insert(0, os.path.abspath("../.."))
22 |
23 | project = "{{cookiecutter.package_name}}"
24 | copyright = "2022, {{cookiecutter.full_name}}"
25 | author = "{{cookiecutter.full_name}}"
26 | try:
27 | release = setuptools_scm.get_version(root="../..", relative_to=__file__)
28 | except LookupError:
29 | # if git is not initialised, still allow local build
30 | # with a dummy version
31 | release = "0.0.0"
32 |
33 | # -- General configuration ---------------------------------------------------
34 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
35 |
36 | extensions = [
37 | "sphinx.ext.napoleon",
38 | "sphinx.ext.autodoc",
39 | "sphinx.ext.githubpages",
40 | "sphinx_autodoc_typehints",
41 | "sphinx.ext.autosummary",
42 | "sphinx.ext.viewcode",
43 | "sphinx.ext.intersphinx",
44 | "sphinx_sitemap",
45 | "myst_parser",
46 | "nbsphinx",
47 | ]
48 |
49 | # Configure the myst parser to enable cool markdown features
50 | # See https://sphinx-design.readthedocs.io
51 | myst_enable_extensions = [
52 | "amsmath",
53 | "colon_fence",
54 | "deflist",
55 | "dollarmath",
56 | "fieldlist",
57 | "html_admonition",
58 | "html_image",
59 | "linkify",
60 | "replacements",
61 | "smartquotes",
62 | "strikethrough",
63 | "substitution",
64 | "tasklist",
65 | ]
66 | # Automatically add anchors to markdown headings
67 | myst_heading_anchors = 3
68 |
69 | # Add any paths that contain templates here, relative to this directory.
70 | templates_path = ["_templates"]
71 |
72 | # Automatically generate stub pages for API
73 | autosummary_generate = True
74 | autodoc_default_flags = ["members", "inherited-members"]
75 |
76 | # List of patterns, relative to source directory, that match files and
77 | # directories to ignore when looking for source files.
78 | # This pattern also affects html_static_path and html_extra_path.
79 | exclude_patterns = [
80 | "**.ipynb_checkpoints",
81 | # to ensure that include files (partial pages) aren't built, exclude them
82 | # https://github.com/sphinx-doc/sphinx/issues/1965#issuecomment-124732907
83 | "**/includes/**",
84 | ]
85 |
86 | # -- Options for HTML output -------------------------------------------------
87 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
88 | html_theme = "pydata_sphinx_theme"
89 | html_title = "{{cookiecutter.package_name}}"
90 |
91 | # Customize the theme
92 | html_theme_options = {
93 | "icon_links": [
94 | {
95 | # Label for this link
96 | "name": "GitHub",
97 | # URL where the link will redirect
98 | "url": "{{ cookiecutter.github_repository_url }}", # required
99 | # Icon class (if "type": "fontawesome"),
100 | # or path to local image (if "type": "local")
101 | "icon": "fa-brands fa-github",
102 | # The type of image to be used (see below for details)
103 | "type": "fontawesome",
104 | }
105 | ],
106 | "logo": {
107 | "text": f"{project} v{release}",
108 | },
109 | }
110 |
111 | # Redirect the webpage to another URL
112 | # Sphinx will create the appropriate CNAME file in the build directory
113 | # The default is the URL of the GitHub pages
114 | # https://www.sphinx-doc.org/en/master/usage/extensions/githubpages.html
115 | github_user = "{{cookiecutter.github_username_or_organization}}"
116 | html_baseurl = f"https://{github_user}.github.io/{project}"
117 | sitemap_url_scheme = "{link}"
118 |
119 | # Add any paths that contain custom static files (such as style sheets) here,
120 | # relative to this directory. They are copied after the builtin static files,
121 | # so a file named "default.css" will overwrite the builtin "default.css".
122 | # html_static_path = ['_static']
123 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/source/getting_started.md:
--------------------------------------------------------------------------------
1 | # Getting started
2 |
3 | Here you may demonstrate the basic functionalities your package.
4 |
5 | You can include code snippets using the usual Markdown syntax:
6 |
7 | ```python
8 | from my_package import my_function
9 |
10 | result = my_function()
11 | ```
12 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | .. {{cookiecutter.package_name}} documentation master file, created by
2 | sphinx-quickstart on Fri Dec 9 14:12:42 2022.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to {{cookiecutter.package_name}}'s documentation!
7 | =========================================================
8 |
9 | .. toctree::
10 | :maxdepth: 2
11 | :caption: Contents:
12 |
13 | getting_started
14 | api_index
15 |
16 | By default the documentation includes the following sections:
17 |
18 | * Getting started. Here you could describe the basic functionalities of your package. To modify this page, edit the file ``docs/source/getting_started.md``.
19 | * API: here you can find the auto-generated documentation of your package, which is based on the docstrings in your code. To modify which modules/classes/functions are included in the API documentation, edit the file ``docs/source/api_index.rst``.
20 |
21 | You can create additional sections with narrative documentation,
22 | by adding new ``.md`` or ``.rst`` files to the ``docs/source`` folder.
23 | These files should start with a level-1 (H1) header,
24 | which will be used as the section title. Sub-sections can be created
25 | with lower-level headers (H2, H3, etc.) within the same file.
26 |
27 | To include a section in the rendered documentation,
28 | add it to the ``toctree`` directive in this (``docs/source/index.rst``) file.
29 |
30 | For example, you could create a ``docs/source/installation.md`` file
31 | and add it to the ``toctree`` like this:
32 |
33 | .. code-block:: rst
34 |
35 | .. toctree::
36 | :maxdepth: 2
37 | :caption: Contents:
38 |
39 | getting_started
40 | installation
41 | api_index
42 |
43 | Index & Search
44 | --------------
45 | * :ref:`genindex`
46 | * :ref:`search`
47 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/Apache-2:
--------------------------------------------------------------------------------
1 | {#- source: http://www.apache.org/licenses/LICENSE-2.0 #}
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "{}"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright {yyyy} {name of copyright owner}
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/BSD-3:
--------------------------------------------------------------------------------
1 | {#- source: http://opensource.org/licenses/BSD-3-Clause #}
2 | Copyright (c) {% now 'utc', '%Y' %}, {{cookiecutter.full_name}}
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | * Neither the name of {{ cookiecutter.package_name }} nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/GPL-3:
--------------------------------------------------------------------------------
1 | {# source: http://www.gnu.org/licenses/gpl-3.0.txt #}
2 | GNU GENERAL PUBLIC LICENSE
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The GNU General Public License is a free, copyleft license for
12 | software and other kinds of works.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | the GNU General Public License is intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users. We, the Free Software Foundation, use the
19 | GNU General Public License for most of our software; it applies also to
20 | any other work released this way by its authors. You can apply it to
21 | your programs, too.
22 |
23 | When we speak of free software, we are referring to freedom, not
24 | price. Our General Public Licenses are designed to make sure that you
25 | have the freedom to distribute copies of free software (and charge for
26 | them if you wish), that you receive source code or can get it if you
27 | want it, that you can change the software or use pieces of it in new
28 | free programs, and that you know you can do these things.
29 |
30 | To protect your rights, we need to prevent others from denying you
31 | these rights or asking you to surrender the rights. Therefore, you have
32 | certain responsibilities if you distribute copies of the software, or if
33 | you modify it: responsibilities to respect the freedom of others.
34 |
35 | For example, if you distribute copies of such a program, whether
36 | gratis or for a fee, you must pass on to the recipients the same
37 | freedoms that you received. You must make sure that they, too, receive
38 | or can get the source code. And you must show them these terms so they
39 | know their rights.
40 |
41 | Developers that use the GNU GPL protect your rights with two steps:
42 | (1) assert copyright on the software, and (2) offer you this License
43 | giving you legal permission to copy, distribute and/or modify it.
44 |
45 | For the developers' and authors' protection, the GPL clearly explains
46 | that there is no warranty for this free software. For both users' and
47 | authors' sake, the GPL requires that modified versions be marked as
48 | changed, so that their problems will not be attributed erroneously to
49 | authors of previous versions.
50 |
51 | Some devices are designed to deny users access to install or run
52 | modified versions of the software inside them, although the manufacturer
53 | can do so. This is fundamentally incompatible with the aim of
54 | protecting users' freedom to change the software. The systematic
55 | pattern of such abuse occurs in the area of products for individuals to
56 | use, which is precisely where it is most unacceptable. Therefore, we
57 | have designed this version of the GPL to prohibit the practice for those
58 | products. If such problems arise substantially in other domains, we
59 | stand ready to extend this provision to those domains in future versions
60 | of the GPL, as needed to protect the freedom of users.
61 |
62 | Finally, every program is threatened constantly by software patents.
63 | States should not allow patents to restrict development and use of
64 | software on general-purpose computers, but in those that do, we wish to
65 | avoid the special danger that patents applied to a free program could
66 | make it effectively proprietary. To prevent this, the GPL assures that
67 | patents cannot be used to render the program non-free.
68 |
69 | The precise terms and conditions for copying, distribution and
70 | modification follow.
71 |
72 | TERMS AND CONDITIONS
73 |
74 | 0. Definitions.
75 |
76 | "This License" refers to version 3 of the GNU General Public License.
77 |
78 | "Copyright" also means copyright-like laws that apply to other kinds of
79 | works, such as semiconductor masks.
80 |
81 | "The Program" refers to any copyrightable work licensed under this
82 | License. Each licensee is addressed as "you". "Licensees" and
83 | "recipients" may be individuals or organizations.
84 |
85 | To "modify" a work means to copy from or adapt all or part of the work
86 | in a fashion requiring copyright permission, other than the making of an
87 | exact copy. The resulting work is called a "modified version" of the
88 | earlier work or a work "based on" the earlier work.
89 |
90 | A "covered work" means either the unmodified Program or a work based
91 | on the Program.
92 |
93 | To "propagate" a work means to do anything with it that, without
94 | permission, would make you directly or secondarily liable for
95 | infringement under applicable copyright law, except executing it on a
96 | computer or modifying a private copy. Propagation includes copying,
97 | distribution (with or without modification), making available to the
98 | public, and in some countries other activities as well.
99 |
100 | To "convey" a work means any kind of propagation that enables other
101 | parties to make or receive copies. Mere interaction with a user through
102 | a computer network, with no transfer of a copy, is not conveying.
103 |
104 | An interactive user interface displays "Appropriate Legal Notices"
105 | to the extent that it includes a convenient and prominently visible
106 | feature that (1) displays an appropriate copyright notice, and (2)
107 | tells the user that there is no warranty for the work (except to the
108 | extent that warranties are provided), that licensees may convey the
109 | work under this License, and how to view a copy of this License. If
110 | the interface presents a list of user commands or options, such as a
111 | menu, a prominent item in the list meets this criterion.
112 |
113 | 1. Source Code.
114 |
115 | The "source code" for a work means the preferred form of the work
116 | for making modifications to it. "Object code" means any non-source
117 | form of a work.
118 |
119 | A "Standard Interface" means an interface that either is an official
120 | standard defined by a recognized standards body, or, in the case of
121 | interfaces specified for a particular programming language, one that
122 | is widely used among developers working in that language.
123 |
124 | The "System Libraries" of an executable work include anything, other
125 | than the work as a whole, that (a) is included in the normal form of
126 | packaging a Major Component, but which is not part of that Major
127 | Component, and (b) serves only to enable use of the work with that
128 | Major Component, or to implement a Standard Interface for which an
129 | implementation is available to the public in source code form. A
130 | "Major Component", in this context, means a major essential component
131 | (kernel, window system, and so on) of the specific operating system
132 | (if any) on which the executable work runs, or a compiler used to
133 | produce the work, or an object code interpreter used to run it.
134 |
135 | The "Corresponding Source" for a work in object code form means all
136 | the source code needed to generate, install, and (for an executable
137 | work) run the object code and to modify the work, including scripts to
138 | control those activities. However, it does not include the work's
139 | System Libraries, or general-purpose tools or generally available free
140 | programs which are used unmodified in performing those activities but
141 | which are not part of the work. For example, Corresponding Source
142 | includes interface definition files associated with source files for
143 | the work, and the source code for shared libraries and dynamically
144 | linked subprograms that the work is specifically designed to require,
145 | such as by intimate data communication or control flow between those
146 | subprograms and other parts of the work.
147 |
148 | The Corresponding Source need not include anything that users
149 | can regenerate automatically from other parts of the Corresponding
150 | Source.
151 |
152 | The Corresponding Source for a work in source code form is that
153 | same work.
154 |
155 | 2. Basic Permissions.
156 |
157 | All rights granted under this License are granted for the term of
158 | copyright on the Program, and are irrevocable provided the stated
159 | conditions are met. This License explicitly affirms your unlimited
160 | permission to run the unmodified Program. The output from running a
161 | covered work is covered by this License only if the output, given its
162 | content, constitutes a covered work. This License acknowledges your
163 | rights of fair use or other equivalent, as provided by copyright law.
164 |
165 | You may make, run and propagate covered works that you do not
166 | convey, without conditions so long as your license otherwise remains
167 | in force. You may convey covered works to others for the sole purpose
168 | of having them make modifications exclusively for you, or provide you
169 | with facilities for running those works, provided that you comply with
170 | the terms of this License in conveying all material for which you do
171 | not control copyright. Those thus making or running the covered works
172 | for you must do so exclusively on your behalf, under your direction
173 | and control, on terms that prohibit them from making any copies of
174 | your copyrighted material outside their relationship with you.
175 |
176 | Conveying under any other circumstances is permitted solely under
177 | the conditions stated below. Sublicensing is not allowed; section 10
178 | makes it unnecessary.
179 |
180 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
181 |
182 | No covered work shall be deemed part of an effective technological
183 | measure under any applicable law fulfilling obligations under article
184 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
185 | similar laws prohibiting or restricting circumvention of such
186 | measures.
187 |
188 | When you convey a covered work, you waive any legal power to forbid
189 | circumvention of technological measures to the extent such circumvention
190 | is effected by exercising rights under this License with respect to
191 | the covered work, and you disclaim any intention to limit operation or
192 | modification of the work as a means of enforcing, against the work's
193 | users, your or third parties' legal rights to forbid circumvention of
194 | technological measures.
195 |
196 | 4. Conveying Verbatim Copies.
197 |
198 | You may convey verbatim copies of the Program's source code as you
199 | receive it, in any medium, provided that you conspicuously and
200 | appropriately publish on each copy an appropriate copyright notice;
201 | keep intact all notices stating that this License and any
202 | non-permissive terms added in accord with section 7 apply to the code;
203 | keep intact all notices of the absence of any warranty; and give all
204 | recipients a copy of this License along with the Program.
205 |
206 | You may charge any price or no price for each copy that you convey,
207 | and you may offer support or warranty protection for a fee.
208 |
209 | 5. Conveying Modified Source Versions.
210 |
211 | You may convey a work based on the Program, or the modifications to
212 | produce it from the Program, in the form of source code under the
213 | terms of section 4, provided that you also meet all of these conditions:
214 |
215 | a) The work must carry prominent notices stating that you modified
216 | it, and giving a relevant date.
217 |
218 | b) The work must carry prominent notices stating that it is
219 | released under this License and any conditions added under section
220 | 7. This requirement modifies the requirement in section 4 to
221 | "keep intact all notices".
222 |
223 | c) You must license the entire work, as a whole, under this
224 | License to anyone who comes into possession of a copy. This
225 | License will therefore apply, along with any applicable section 7
226 | additional terms, to the whole of the work, and all its parts,
227 | regardless of how they are packaged. This License gives no
228 | permission to license the work in any other way, but it does not
229 | invalidate such permission if you have separately received it.
230 |
231 | d) If the work has interactive user interfaces, each must display
232 | Appropriate Legal Notices; however, if the Program has interactive
233 | interfaces that do not display Appropriate Legal Notices, your
234 | work need not make them do so.
235 |
236 | A compilation of a covered work with other separate and independent
237 | works, which are not by their nature extensions of the covered work,
238 | and which are not combined with it such as to form a larger program,
239 | in or on a volume of a storage or distribution medium, is called an
240 | "aggregate" if the compilation and its resulting copyright are not
241 | used to limit the access or legal rights of the compilation's users
242 | beyond what the individual works permit. Inclusion of a covered work
243 | in an aggregate does not cause this License to apply to the other
244 | parts of the aggregate.
245 |
246 | 6. Conveying Non-Source Forms.
247 |
248 | You may convey a covered work in object code form under the terms
249 | of sections 4 and 5, provided that you also convey the
250 | machine-readable Corresponding Source under the terms of this License,
251 | in one of these ways:
252 |
253 | a) Convey the object code in, or embodied in, a physical product
254 | (including a physical distribution medium), accompanied by the
255 | Corresponding Source fixed on a durable physical medium
256 | customarily used for software interchange.
257 |
258 | b) Convey the object code in, or embodied in, a physical product
259 | (including a physical distribution medium), accompanied by a
260 | written offer, valid for at least three years and valid for as
261 | long as you offer spare parts or customer support for that product
262 | model, to give anyone who possesses the object code either (1) a
263 | copy of the Corresponding Source for all the software in the
264 | product that is covered by this License, on a durable physical
265 | medium customarily used for software interchange, for a price no
266 | more than your reasonable cost of physically performing this
267 | conveying of source, or (2) access to copy the
268 | Corresponding Source from a network server at no charge.
269 |
270 | c) Convey individual copies of the object code with a copy of the
271 | written offer to provide the Corresponding Source. This
272 | alternative is allowed only occasionally and noncommercially, and
273 | only if you received the object code with such an offer, in accord
274 | with subsection 6b.
275 |
276 | d) Convey the object code by offering access from a designated
277 | place (gratis or for a charge), and offer equivalent access to the
278 | Corresponding Source in the same way through the same place at no
279 | further charge. You need not require recipients to copy the
280 | Corresponding Source along with the object code. If the place to
281 | copy the object code is a network server, the Corresponding Source
282 | may be on a different server (operated by you or a third party)
283 | that supports equivalent copying facilities, provided you maintain
284 | clear directions next to the object code saying where to find the
285 | Corresponding Source. Regardless of what server hosts the
286 | Corresponding Source, you remain obligated to ensure that it is
287 | available for as long as needed to satisfy these requirements.
288 |
289 | e) Convey the object code using peer-to-peer transmission, provided
290 | you inform other peers where the object code and Corresponding
291 | Source of the work are being offered to the general public at no
292 | charge under subsection 6d.
293 |
294 | A separable portion of the object code, whose source code is excluded
295 | from the Corresponding Source as a System Library, need not be
296 | included in conveying the object code work.
297 |
298 | A "User Product" is either (1) a "consumer product", which means any
299 | tangible personal property which is normally used for personal, family,
300 | or household purposes, or (2) anything designed or sold for incorporation
301 | into a dwelling. In determining whether a product is a consumer product,
302 | doubtful cases shall be resolved in favor of coverage. For a particular
303 | product received by a particular user, "normally used" refers to a
304 | typical or common use of that class of product, regardless of the status
305 | of the particular user or of the way in which the particular user
306 | actually uses, or expects or is expected to use, the product. A product
307 | is a consumer product regardless of whether the product has substantial
308 | commercial, industrial or non-consumer uses, unless such uses represent
309 | the only significant mode of use of the product.
310 |
311 | "Installation Information" for a User Product means any methods,
312 | procedures, authorization keys, or other information required to install
313 | and execute modified versions of a covered work in that User Product from
314 | a modified version of its Corresponding Source. The information must
315 | suffice to ensure that the continued functioning of the modified object
316 | code is in no case prevented or interfered with solely because
317 | modification has been made.
318 |
319 | If you convey an object code work under this section in, or with, or
320 | specifically for use in, a User Product, and the conveying occurs as
321 | part of a transaction in which the right of possession and use of the
322 | User Product is transferred to the recipient in perpetuity or for a
323 | fixed term (regardless of how the transaction is characterized), the
324 | Corresponding Source conveyed under this section must be accompanied
325 | by the Installation Information. But this requirement does not apply
326 | if neither you nor any third party retains the ability to install
327 | modified object code on the User Product (for example, the work has
328 | been installed in ROM).
329 |
330 | The requirement to provide Installation Information does not include a
331 | requirement to continue to provide support service, warranty, or updates
332 | for a work that has been modified or installed by the recipient, or for
333 | the User Product in which it has been modified or installed. Access to a
334 | network may be denied when the modification itself materially and
335 | adversely affects the operation of the network or violates the rules and
336 | protocols for communication across the network.
337 |
338 | Corresponding Source conveyed, and Installation Information provided,
339 | in accord with this section must be in a format that is publicly
340 | documented (and with an implementation available to the public in
341 | source code form), and must require no special password or key for
342 | unpacking, reading or copying.
343 |
344 | 7. Additional Terms.
345 |
346 | "Additional permissions" are terms that supplement the terms of this
347 | License by making exceptions from one or more of its conditions.
348 | Additional permissions that are applicable to the entire Program shall
349 | be treated as though they were included in this License, to the extent
350 | that they are valid under applicable law. If additional permissions
351 | apply only to part of the Program, that part may be used separately
352 | under those permissions, but the entire Program remains governed by
353 | this License without regard to the additional permissions.
354 |
355 | When you convey a copy of a covered work, you may at your option
356 | remove any additional permissions from that copy, or from any part of
357 | it. (Additional permissions may be written to require their own
358 | removal in certain cases when you modify the work.) You may place
359 | additional permissions on material, added by you to a covered work,
360 | for which you have or can give appropriate copyright permission.
361 |
362 | Notwithstanding any other provision of this License, for material you
363 | add to a covered work, you may (if authorized by the copyright holders of
364 | that material) supplement the terms of this License with terms:
365 |
366 | a) Disclaiming warranty or limiting liability differently from the
367 | terms of sections 15 and 16 of this License; or
368 |
369 | b) Requiring preservation of specified reasonable legal notices or
370 | author attributions in that material or in the Appropriate Legal
371 | Notices displayed by works containing it; or
372 |
373 | c) Prohibiting misrepresentation of the origin of that material, or
374 | requiring that modified versions of such material be marked in
375 | reasonable ways as different from the original version; or
376 |
377 | d) Limiting the use for publicity purposes of names of licensors or
378 | authors of the material; or
379 |
380 | e) Declining to grant rights under trademark law for use of some
381 | trade names, trademarks, or service marks; or
382 |
383 | f) Requiring indemnification of licensors and authors of that
384 | material by anyone who conveys the material (or modified versions of
385 | it) with contractual assumptions of liability to the recipient, for
386 | any liability that these contractual assumptions directly impose on
387 | those licensors and authors.
388 |
389 | All other non-permissive additional terms are considered "further
390 | restrictions" within the meaning of section 10. If the Program as you
391 | received it, or any part of it, contains a notice stating that it is
392 | governed by this License along with a term that is a further
393 | restriction, you may remove that term. If a license document contains
394 | a further restriction but permits relicensing or conveying under this
395 | License, you may add to a covered work material governed by the terms
396 | of that license document, provided that the further restriction does
397 | not survive such relicensing or conveying.
398 |
399 | If you add terms to a covered work in accord with this section, you
400 | must place, in the relevant source files, a statement of the
401 | additional terms that apply to those files, or a notice indicating
402 | where to find the applicable terms.
403 |
404 | Additional terms, permissive or non-permissive, may be stated in the
405 | form of a separately written license, or stated as exceptions;
406 | the above requirements apply either way.
407 |
408 | 8. Termination.
409 |
410 | You may not propagate or modify a covered work except as expressly
411 | provided under this License. Any attempt otherwise to propagate or
412 | modify it is void, and will automatically terminate your rights under
413 | this License (including any patent licenses granted under the third
414 | paragraph of section 11).
415 |
416 | However, if you cease all violation of this License, then your
417 | license from a particular copyright holder is reinstated (a)
418 | provisionally, unless and until the copyright holder explicitly and
419 | finally terminates your license, and (b) permanently, if the copyright
420 | holder fails to notify you of the violation by some reasonable means
421 | prior to 60 days after the cessation.
422 |
423 | Moreover, your license from a particular copyright holder is
424 | reinstated permanently if the copyright holder notifies you of the
425 | violation by some reasonable means, this is the first time you have
426 | received notice of violation of this License (for any work) from that
427 | copyright holder, and you cure the violation prior to 30 days after
428 | your receipt of the notice.
429 |
430 | Termination of your rights under this section does not terminate the
431 | licenses of parties who have received copies or rights from you under
432 | this License. If your rights have been terminated and not permanently
433 | reinstated, you do not qualify to receive new licenses for the same
434 | material under section 10.
435 |
436 | 9. Acceptance Not Required for Having Copies.
437 |
438 | You are not required to accept this License in order to receive or
439 | run a copy of the Program. Ancillary propagation of a covered work
440 | occurring solely as a consequence of using peer-to-peer transmission
441 | to receive a copy likewise does not require acceptance. However,
442 | nothing other than this License grants you permission to propagate or
443 | modify any covered work. These actions infringe copyright if you do
444 | not accept this License. Therefore, by modifying or propagating a
445 | covered work, you indicate your acceptance of this License to do so.
446 |
447 | 10. Automatic Licensing of Downstream Recipients.
448 |
449 | Each time you convey a covered work, the recipient automatically
450 | receives a license from the original licensors, to run, modify and
451 | propagate that work, subject to this License. You are not responsible
452 | for enforcing compliance by third parties with this License.
453 |
454 | An "entity transaction" is a transaction transferring control of an
455 | organization, or substantially all assets of one, or subdividing an
456 | organization, or merging organizations. If propagation of a covered
457 | work results from an entity transaction, each party to that
458 | transaction who receives a copy of the work also receives whatever
459 | licenses to the work the party's predecessor in interest had or could
460 | give under the previous paragraph, plus a right to possession of the
461 | Corresponding Source of the work from the predecessor in interest, if
462 | the predecessor has it or can get it with reasonable efforts.
463 |
464 | You may not impose any further restrictions on the exercise of the
465 | rights granted or affirmed under this License. For example, you may
466 | not impose a license fee, royalty, or other charge for exercise of
467 | rights granted under this License, and you may not initiate litigation
468 | (including a cross-claim or counterclaim in a lawsuit) alleging that
469 | any patent claim is infringed by making, using, selling, offering for
470 | sale, or importing the Program or any portion of it.
471 |
472 | 11. Patents.
473 |
474 | A "contributor" is a copyright holder who authorizes use under this
475 | License of the Program or a work on which the Program is based. The
476 | work thus licensed is called the contributor's "contributor version".
477 |
478 | A contributor's "essential patent claims" are all patent claims
479 | owned or controlled by the contributor, whether already acquired or
480 | hereafter acquired, that would be infringed by some manner, permitted
481 | by this License, of making, using, or selling its contributor version,
482 | but do not include claims that would be infringed only as a
483 | consequence of further modification of the contributor version. For
484 | purposes of this definition, "control" includes the right to grant
485 | patent sublicenses in a manner consistent with the requirements of
486 | this License.
487 |
488 | Each contributor grants you a non-exclusive, worldwide, royalty-free
489 | patent license under the contributor's essential patent claims, to
490 | make, use, sell, offer for sale, import and otherwise run, modify and
491 | propagate the contents of its contributor version.
492 |
493 | In the following three paragraphs, a "patent license" is any express
494 | agreement or commitment, however denominated, not to enforce a patent
495 | (such as an express permission to practice a patent or covenant not to
496 | sue for patent infringement). To "grant" such a patent license to a
497 | party means to make such an agreement or commitment not to enforce a
498 | patent against the party.
499 |
500 | If you convey a covered work, knowingly relying on a patent license,
501 | and the Corresponding Source of the work is not available for anyone
502 | to copy, free of charge and under the terms of this License, through a
503 | publicly available network server or other readily accessible means,
504 | then you must either (1) cause the Corresponding Source to be so
505 | available, or (2) arrange to deprive yourself of the benefit of the
506 | patent license for this particular work, or (3) arrange, in a manner
507 | consistent with the requirements of this License, to extend the patent
508 | license to downstream recipients. "Knowingly relying" means you have
509 | actual knowledge that, but for the patent license, your conveying the
510 | covered work in a country, or your recipient's use of the covered work
511 | in a country, would infringe one or more identifiable patents in that
512 | country that you have reason to believe are valid.
513 |
514 | If, pursuant to or in connection with a single transaction or
515 | arrangement, you convey, or propagate by procuring conveyance of, a
516 | covered work, and grant a patent license to some of the parties
517 | receiving the covered work authorizing them to use, propagate, modify
518 | or convey a specific copy of the covered work, then the patent license
519 | you grant is automatically extended to all recipients of the covered
520 | work and works based on it.
521 |
522 | A patent license is "discriminatory" if it does not include within
523 | the scope of its coverage, prohibits the exercise of, or is
524 | conditioned on the non-exercise of one or more of the rights that are
525 | specifically granted under this License. You may not convey a covered
526 | work if you are a party to an arrangement with a third party that is
527 | in the business of distributing software, under which you make payment
528 | to the third party based on the extent of your activity of conveying
529 | the work, and under which the third party grants, to any of the
530 | parties who would receive the covered work from you, a discriminatory
531 | patent license (a) in connection with copies of the covered work
532 | conveyed by you (or copies made from those copies), or (b) primarily
533 | for and in connection with specific products or compilations that
534 | contain the covered work, unless you entered into that arrangement,
535 | or that patent license was granted, prior to 28 March 2007.
536 |
537 | Nothing in this License shall be construed as excluding or limiting
538 | any implied license or other defenses to infringement that may
539 | otherwise be available to you under applicable patent law.
540 |
541 | 12. No Surrender of Others' Freedom.
542 |
543 | If conditions are imposed on you (whether by court order, agreement or
544 | otherwise) that contradict the conditions of this License, they do not
545 | excuse you from the conditions of this License. If you cannot convey a
546 | covered work so as to satisfy simultaneously your obligations under this
547 | License and any other pertinent obligations, then as a consequence you may
548 | not convey it at all. For example, if you agree to terms that obligate you
549 | to collect a royalty for further conveying from those to whom you convey
550 | the Program, the only way you could satisfy both those terms and this
551 | License would be to refrain entirely from conveying the Program.
552 |
553 | 13. Use with the GNU Affero General Public License.
554 |
555 | Notwithstanding any other provision of this License, you have
556 | permission to link or combine any covered work with a work licensed
557 | under version 3 of the GNU Affero General Public License into a single
558 | combined work, and to convey the resulting work. The terms of this
559 | License will continue to apply to the part which is the covered work,
560 | but the special requirements of the GNU Affero General Public License,
561 | section 13, concerning interaction through a network will apply to the
562 | combination as such.
563 |
564 | 14. Revised Versions of this License.
565 |
566 | The Free Software Foundation may publish revised and/or new versions of
567 | the GNU General Public License from time to time. Such new versions will
568 | be similar in spirit to the present version, but may differ in detail to
569 | address new problems or concerns.
570 |
571 | Each version is given a distinguishing version number. If the
572 | Program specifies that a certain numbered version of the GNU General
573 | Public License "or any later version" applies to it, you have the
574 | option of following the terms and conditions either of that numbered
575 | version or of any later version published by the Free Software
576 | Foundation. If the Program does not specify a version number of the
577 | GNU General Public License, you may choose any version ever published
578 | by the Free Software Foundation.
579 |
580 | If the Program specifies that a proxy can decide which future
581 | versions of the GNU General Public License can be used, that proxy's
582 | public statement of acceptance of a version permanently authorizes you
583 | to choose that version for the Program.
584 |
585 | Later license versions may give you additional or different
586 | permissions. However, no additional obligations are imposed on any
587 | author or copyright holder as a result of your choosing to follow a
588 | later version.
589 |
590 | 15. Disclaimer of Warranty.
591 |
592 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
593 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
594 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
595 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
596 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
597 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
598 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
599 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
600 |
601 | 16. Limitation of Liability.
602 |
603 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
604 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
605 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
606 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
607 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
608 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
609 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
610 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
611 | SUCH DAMAGES.
612 |
613 | 17. Interpretation of Sections 15 and 16.
614 |
615 | If the disclaimer of warranty and limitation of liability provided
616 | above cannot be given local legal effect according to their terms,
617 | reviewing courts shall apply local law that most closely approximates
618 | an absolute waiver of all civil liability in connection with the
619 | Program, unless a warranty or assumption of liability accompanies a
620 | copy of the Program in return for a fee.
621 |
622 | END OF TERMS AND CONDITIONS
623 |
624 | How to Apply These Terms to Your New Programs
625 |
626 | If you develop a new program, and you want it to be of the greatest
627 | possible use to the public, the best way to achieve this is to make it
628 | free software which everyone can redistribute and change under these terms.
629 |
630 | To do so, attach the following notices to the program. It is safest
631 | to attach them to the start of each source file to most effectively
632 | state the exclusion of warranty; and each file should have at least
633 | the "copyright" line and a pointer to where the full notice is found.
634 |
635 |
636 | Copyright (C)
637 |
638 | This program is free software: you can redistribute it and/or modify
639 | it under the terms of the GNU General Public License as published by
640 | the Free Software Foundation, either version 3 of the License, or
641 | (at your option) any later version.
642 |
643 | This program is distributed in the hope that it will be useful,
644 | but WITHOUT ANY WARRANTY; without even the implied warranty of
645 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
646 | GNU General Public License for more details.
647 |
648 | You should have received a copy of the GNU General Public License
649 | along with this program. If not, see .
650 |
651 | Also add information on how to contact you by electronic and paper mail.
652 |
653 | If the program does terminal interaction, make it output a short
654 | notice like this when it starts in an interactive mode:
655 |
656 | Copyright (C)
657 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
658 | This is free software, and you are welcome to redistribute it
659 | under certain conditions; type `show c' for details.
660 |
661 | The hypothetical commands `show w' and `show c' should show the appropriate
662 | parts of the General Public License. Of course, your program's commands
663 | might be different; for a GUI interface, you would use an "about box".
664 |
665 | You should also get your employer (if you work as a programmer) or school,
666 | if any, to sign a "copyright disclaimer" for the program, if necessary.
667 | For more information on this, and how to apply and follow the GNU GPL, see
668 | .
669 |
670 | The GNU General Public License does not permit incorporating your program
671 | into proprietary programs. If your program is a subroutine library, you
672 | may consider it more useful to permit linking proprietary applications with
673 | the library. If this is what you want to do, use the GNU Lesser General
674 | Public License instead of this License. But first, please read
675 | .
676 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/LGPL-3:
--------------------------------------------------------------------------------
1 | {# source: http://www.gnu.org/licenses/lgpl-3.0.txt #}
2 | GNU LESSER GENERAL PUBLIC LICENSE
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 |
10 | This version of the GNU Lesser General Public License incorporates
11 | the terms and conditions of version 3 of the GNU General Public
12 | License, supplemented by the additional permissions listed below.
13 |
14 | 0. Additional Definitions.
15 |
16 | As used herein, "this License" refers to version 3 of the GNU Lesser
17 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
18 | General Public License.
19 |
20 | "The Library" refers to a covered work governed by this License,
21 | other than an Application or a Combined Work as defined below.
22 |
23 | An "Application" is any work that makes use of an interface provided
24 | by the Library, but which is not otherwise based on the Library.
25 | Defining a subclass of a class defined by the Library is deemed a mode
26 | of using an interface provided by the Library.
27 |
28 | A "Combined Work" is a work produced by combining or linking an
29 | Application with the Library. The particular version of the Library
30 | with which the Combined Work was made is also called the "Linked
31 | Version".
32 |
33 | The "Minimal Corresponding Source" for a Combined Work means the
34 | Corresponding Source for the Combined Work, excluding any source code
35 | for portions of the Combined Work that, considered in isolation, are
36 | based on the Application, and not on the Linked Version.
37 |
38 | The "Corresponding Application Code" for a Combined Work means the
39 | object code and/or source code for the Application, including any data
40 | and utility programs needed for reproducing the Combined Work from the
41 | Application, but excluding the System Libraries of the Combined Work.
42 |
43 | 1. Exception to Section 3 of the GNU GPL.
44 |
45 | You may convey a covered work under sections 3 and 4 of this License
46 | without being bound by section 3 of the GNU GPL.
47 |
48 | 2. Conveying Modified Versions.
49 |
50 | If you modify a copy of the Library, and, in your modifications, a
51 | facility refers to a function or data to be supplied by an Application
52 | that uses the facility (other than as an argument passed when the
53 | facility is invoked), then you may convey a copy of the modified
54 | version:
55 |
56 | a) under this License, provided that you make a good faith effort to
57 | ensure that, in the event an Application does not supply the
58 | function or data, the facility still operates, and performs
59 | whatever part of its purpose remains meaningful, or
60 |
61 | b) under the GNU GPL, with none of the additional permissions of
62 | this License applicable to that copy.
63 |
64 | 3. Object Code Incorporating Material from Library Header Files.
65 |
66 | The object code form of an Application may incorporate material from
67 | a header file that is part of the Library. You may convey such object
68 | code under terms of your choice, provided that, if the incorporated
69 | material is not limited to numerical parameters, data structure
70 | layouts and accessors, or small macros, inline functions and templates
71 | (ten or fewer lines in length), you do both of the following:
72 |
73 | a) Give prominent notice with each copy of the object code that the
74 | Library is used in it and that the Library and its use are
75 | covered by this License.
76 |
77 | b) Accompany the object code with a copy of the GNU GPL and this license
78 | document.
79 |
80 | 4. Combined Works.
81 |
82 | You may convey a Combined Work under terms of your choice that,
83 | taken together, effectively do not restrict modification of the
84 | portions of the Library contained in the Combined Work and reverse
85 | engineering for debugging such modifications, if you also do each of
86 | the following:
87 |
88 | a) Give prominent notice with each copy of the Combined Work that
89 | the Library is used in it and that the Library and its use are
90 | covered by this License.
91 |
92 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
93 | document.
94 |
95 | c) For a Combined Work that displays copyright notices during
96 | execution, include the copyright notice for the Library among
97 | these notices, as well as a reference directing the user to the
98 | copies of the GNU GPL and this license document.
99 |
100 | d) Do one of the following:
101 |
102 | 0) Convey the Minimal Corresponding Source under the terms of this
103 | License, and the Corresponding Application Code in a form
104 | suitable for, and under terms that permit, the user to
105 | recombine or relink the Application with a modified version of
106 | the Linked Version to produce a modified Combined Work, in the
107 | manner specified by section 6 of the GNU GPL for conveying
108 | Corresponding Source.
109 |
110 | 1) Use a suitable shared library mechanism for linking with the
111 | Library. A suitable mechanism is one that (a) uses at run time
112 | a copy of the Library already present on the user's computer
113 | system, and (b) will operate properly with a modified version
114 | of the Library that is interface-compatible with the Linked
115 | Version.
116 |
117 | e) Provide Installation Information, but only if you would otherwise
118 | be required to provide such information under section 6 of the
119 | GNU GPL, and only to the extent that such information is
120 | necessary to install and execute a modified version of the
121 | Combined Work produced by recombining or relinking the
122 | Application with a modified version of the Linked Version. (If
123 | you use option 4d0, the Installation Information must accompany
124 | the Minimal Corresponding Source and Corresponding Application
125 | Code. If you use option 4d1, you must provide the Installation
126 | Information in the manner specified by section 6 of the GNU GPL
127 | for conveying Corresponding Source.)
128 |
129 | 5. Combined Libraries.
130 |
131 | You may place library facilities that are a work based on the
132 | Library side by side in a single library together with other library
133 | facilities that are not Applications and are not covered by this
134 | License, and convey such a combined library under terms of your
135 | choice, if you do both of the following:
136 |
137 | a) Accompany the combined library with a copy of the same work based
138 | on the Library, uncombined with any other library facilities,
139 | conveyed under the terms of this License.
140 |
141 | b) Give prominent notice with the combined library that part of it
142 | is a work based on the Library, and explaining where to find the
143 | accompanying uncombined form of the same work.
144 |
145 | 6. Revised Versions of the GNU Lesser General Public License.
146 |
147 | The Free Software Foundation may publish revised and/or new versions
148 | of the GNU Lesser General Public License from time to time. Such new
149 | versions will be similar in spirit to the present version, but may
150 | differ in detail to address new problems or concerns.
151 |
152 | Each version is given a distinguishing version number. If the
153 | Library as you received it specifies that a certain numbered version
154 | of the GNU Lesser General Public License "or any later version"
155 | applies to it, you have the option of following the terms and
156 | conditions either of that published version or of any later version
157 | published by the Free Software Foundation. If the Library as you
158 | received it does not specify a version number of the GNU Lesser
159 | General Public License, you may choose any version of the GNU Lesser
160 | General Public License ever published by the Free Software Foundation.
161 |
162 | If the Library as you received it specifies that a proxy can decide
163 | whether future versions of the GNU Lesser General Public License shall
164 | apply, that proxy's public statement of acceptance of any version is
165 | permanent authorization for you to choose that version for the
166 | Library.
167 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/MIT:
--------------------------------------------------------------------------------
1 | {#- source: http://opensource.org/licenses/MIT #}
2 | The MIT License (MIT)
3 |
4 | Copyright (c) {% now 'utc', '%Y' %} {{cookiecutter.full_name}}
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
14 | all 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
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/licenses/MPL-2:
--------------------------------------------------------------------------------
1 | {#- source: https://www.mozilla.org/media/MPL/2.0/index.txt #}
2 | Mozilla Public License Version 2.0
3 | ==================================
4 |
5 | 1. Definitions
6 | --------------
7 |
8 | 1.1. "Contributor"
9 | means each individual or legal entity that creates, contributes to
10 | the creation of, or owns Covered Software.
11 |
12 | 1.2. "Contributor Version"
13 | means the combination of the Contributions of others (if any) used
14 | by a Contributor and that particular Contributor's Contribution.
15 |
16 | 1.3. "Contribution"
17 | means Covered Software of a particular Contributor.
18 |
19 | 1.4. "Covered Software"
20 | means Source Code Form to which the initial Contributor has attached
21 | the notice in Exhibit A, the Executable Form of such Source Code
22 | Form, and Modifications of such Source Code Form, in each case
23 | including portions thereof.
24 |
25 | 1.5. "Incompatible With Secondary Licenses"
26 | means
27 |
28 | (a) that the initial Contributor has attached the notice described
29 | in Exhibit B to the Covered Software; or
30 |
31 | (b) that the Covered Software was made available under the terms of
32 | version 1.1 or earlier of the License, but not also under the
33 | terms of a Secondary License.
34 |
35 | 1.6. "Executable Form"
36 | means any form of the work other than Source Code Form.
37 |
38 | 1.7. "Larger Work"
39 | means a work that combines Covered Software with other material, in
40 | a separate file or files, that is not Covered Software.
41 |
42 | 1.8. "License"
43 | means this document.
44 |
45 | 1.9. "Licensable"
46 | means having the right to grant, to the maximum extent possible,
47 | whether at the time of the initial grant or subsequently, any and
48 | all of the rights conveyed by this License.
49 |
50 | 1.10. "Modifications"
51 | means any of the following:
52 |
53 | (a) any file in Source Code Form that results from an addition to,
54 | deletion from, or modification of the contents of Covered
55 | Software; or
56 |
57 | (b) any new file in Source Code Form that contains any Covered
58 | Software.
59 |
60 | 1.11. "Patent Claims" of a Contributor
61 | means any patent claim(s), including without limitation, method,
62 | process, and apparatus claims, in any patent Licensable by such
63 | Contributor that would be infringed, but for the grant of the
64 | License, by the making, using, selling, offering for sale, having
65 | made, import, or transfer of either its Contributions or its
66 | Contributor Version.
67 |
68 | 1.12. "Secondary License"
69 | means either the GNU General Public License, Version 2.0, the GNU
70 | Lesser General Public License, Version 2.1, the GNU Affero General
71 | Public License, Version 3.0, or any later versions of those
72 | licenses.
73 |
74 | 1.13. "Source Code Form"
75 | means the form of the work preferred for making modifications.
76 |
77 | 1.14. "You" (or "Your")
78 | means an individual or a legal entity exercising rights under this
79 | License. For legal entities, "You" includes any entity that
80 | controls, is controlled by, or is under common control with You. For
81 | purposes of this definition, "control" means (a) the power, direct
82 | or indirect, to cause the direction or management of such entity,
83 | whether by contract or otherwise, or (b) ownership of more than
84 | fifty percent (50%) of the outstanding shares or beneficial
85 | ownership of such entity.
86 |
87 | 2. License Grants and Conditions
88 | --------------------------------
89 |
90 | 2.1. Grants
91 |
92 | Each Contributor hereby grants You a world-wide, royalty-free,
93 | non-exclusive license:
94 |
95 | (a) under intellectual property rights (other than patent or trademark)
96 | Licensable by such Contributor to use, reproduce, make available,
97 | modify, display, perform, distribute, and otherwise exploit its
98 | Contributions, either on an unmodified basis, with Modifications, or
99 | as part of a Larger Work; and
100 |
101 | (b) under Patent Claims of such Contributor to make, use, sell, offer
102 | for sale, have made, import, and otherwise transfer either its
103 | Contributions or its Contributor Version.
104 |
105 | 2.2. Effective Date
106 |
107 | The licenses granted in Section 2.1 with respect to any Contribution
108 | become effective for each Contribution on the date the Contributor first
109 | distributes such Contribution.
110 |
111 | 2.3. Limitations on Grant Scope
112 |
113 | The licenses granted in this Section 2 are the only rights granted under
114 | this License. No additional rights or licenses will be implied from the
115 | distribution or licensing of Covered Software under this License.
116 | Notwithstanding Section 2.1(b) above, no patent license is granted by a
117 | Contributor:
118 |
119 | (a) for any code that a Contributor has removed from Covered Software;
120 | or
121 |
122 | (b) for infringements caused by: (i) Your and any other third party's
123 | modifications of Covered Software, or (ii) the combination of its
124 | Contributions with other software (except as part of its Contributor
125 | Version); or
126 |
127 | (c) under Patent Claims infringed by Covered Software in the absence of
128 | its Contributions.
129 |
130 | This License does not grant any rights in the trademarks, service marks,
131 | or logos of any Contributor (except as may be necessary to comply with
132 | the notice requirements in Section 3.4).
133 |
134 | 2.4. Subsequent Licenses
135 |
136 | No Contributor makes additional grants as a result of Your choice to
137 | distribute the Covered Software under a subsequent version of this
138 | License (see Section 10.2) or under the terms of a Secondary License (if
139 | permitted under the terms of Section 3.3).
140 |
141 | 2.5. Representation
142 |
143 | Each Contributor represents that the Contributor believes its
144 | Contributions are its original creation(s) or it has sufficient rights
145 | to grant the rights to its Contributions conveyed by this License.
146 |
147 | 2.6. Fair Use
148 |
149 | This License is not intended to limit any rights You have under
150 | applicable copyright doctrines of fair use, fair dealing, or other
151 | equivalents.
152 |
153 | 2.7. Conditions
154 |
155 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
156 | in Section 2.1.
157 |
158 | 3. Responsibilities
159 | -------------------
160 |
161 | 3.1. Distribution of Source Form
162 |
163 | All distribution of Covered Software in Source Code Form, including any
164 | Modifications that You create or to which You contribute, must be under
165 | the terms of this License. You must inform recipients that the Source
166 | Code Form of the Covered Software is governed by the terms of this
167 | License, and how they can obtain a copy of this License. You may not
168 | attempt to alter or restrict the recipients' rights in the Source Code
169 | Form.
170 |
171 | 3.2. Distribution of Executable Form
172 |
173 | If You distribute Covered Software in Executable Form then:
174 |
175 | (a) such Covered Software must also be made available in Source Code
176 | Form, as described in Section 3.1, and You must inform recipients of
177 | the Executable Form how they can obtain a copy of such Source Code
178 | Form by reasonable means in a timely manner, at a charge no more
179 | than the cost of distribution to the recipient; and
180 |
181 | (b) You may distribute such Executable Form under the terms of this
182 | License, or sublicense it under different terms, provided that the
183 | license for the Executable Form does not attempt to limit or alter
184 | the recipients' rights in the Source Code Form under this License.
185 |
186 | 3.3. Distribution of a Larger Work
187 |
188 | You may create and distribute a Larger Work under terms of Your choice,
189 | provided that You also comply with the requirements of this License for
190 | the Covered Software. If the Larger Work is a combination of Covered
191 | Software with a work governed by one or more Secondary Licenses, and the
192 | Covered Software is not Incompatible With Secondary Licenses, this
193 | License permits You to additionally distribute such Covered Software
194 | under the terms of such Secondary License(s), so that the recipient of
195 | the Larger Work may, at their option, further distribute the Covered
196 | Software under the terms of either this License or such Secondary
197 | License(s).
198 |
199 | 3.4. Notices
200 |
201 | You may not remove or alter the substance of any license notices
202 | (including copyright notices, patent notices, disclaimers of warranty,
203 | or limitations of liability) contained within the Source Code Form of
204 | the Covered Software, except that You may alter any license notices to
205 | the extent required to remedy known factual inaccuracies.
206 |
207 | 3.5. Application of Additional Terms
208 |
209 | You may choose to offer, and to charge a fee for, warranty, support,
210 | indemnity or liability obligations to one or more recipients of Covered
211 | Software. However, You may do so only on Your own behalf, and not on
212 | behalf of any Contributor. You must make it absolutely clear that any
213 | such warranty, support, indemnity, or liability obligation is offered by
214 | You alone, and You hereby agree to indemnify every Contributor for any
215 | liability incurred by such Contributor as a result of warranty, support,
216 | indemnity or liability terms You offer. You may include additional
217 | disclaimers of warranty and limitations of liability specific to any
218 | jurisdiction.
219 |
220 | 4. Inability to Comply Due to Statute or Regulation
221 | ---------------------------------------------------
222 |
223 | If it is impossible for You to comply with any of the terms of this
224 | License with respect to some or all of the Covered Software due to
225 | statute, judicial order, or regulation then You must: (a) comply with
226 | the terms of this License to the maximum extent possible; and (b)
227 | describe the limitations and the code they affect. Such description must
228 | be placed in a text file included with all distributions of the Covered
229 | Software under this License. Except to the extent prohibited by statute
230 | or regulation, such description must be sufficiently detailed for a
231 | recipient of ordinary skill to be able to understand it.
232 |
233 | 5. Termination
234 | --------------
235 |
236 | 5.1. The rights granted under this License will terminate automatically
237 | if You fail to comply with any of its terms. However, if You become
238 | compliant, then the rights granted under this License from a particular
239 | Contributor are reinstated (a) provisionally, unless and until such
240 | Contributor explicitly and finally terminates Your grants, and (b) on an
241 | ongoing basis, if such Contributor fails to notify You of the
242 | non-compliance by some reasonable means prior to 60 days after You have
243 | come back into compliance. Moreover, Your grants from a particular
244 | Contributor are reinstated on an ongoing basis if such Contributor
245 | notifies You of the non-compliance by some reasonable means, this is the
246 | first time You have received notice of non-compliance with this License
247 | from such Contributor, and You become compliant prior to 30 days after
248 | Your receipt of the notice.
249 |
250 | 5.2. If You initiate litigation against any entity by asserting a patent
251 | infringement claim (excluding declaratory judgment actions,
252 | counter-claims, and cross-claims) alleging that a Contributor Version
253 | directly or indirectly infringes any patent, then the rights granted to
254 | You by any and all Contributors for the Covered Software under Section
255 | 2.1 of this License shall terminate.
256 |
257 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
258 | end user license agreements (excluding distributors and resellers) which
259 | have been validly granted by You or Your distributors under this License
260 | prior to termination shall survive termination.
261 |
262 | ************************************************************************
263 | * *
264 | * 6. Disclaimer of Warranty *
265 | * ------------------------- *
266 | * *
267 | * Covered Software is provided under this License on an "as is" *
268 | * basis, without warranty of any kind, either expressed, implied, or *
269 | * statutory, including, without limitation, warranties that the *
270 | * Covered Software is free of defects, merchantable, fit for a *
271 | * particular purpose or non-infringing. The entire risk as to the *
272 | * quality and performance of the Covered Software is with You. *
273 | * Should any Covered Software prove defective in any respect, You *
274 | * (not any Contributor) assume the cost of any necessary servicing, *
275 | * repair, or correction. This disclaimer of warranty constitutes an *
276 | * essential part of this License. No use of any Covered Software is *
277 | * authorized under this License except under this disclaimer. *
278 | * *
279 | ************************************************************************
280 |
281 | ************************************************************************
282 | * *
283 | * 7. Limitation of Liability *
284 | * -------------------------- *
285 | * *
286 | * Under no circumstances and under no legal theory, whether tort *
287 | * (including negligence), contract, or otherwise, shall any *
288 | * Contributor, or anyone who distributes Covered Software as *
289 | * permitted above, be liable to You for any direct, indirect, *
290 | * special, incidental, or consequential damages of any character *
291 | * including, without limitation, damages for lost profits, loss of *
292 | * goodwill, work stoppage, computer failure or malfunction, or any *
293 | * and all other commercial damages or losses, even if such party *
294 | * shall have been informed of the possibility of such damages. This *
295 | * limitation of liability shall not apply to liability for death or *
296 | * personal injury resulting from such party's negligence to the *
297 | * extent applicable law prohibits such limitation. Some *
298 | * jurisdictions do not allow the exclusion or limitation of *
299 | * incidental or consequential damages, so this exclusion and *
300 | * limitation may not apply to You. *
301 | * *
302 | ************************************************************************
303 |
304 | 8. Litigation
305 | -------------
306 |
307 | Any litigation relating to this License may be brought only in the
308 | courts of a jurisdiction where the defendant maintains its principal
309 | place of business and such litigation shall be governed by laws of that
310 | jurisdiction, without reference to its conflict-of-law provisions.
311 | Nothing in this Section shall prevent a party's ability to bring
312 | cross-claims or counter-claims.
313 |
314 | 9. Miscellaneous
315 | ----------------
316 |
317 | This License represents the complete agreement concerning the subject
318 | matter hereof. If any provision of this License is held to be
319 | unenforceable, such provision shall be reformed only to the extent
320 | necessary to make it enforceable. Any law or regulation which provides
321 | that the language of a contract shall be construed against the drafter
322 | shall not be used to construe this License against a Contributor.
323 |
324 | 10. Versions of the License
325 | ---------------------------
326 |
327 | 10.1. New Versions
328 |
329 | Mozilla Foundation is the license steward. Except as provided in Section
330 | 10.3, no one other than the license steward has the right to modify or
331 | publish new versions of this License. Each version will be given a
332 | distinguishing version number.
333 |
334 | 10.2. Effect of New Versions
335 |
336 | You may distribute the Covered Software under the terms of the version
337 | of the License under which You originally received the Covered Software,
338 | or under the terms of any subsequent version published by the license
339 | steward.
340 |
341 | 10.3. Modified Versions
342 |
343 | If you create software not governed by this License, and you want to
344 | create a new license for such software, you may create and use a
345 | modified version of this License if you rename the license and remove
346 | any references to the name of the license steward (except to note that
347 | such modified license differs from this License).
348 |
349 | 10.4. Distributing Source Code Form that is Incompatible With Secondary
350 | Licenses
351 |
352 | If You choose to distribute Source Code Form that is Incompatible With
353 | Secondary Licenses under the terms of this version of the License, the
354 | notice described in Exhibit B of this License must be attached.
355 |
356 | Exhibit A - Source Code Form License Notice
357 | -------------------------------------------
358 |
359 | This Source Code Form is subject to the terms of the Mozilla Public
360 | License, v. 2.0. If a copy of the MPL was not distributed with this
361 | file, You can obtain one at http://mozilla.org/MPL/2.0/.
362 |
363 | If it is not possible or desirable to put the notice in a particular
364 | file, then You may include the notice in a location (such as a LICENSE
365 | file in a relevant directory) where a recipient would be likely to look
366 | for such a notice.
367 |
368 | You may add additional accurate notices of copyright ownership.
369 |
370 | Exhibit B - "Incompatible With Secondary Licenses" Notice
371 | ---------------------------------------------------------
372 |
373 | This Source Code Form is "Incompatible With Secondary Licenses", as
374 | defined by the Mozilla Public License, v. 2.0.
375 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "{{cookiecutter.package_name}}"
3 | authors = [{name = "{{cookiecutter.full_name}}", email= "{{cookiecutter.email}}"}]
4 | description = "{{cookiecutter.short_description}}"
5 | readme = "README.md"
6 | requires-python = ">=3.11.0"
7 | dynamic = ["version"]
8 |
9 | dependencies = []
10 |
11 | {% if cookiecutter.license == "MIT" -%}
12 | license = {text = "{{cookiecutter.license}}"}
13 | {%- elif cookiecutter.license == "BSD-3" -%}
14 | license = {text = "BSD-3-Clause"}
15 | {%- elif cookiecutter.license == "GNU GPL v3.0" -%}
16 | license = {text = "GPL-3.0-only"}
17 | {%- elif cookiecutter.license == "GNU LGPL v3.0" -%}
18 | license = {text = "LGPL-3.0-only"}
19 | {%- elif cookiecutter.license == "Apache Software License 2.0" -%}
20 | license = {text = "Apache-2.0"}
21 | {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%}
22 | license = {text = "MPL-2.0"}
23 | {%- endif %}
24 |
25 | classifiers = [
26 | "Development Status :: 2 - Pre-Alpha",
27 | "Programming Language :: Python",
28 | "Programming Language :: Python :: 3",
29 | "Programming Language :: Python :: 3.11",
30 | "Programming Language :: Python :: 3.12",
31 | "Programming Language :: Python :: 3.13",
32 | "Operating System :: OS Independent",
33 | {% if cookiecutter.license == "MIT" -%}
34 | "License :: OSI Approved :: MIT License",
35 | {%- elif cookiecutter.license == "BSD-3" -%}
36 | "License :: OSI Approved :: BSD License",
37 | {%- elif cookiecutter.license == "GNU GPL v3.0" -%}
38 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
39 | {%- elif cookiecutter.license == "GNU LGPL v3.0" -%}
40 | "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
41 | {%- elif cookiecutter.license == "Apache Software License 2.0" -%}
42 | "License :: OSI Approved :: Apache Software License",
43 | {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%}
44 | "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
45 | {%- endif %}
46 | ]
47 |
48 | {% if cookiecutter.github_repository_url != 'provide later' -%}
49 | [project.urls]
50 | "Homepage" = "{{ cookiecutter.github_repository_url }}"
51 | "Bug Tracker" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.package_name}}/issues"
52 | {% if cookiecutter.create_docs == "yes" -%}
53 | "Documentation" = "https://{{cookiecutter.github_username_or_organization}}.github.io/{{cookiecutter.package_name}}"
54 | {% elif cookiecutter.create_docs == "no" -%}
55 | "Documentation" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.package_name}}"
56 | {%- endif %}
57 | "Source Code" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.package_name}}"
58 | "User Support" = "https://github.com/{{cookiecutter.github_username_or_organization}}/{{cookiecutter.package_name}}/issues"
59 | {%- endif %}
60 |
61 | [project.optional-dependencies]
62 | dev = [
63 | "pytest",
64 | "pytest-cov",
65 | "coverage",
66 | "tox",
67 | "mypy",
68 | "pre-commit",
69 | "ruff",
70 | "setuptools-scm",
71 | ]
72 |
73 | [build-system]
74 | requires = [
75 | "setuptools>=64",
76 | "wheel",
77 | "setuptools-scm[toml]>=8",
78 | ]
79 | build-backend = "setuptools.build_meta"
80 |
81 | [tool.setuptools]
82 | include-package-data = true
83 |
84 | [tool.setuptools.packages.find]
85 | include = ["{{cookiecutter.module_name}}*"]
86 | {% if cookiecutter.create_docs == "yes" -%}
87 | exclude = ["tests", "docs*"]
88 | {% elif cookiecutter.create_docs == "no" -%}
89 | exclude = ["tests*"]
90 | {%- endif %}
91 |
92 | [tool.pytest.ini_options]
93 | addopts = "--cov={{cookiecutter.module_name}}"
94 | filterwarnings = [
95 | "error",
96 | ]
97 |
98 | [tool.setuptools_scm]
99 |
100 | [tool.check-manifest]
101 | {% if cookiecutter.create_docs == "yes" -%}
102 | ignore = [
103 | ".yaml",
104 | "tox.ini",
105 | "tests/",
106 | "tests/test_unit/",
107 | "tests/test_integration/",
108 | "docs/",
109 | "docs/source/",
110 | ]
111 | {% elif cookiecutter.create_docs == "no" -%}
112 | ignore = [
113 | ".yaml",
114 | "tox.ini",
115 | "tests/",
116 | "tests/test_unit/",
117 | "tests/test_integration/",
118 | ]
119 | {%- endif %}
120 |
121 | [tool.ruff]
122 | line-length = 79
123 | exclude = ["__init__.py", "build", ".eggs"]
124 | lint.select = [
125 | "E", # pycodestyle errors
126 | "F", # Pyflakes
127 | "I", # isort
128 | # You can see what all the rules do here: https://docs.astral.sh/ruff/rules/
129 | # Some additional ruff rules that might be useful (uncomment to enable)
130 | #"UP", # pyupgrade
131 | #"B", # flake8 bugbear
132 | #"SIM", # flake8 simplify
133 | #"C90", # McCabe complexity
134 | ]
135 | fix = true
136 |
137 | [tool.ruff.format]
138 | docstring-code-format = true # Also format code in docstrings (e.g. examples)
139 |
140 | [tool.tox]
141 | legacy_tox_ini = """
142 | [tox]
143 | envlist = py{311,312,313}
144 | isolated_build = True
145 |
146 | [gh-actions]
147 | python =
148 | 3.11: py311
149 | 3.12: py312
150 | 3.13: py313
151 |
152 | [testenv]
153 | extras =
154 | dev
155 | commands =
156 | pytest -v --color=yes --cov={{cookiecutter.module_name}} --cov-report=xml
157 | """
158 |
159 |
160 | [tool.codespell]
161 | skip = '.git'
162 | check-hidden = true
163 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/{{cookiecutter.package_name}}/tests/__init__.py
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/tests/test_integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/{{cookiecutter.package_name}}/tests/test_integration/__init__.py
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/tests/test_unit/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neuroinformatics-unit/python-cookiecutter/ac805528949af677fde2accf078fa250ba861af8/{{cookiecutter.package_name}}/tests/test_unit/__init__.py
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/tests/test_unit/test_placeholder.py:
--------------------------------------------------------------------------------
1 | def test_placeholder():
2 | assert True
3 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}/__init__.py:
--------------------------------------------------------------------------------
1 | from importlib.metadata import PackageNotFoundError, version
2 |
3 | try:
4 | __version__ = version("{{cookiecutter.package_name}}")
5 | except PackageNotFoundError:
6 | # package is not installed
7 | pass
8 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}/greetings.py:
--------------------------------------------------------------------------------
1 | # Define an example class to demonstrate
2 | # Sphinx's autodoc and autosummary features:
3 | # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
4 | # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
5 |
6 | # Docstrings are written in NumPy format:
7 | # https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
8 |
9 |
10 | class Greetings:
11 | """
12 | A simple example class
13 |
14 | Attributes
15 | ----------
16 | name : str
17 | The name of the person to greet
18 |
19 | Methods
20 | -------
21 | say_hello
22 | Say hello to the person
23 | say_goodbye
24 | Say goodbye to the person
25 | """
26 |
27 | def __init__(self, name):
28 | self.name = name
29 |
30 | def say_hello(self):
31 | """
32 | Say hello to the person
33 | """
34 | print(f"Hello {self.name}!")
35 |
36 | def say_goodbye(self):
37 | """
38 | Say goodbye to the person
39 | """
40 | print(f"Goodbye {self.name}!")
41 |
--------------------------------------------------------------------------------
/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}/math.py:
--------------------------------------------------------------------------------
1 | # Define some example functions to demonstrate
2 | # Sphinx's autodoc and autosummary features:
3 | # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
4 | # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
5 |
6 | # Docstrings are written in NumPy format:
7 | # https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
8 |
9 |
10 | def add_two_integers(a: int, b: int) -> int:
11 | """Add two integer numbers.
12 |
13 | Parameters
14 | ----------
15 | a : int
16 | The first number.
17 | b : int
18 | The second number.
19 |
20 | Returns
21 | -------
22 | int
23 | The sum of the two numbers.
24 | """
25 | return a + b
26 |
27 |
28 | def subtract_two_integers(a: int, b: int) -> int:
29 | """Subtract two integer numbers.
30 |
31 | Parameters
32 | ----------
33 | a : int
34 | The first number.
35 | b : int
36 | The second number.
37 |
38 | Returns
39 | -------
40 | int
41 | The difference of the two numbers.
42 | """
43 | return a - b
44 |
--------------------------------------------------------------------------------