├── scripts ├── whitelist.py ├── spell-check.sh ├── update-deps.py └── check_copyright.py ├── HISTORY.md ├── docs └── index.md ├── AUTHORS.md ├── codecov.yml ├── .spelling ├── CONTRIBUTING.md ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── workflows │ ├── docs.yml │ ├── lint.yml │ ├── pypi-publish.yml │ └── test.yml ├── PULL_REQUEST_TEMPLATE.md └── RELEASE_PR.md ├── tests ├── __init__.py └── test_main.py ├── python_project_template └── __init__.py ├── mkdocs.yml ├── README.md ├── tox.ini ├── Makefile ├── pyproject.toml ├── .pre-commit-config.yaml ├── .bandit.yml ├── .gitignore └── LICENSE /scripts/whitelist.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | # History 2 | 3 | TODO 4 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | {!../README.md!} 2 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | 3 | ## Maintainers 4 | 5 | * [Marco Favorito](https://github.com/marcofavorito) <[favorito@diag.uniroma1.it](mailto:favorito@diag.uniroma1.it)> 6 | 7 | ## Contributors 8 | 9 | None yet. [Why not be the first](./contributing.md)? 10 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | 4 | coverage: 5 | precision: 2 6 | round: down 7 | range: "70...100" 8 | 9 | parsers: 10 | gcov: 11 | branch_detection: 12 | conditional: yes 13 | loop: yes 14 | method: no 15 | macro: no 16 | 17 | comment: 18 | layout: "reach,diff,flags,tree" 19 | behavior: default 20 | require_changes: false 21 | -------------------------------------------------------------------------------- /.spelling: -------------------------------------------------------------------------------- 1 | # markdown-spellcheck spelling configuration file 2 | # Format - lines beginning # are comments 3 | # global dictionary is at the start, file overrides afterwards 4 | # one word per line, to define a file override use ' - filename' 5 | # where filename is relative to this configuration file 6 | README.md 7 | PyPI 8 | linters 9 | favorito 10 | diag.uniroma1.it 11 | v3.0 12 | LGPLv3 13 | gplv3 14 | - AUTHORS.md 15 | o 16 | i 17 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are welcome, and greatly appreciated! Every little bit helps, and credit will always be given. 4 | 5 | If you need support, want to report/fix a bug, ask for/implement features, you can check the 6 | [Issues page](https://github.com/marcofavorito/python-project-template/issues) 7 | or [submit a Pull request](https://github.com/marcofavorito/python-project-template/pulls). 8 | 9 | For other kinds of feedback, you can contact one of the [authors](./authors.md) by email. 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Subject of the issue 11 | Describe your issue here. 12 | 13 | ### Your environment 14 | - OS: [e.g. iOS] 15 | - Python version: [e.g. 3.7.2] 16 | - Package Version [e.g. 0.1.2] 17 | - Anything else you consider helpful. 18 | 19 | ### Steps to reproduce 20 | Tell us how to reproduce this issue. 21 | 22 | ### Expected behaviour 23 | Tell us what should happen 24 | 25 | ### Actual behaviour 26 | Tell us what happens instead 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /scripts/spell-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script requires `mdspell`: 3 | # 4 | # https://www.npmjs.com/package/markdown-spellcheck 5 | # 6 | # Run this script from the root directory. 7 | # Usage: 8 | # ./scripts/spell-check.sh 9 | # 10 | 11 | MDSPELL_PATH="$(which mdspell)" 12 | if [ -z "${MDSPELL_PATH}" ]; then 13 | echo "Cannot find executable 'mdspell'. Please install it to run this script: npm i markdown-spellcheck -g" 14 | exit 127 15 | fi 16 | 17 | echo "Found 'mdspell' executable at ${MDSPELL_PATH}" 18 | 19 | only_check_option="$1" 20 | 21 | if [ "$only_check_option" == "" ]; then 22 | mdspell -n -a --en-gb '**/*.md' '!docs/api/**/*.md' 23 | elif [ "$only_check_option" == "--only-check" ]; then 24 | mdspell -n -a --en-gb '**/*.md' '!docs/api/**/*.md' --report 25 | else 26 | echo "Usage: ./spell-check.sh [--only-check]" 27 | fi 28 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - main 8 | pull_request: 9 | 10 | jobs: 11 | run: 12 | continue-on-error: True 13 | runs-on: ${{ matrix.os }} 14 | 15 | strategy: 16 | matrix: 17 | os: [ubuntu-latest] 18 | python-version: ["3.10"] 19 | 20 | timeout-minutes: 30 21 | 22 | steps: 23 | - uses: actions/checkout@master 24 | - uses: actions/setup-python@master 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - name: Install dependencies 28 | run: | 29 | pip install tox 30 | # Install markdown-spellcheck 31 | sudo npm install -g markdown-spellcheck 32 | - name: Generate Documentation 33 | run: tox -e docs 34 | - name: Install markdown-spellcheck 35 | run: tox -e spell-check 36 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of python-project-template. 2 | # Copyright 2024 Marco Favorito 3 | # 4 | # python-project-template is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # python-project-template is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with python-project-template. If not, see . 16 | # 17 | 18 | """Test for the python-project-template project.""" 19 | -------------------------------------------------------------------------------- /python_project_template/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of python-project-template. 2 | # Copyright 2024 Marco Favorito 3 | # 4 | # python-project-template is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # python-project-template is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with python-project-template. If not, see . 16 | # 17 | 18 | """A Python project template.""" 19 | 20 | __version__ = "0.2.0" 21 | -------------------------------------------------------------------------------- /tests/test_main.py: -------------------------------------------------------------------------------- 1 | # This file is part of python-project-template. 2 | # Copyright 2024 Marco Favorito 3 | # 4 | # python-project-template is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # python-project-template is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with python-project-template. If not, see . 16 | # 17 | 18 | """Main tests.""" 19 | 20 | 21 | def test_example() -> None: 22 | """Test example.""" 23 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | run: 11 | continue-on-error: True 12 | runs-on: ${{ matrix.os }} 13 | 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest] 17 | python-version: [3.9] 18 | 19 | timeout-minutes: 30 20 | 21 | steps: 22 | - uses: actions/checkout@master 23 | - uses: actions/setup-python@master 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | - uses: pre-commit/action@v3.0.0 27 | - name: Install dependencies 28 | run: pip install poetry tox 29 | - name: Check Poetry lock file 30 | run: make poetry-lock-check 31 | - name: Code style check 32 | run: | 33 | tox -e ruff-format,ruff-check,vulture 34 | - name: Static type check 35 | run: tox -e mypy 36 | - name: Check copyright 37 | run: tox -e check-copyright 38 | - name: Misc checks 39 | run: tox -e bandit,safety 40 | -------------------------------------------------------------------------------- /.github/workflows/pypi-publish.yml: -------------------------------------------------------------------------------- 1 | name: Upload Python Package 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | pypi-publish: 12 | name: Upload release to PyPI 13 | runs-on: ubuntu-latest 14 | environment: 15 | name: pypi 16 | url: https://pypi.org/p/ 17 | permissions: 18 | id-token: write # IMPORTANT: this permission is mandatory for trusted publishing 19 | steps: 20 | # retrieve your distributions here 21 | - uses: actions/checkout@v4 22 | - name: Set up Python 23 | uses: actions/setup-python@v5 24 | with: 25 | python-version: '3.x' 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install build 30 | - name: Build package 31 | run: python -m build 32 | - name: Publish package distributions to PyPI 33 | uses: pypa/gh-action-pypi-publish@release/v1 34 | with: 35 | user: __token__ 36 | password: ${{ secrets.PYPI_API_TOKEN }} 37 | print-hash: true 38 | verbose: true 39 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Proposed changes 2 | 3 | Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. 4 | 5 | ## Fixes 6 | 7 | If it fixes a bug or resolves a feature request, be sure to link to that issue. 8 | 9 | ## Types of changes 10 | 11 | What types of changes does your code introduce? 12 | _Put an `x` in the boxes that apply_ 13 | 14 | - [ ] Bugfix (non-breaking change which fixes an issue) 15 | - [ ] New feature (non-breaking change which adds functionality) 16 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 17 | 18 | ## Checklist 19 | 20 | _Put an `x` in the boxes that apply._ 21 | 22 | - [ ] I have read the [CONTRIBUTING](../blob/master/CONTRIBUTING.md) doc 23 | - [ ] I am making a pull request against the `develop` branch (left side). Also you should start your branch off our `develop`. 24 | - [ ] Lint and unit tests pass locally with my changes 25 | - [ ] I have added tests that prove my fix is effective or that my feature works 26 | 27 | ## Further comments 28 | 29 | If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... 30 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: My Docs 2 | repo_name: 'marcofavorito/python-project-template' 3 | repo_url: https://github.com/marcofavorito/python-project-template 4 | 5 | nav: 6 | - Home: index.md 7 | 8 | plugins: 9 | - search 10 | - mknotebooks: 11 | execute: false 12 | write_markdown: false 13 | #preamble: "" 14 | #enable_default_jupyter_cell_styling: false 15 | #enable_default_pandas_dataframe_styling: false 16 | - mkdocstrings: 17 | default_handler: python 18 | handlers: 19 | python: 20 | selection: 21 | docstring_style: sphinx 22 | filters: 23 | - "!^_" # exlude all members starting with _ 24 | - "^__init__$" # but always include __init__ modules and methods 25 | 26 | watch: 27 | - python_project_template 28 | 29 | theme: 30 | name: material 31 | feature: 32 | tabs: true 33 | 34 | 35 | strict: true 36 | 37 | 38 | markdown_extensions: 39 | - codehilite 40 | - pymdownx.arithmatex 41 | - pymdownx.superfences 42 | - pymdownx.highlight 43 | - admonition 44 | - markdown_include.include: 45 | base_path: docs 46 | 47 | extra_javascript: 48 | - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML' 49 | - 'https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js' 50 | -------------------------------------------------------------------------------- /.github/RELEASE_PR.md: -------------------------------------------------------------------------------- 1 | ## Release summary 2 | 3 | Version number: [e.g. 1.0.1] 4 | 5 | ## Release details 6 | 7 | Describe in short the main changes with the new release. 8 | 9 | ## Checklist 10 | 11 | _Put an `x` in the boxes that apply._ 12 | 13 | - [ ] I have read the [CONTRIBUTING](../master/CONTRIBUTING.md) doc 14 | - [ ] I am making a pull request against the `master` branch (left side), from `develop` 15 | - [ ] I've updated the dependencies versions to the latest, wherever is possible. 16 | - [ ] Lint and unit tests pass locally (please run tests also manually, not only with `tox`) 17 | - [ ] I built the documentation and updated it with the latest changes 18 | - [ ] I've added an item in `HISTORY.md` for this release 19 | - [ ] I bumped the version number in the `__init__.py` file. 20 | - [ ] I published the latest version on TestPyPI and checked that the following command work: 21 | ```pip install python-project-template== --index-url https://test.pypi.org/simple --force --no-cache-dir --no-deps``` 22 | - [ ] After merging the PR, I'll publish the build also on PyPI. Then, I'll make sure the following 23 | command will work: 24 | ```pip install python-project-template== --force --no-cache-dir --no-deps``` 25 | - [ ] After merging the PR, I'll tag the repo with `v${VERSION_NUMVER}` (e.g. `v0.1.2`) 26 | 27 | 28 | ## Further comments 29 | 30 | Write here any other comment about the release, if any. 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | run: 11 | continue-on-error: True 12 | runs-on: ${{ matrix.os }} 13 | 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest, macos-latest, windows-latest] 17 | python-version: ["3.9", "3.10", "3.11", "3.12"] 18 | 19 | timeout-minutes: 30 20 | 21 | steps: 22 | - uses: actions/checkout@master 23 | - uses: actions/setup-python@master 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | - name: Install dependencies 27 | run: pip install tox poetry 28 | # # set up environment depending on the platform in use 29 | # - if: matrix.os == 'ubuntu-latest' 30 | # name: Install dependencies (ubuntu-latest) 31 | # run: ... 32 | # - if: matrix.os == 'macos-latest' 33 | # name: Install dependencies (macos-latest) 34 | # run: ... 35 | # - if: matrix.os == 'windows-latest' 36 | # name: Install dependencies (windows-latest) 37 | # env: 38 | # ACTIONS_ALLOW_UNSECURE_COMMANDS: true 39 | # run: ... 40 | - name: Unit tests and coverage 41 | run: | 42 | tox -e py${{ matrix.python-version }} 43 | - name: Upload coverage to Codecov 44 | uses: codecov/codecov-action@v4 45 | env: 46 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 47 | with: 48 | fail_ci_if_error: true # optional (default = false) 49 | files: ./coverage.xml # optional 50 | flags: unittests # optional 51 | name: codecov-umbrella # optional 52 | verbose: true # optional (default = false) 53 | -------------------------------------------------------------------------------- /scripts/update-deps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # This file is part of python-project-template. 3 | # Copyright 2024 Marco Favorito 4 | # 5 | # python-project-template is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # python-project-template is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with python-project-template. If not, see . 17 | # 18 | 19 | """Update dependency versions in pyproject.toml and tox.ini.""" 20 | 21 | import json 22 | import re 23 | import ssl 24 | import sys 25 | import urllib.request 26 | from pathlib import Path 27 | 28 | VERSION_INFO_URL = "https://pypi.org/pypi/{}/json" 29 | IGNORE = {"ipython", "tox"} 30 | 31 | 32 | def get_latest_version(package_name: str) -> str: 33 | """Get latest version of package_name from PyPI.""" 34 | url = VERSION_INFO_URL.format(package_name) 35 | ssl_context = ssl.create_default_context() 36 | with urllib.request.urlopen(url, context=ssl_context) as response: # noqa: S310 # nosec S310 37 | data = json.load(response) 38 | return data["info"]["version"] 39 | 40 | 41 | if __name__ == "__main__": 42 | pyprojecttoml = Path("pyproject.toml") 43 | toxini = Path("tox.ini") 44 | pyprojecttoml_content = pyprojecttoml.read_text(encoding="utf-8") 45 | toxini_content = toxini.read_text(encoding="utf-8") 46 | 47 | # replace in pyproject.toml 48 | matches = re.findall( 49 | '^([a-zA-Z0-9_-]+) += +"==(.*)"', pyprojecttoml_content, re.MULTILINE 50 | ) 51 | for package_name, version in matches: 52 | if package_name in IGNORE: 53 | continue 54 | latest_version = get_latest_version(package_name) 55 | if version != latest_version: 56 | print(f"Updating {package_name} from {version} to {latest_version}") 57 | pyprojecttoml_content = re.sub( 58 | f'(?:^|(?<=\\W)){package_name} *= *"=={version}"', 59 | f'{package_name} = "=={latest_version}"', 60 | pyprojecttoml_content, 61 | ) 62 | toxini_content = re.sub( 63 | f"(?:^|(?<=\\W)){package_name} *== *{version}", 64 | f"{package_name}=={latest_version}", 65 | toxini_content, 66 | ) 67 | 68 | pyprojecttoml.write_text(pyprojecttoml_content) 69 | toxini.write_text(toxini_content) 70 | print("Done!") 71 | sys.exit(0) 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | (yet another) Python project template 3 |

4 | 5 |

6 | 7 | PyPI 8 | 9 | 10 | PyPI - Python Version 11 | 12 | 13 | PyPI - Status 14 | 15 | 16 | PyPI - Implementation 17 | 18 | 19 | PyPI - Wheel 20 | 21 | 22 | GitHub 23 | 24 | pre-commit 25 |

26 |

27 | 28 | test 29 | 30 | 31 | lint 32 | 33 | 34 | docs 35 | 36 | 37 | codecov 38 | 39 |

40 | 41 | 42 | Yet another Python project template. 43 | 44 | ## Install 45 | 46 | (TODO replace) To install the package from PyPI: 47 | ``` 48 | pip install python_project_template 49 | ``` 50 | 51 | ## Development 52 | 53 | Clone the repository: 54 | ``` 55 | git clone https://github.com/marcofavorito/python-project-template 56 | cd python-project-template 57 | ``` 58 | 59 | Set up virtual environment using [Poetry](https://python-poetry.org/): 60 | ``` 61 | poetry shell 62 | poetry install 63 | ``` 64 | 65 | ## Tests 66 | 67 | To run tests: `tox` 68 | 69 | To run only the code tests: `tox -e py312` 70 | 71 | To run only the linters: 72 | - `tox -e ruff-check` 73 | - `tox -e ruff-format` 74 | - `tox -e mypy` 75 | 76 | Please look at the `tox.ini` file or run `tox -l` for the full list of supported commands. 77 | 78 | ## Docs 79 | 80 | To build the docs: `mkdocs build` 81 | 82 | To view documentation in a browser: `mkdocs serve` 83 | and then go to [http://localhost:8000](http://localhost:8000) 84 | 85 | ## License 86 | 87 | python-project-template is released under the GNU General Public License v3.0 or later (GPLv3+). 88 | 89 | Copyright 2024 Marco Favorito 90 | 91 | ## Authors 92 | 93 | - [Marco Favorito](https://marcofavorito.me/) 94 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | isolated_build = True 3 | envlist = bandit, check-copyright, docs, mypy, py3{9,10,11,12}, safety, spell-check, ruff-format, ruff-check, vulture 4 | 5 | [testenv] 6 | setenv = 7 | PYTHONPATH = {toxinidir} 8 | deps = 9 | hypothesis==6.112.0 10 | hypothesis-pytest==0.19.0 11 | pytest==8.3.2 12 | pytest-cov==5.0.0 13 | pytest-randomly==3.15.0 14 | ; Other test dependencies 15 | ; ... 16 | ; Main dependencies 17 | ; TODO 18 | 19 | commands = 20 | pytest --basetemp={envtmpdir} python_project_template tests/ \ 21 | --cov=python_project_template \ 22 | --cov-report=xml \ 23 | --cov-report=html \ 24 | --cov-report=term 25 | 26 | [testenv:bandit] 27 | skipsdist = True 28 | skip_install = True 29 | deps = bandit==1.7.9 30 | commands = bandit -c .bandit.yml -r python_project_template tests scripts 31 | 32 | [testenv:check-copyright] 33 | skip_install = True 34 | deps = 35 | commands = python3 {toxinidir}/scripts/check_copyright.py 36 | 37 | [testenv:docs] 38 | skip_install = True 39 | deps = 40 | markdown==3.7 41 | markdown-include==0.8.1 42 | mkdocs==1.6.1 43 | mkdocs-autorefs==1.2.0 44 | mkdocs-bibtex==2.16.2 45 | mkdocs-material==9.5.34 46 | mkdocstrings==0.26.1 47 | mknotebooks==0.8.0 48 | pymdown-extensions==10.9 49 | commands = 50 | mkdocs build --clean 51 | 52 | [testenv:docs-serve] 53 | skip_install = True 54 | deps = 55 | markdown==3.7 56 | markdown-include==0.8.1 57 | mkdocs==1.6.1 58 | mkdocs-autorefs==1.2.0 59 | mkdocs-bibtex==2.16.2 60 | mkdocs-material==9.5.34 61 | mkdocstrings==0.26.1 62 | mknotebooks==0.8.0 63 | pymdown-extensions==10.9 64 | commands = 65 | mkdocs build --clean 66 | python -c 'print("###### Starting local server. Press Control+C to stop server ######")' 67 | mkdocs serve 68 | 69 | [testenv:mypy] 70 | deps = 71 | mypy==1.11.2 72 | commands = 73 | mypy python_project_template tests scripts 74 | 75 | [testenv:ruff-check] 76 | skip_install = True 77 | deps = ruff==0.6.4 78 | commands = ruff check . 79 | 80 | [testenv:ruff-check-apply] 81 | skip_install = True 82 | deps = ruff==0.6.4 83 | commands = ruff check --fix --show-fixes . 84 | 85 | [testenv:ruff-format] 86 | skip_install = True 87 | deps = ruff==0.6.4 88 | commands = ruff format --diff . 89 | 90 | [testenv:ruff-format-apply] 91 | skip_install = True 92 | deps = ruff==0.6.4 93 | commands = ruff format . 94 | 95 | [testenv:safety] 96 | skipsdist = True 97 | skip_install = True 98 | deps = safety==3.2.7 99 | commands = safety check -i 70612 100 | 101 | [testenv:spell-check] 102 | skip_install = True 103 | allowlist_externals = {toxinidir}/scripts/spell-check.sh 104 | deps = 105 | commands = {toxinidir}/scripts/spell-check.sh 106 | 107 | [testenv:spell-check-report] 108 | skip_install = True 109 | allowlist_externals = {toxinidir}/scripts/spell-check.sh 110 | deps = 111 | commands = {toxinidir}/scripts/spell-check.sh --only-check 112 | 113 | [testenv:vulture] 114 | skipsdist = True 115 | skip_install = True 116 | deps = vulture==2.11 117 | commands = vulture python_project_template scripts/whitelist.py 118 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := help 2 | 3 | define PRINT_HELP_PYSCRIPT 4 | import re, sys 5 | 6 | for line in sys.stdin: 7 | match = re.match(r'^([0-9a-zA-Z_-]+):.*?## (.*)$$', line) 8 | if match: 9 | target, help = match.groups() 10 | print("%-20s %s" % (target, help)) 11 | endef 12 | export PRINT_HELP_PYSCRIPT 13 | 14 | 15 | .PHONY: help 16 | help: 17 | @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) 18 | 19 | .PHONY: clean 20 | clean: clean-build clean-pyc clean-test clean-docs ## remove all build, test, coverage and Python artifacts 21 | 22 | .PHONY: clean-build 23 | clean-build: ## remove build artifacts 24 | rm -fr build/ 25 | rm -fr dist/ 26 | rm -fr .eggs/ 27 | find . -name '*.egg-info' -exec rm -fr {} + 28 | find . -name '*.egg' -exec rm -f {} + 29 | 30 | .PHONY: clean-pyc 31 | clean-pyc: ## remove Python file artifacts 32 | find . -name '*.pyc' -exec rm -f {} + 33 | find . -name '*.pyo' -exec rm -f {} + 34 | find . -name '*~' -exec rm -f {} + 35 | find . -name '__pycache__' -exec rm -fr {} + 36 | 37 | .PHONY: clean-docs 38 | clean-docs: ## remove MkDocs products. 39 | mkdocs build --clean 40 | rm -fr site/ 41 | 42 | 43 | .PHONY: clean-test 44 | clean-test: ## remove test and coverage artifacts 45 | rm -fr .tox/ 46 | rm -f .coverage 47 | rm -fr htmlcov/ 48 | rm -fr .pytest_cache 49 | rm -fr .mypy_cache 50 | rm -fr coverage.xml 51 | rm -fr .hypothesis 52 | 53 | .PHONY: lint-all 54 | lint-all: ruff-format ruff-check static bandit safety vulture ## run all linters 55 | 56 | .PHONY: poetry-lock-check 57 | poetry-lock-check: ## check if poetry.lock is consistent with pyproject.toml 58 | poetry check --lock 59 | 60 | .PHONY: static 61 | static: ## static type checking with mypy 62 | mypy 63 | 64 | .PHONY: ruff-format 65 | rufff: ## check ruff formatting 66 | ruff format --diff . 67 | 68 | .PHONY: ruff-format-check 69 | ruff-format: ## check ruff formatting 70 | ruff format . 71 | 72 | .PHONY: ruff 73 | ruff: ## run ruff linter 74 | ruff check --fix --show-fixes . 75 | 76 | .PHONY: ruff-check 77 | ruff-check: ## check ruff linter rules 78 | ruff check . 79 | 80 | .PHONY: bandit 81 | bandit: ## run bandit 82 | bandit -c .bandit.yml -r python_project_template tests scripts examples 83 | 84 | .PHONY: safety 85 | safety: ## run safety 86 | safety check -i 70612 87 | 88 | .PHONY: vulture 89 | vulture: ## run vulture 90 | vulture python_project_template scripts/whitelist.py 91 | 92 | .PHONY: test 93 | test: ## run tests quickly with the default Python 94 | pytest tests python_project_template \ 95 | --cov=python_project_template \ 96 | --cov-report=xml \ 97 | --cov-report=html \ 98 | --cov-report=term 99 | 100 | .PHONY: test-all 101 | test-all: ## run tests on every Python version with tox 102 | tox 103 | 104 | .PHONY: coverage 105 | coverage: ## check code coverage quickly with the default Python 106 | coverage run --source python_project_template -m pytest 107 | coverage report -m 108 | coverage html 109 | $(BROWSER) htmlcov/index.html 110 | 111 | .PHONY: docs 112 | docs: ## generate MkDocs HTML documentation, including API docs 113 | mkdocs build --clean 114 | 115 | .PHONY: servedocs 116 | servedocs: docs ## compile the docs watching for changes 117 | mkdocs build --clean 118 | python -c 'print("###### Starting local server. Press Control+C to stop server ######")' 119 | mkdocs serve 120 | 121 | .PHONY: release 122 | release: dist ## package and upload a release 123 | twine upload dist/* 124 | 125 | .PHONY: dist 126 | dist: clean ## builds source and wheel package 127 | poetry build 128 | ls -l dist 129 | -------------------------------------------------------------------------------- /scripts/check_copyright.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # This file is part of python-project-template. 3 | # Copyright 2024 Marco Favorito 4 | # 5 | # python-project-template is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # python-project-template is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with python-project-template. If not, see . 17 | # 18 | 19 | """Check that all the Python files of the repository have the copyright notice. 20 | 21 | In particular: 22 | - (optional) the Python shebang 23 | - the encoding header; 24 | - the copyright and license notices; 25 | 26 | It is assumed the script is run from the repository root. 27 | """ 28 | 29 | import itertools 30 | import re 31 | import sys 32 | from pathlib import Path 33 | 34 | COPYRIGHT_NOTICE = "Copyright 2024 Marco Favorito" 35 | HEADER_REGEX = re.compile( 36 | rf"""(#!/usr/bin/env python3 37 | )?# This file is part of python-project-template\. 38 | # {COPYRIGHT_NOTICE} 39 | # 40 | # python-project-template is free software: you can redistribute it and/or modify 41 | # it under the terms of the GNU General Public License as published by 42 | # the Free Software Foundation, either version 3 of the License, or 43 | # \(at your option\) any later version\. 44 | # 45 | # python-project-template is distributed in the hope that it will be useful, 46 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 47 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\. See the 48 | # GNU General Public License for more details\. 49 | # 50 | # You should have received a copy of the GNU General Public License 51 | # along with python-project-template\. If not, see \. 52 | #""", 53 | re.MULTILINE, 54 | ) 55 | 56 | 57 | def check_copyright(file: Path) -> bool: 58 | """Given a file, check if the header stuff is in place. 59 | 60 | Return True if the files has the encoding header and the copyright notice, 61 | optionally prefixed by the shebang. Return False otherwise. 62 | 63 | :param file: the file to check. 64 | :return: True if the file is compliant with the checks, False otherwise. 65 | """ 66 | content = file.read_text() 67 | return re.match(HEADER_REGEX, content) is not None 68 | 69 | 70 | def check_copyright_in_readme() -> bool: 71 | """Check if the README.md contains the right copyright notice.""" 72 | readme_filepath = Path("README.md").resolve() 73 | if not readme_filepath.exists(): 74 | msg = f"README file {readme_filepath} does not exist" 75 | raise ValueError(msg) 76 | readme_content = readme_filepath.read_text() 77 | matches = re.findall("Copyright .*", readme_content) 78 | if len(matches) == 0: 79 | return False 80 | for match in matches: 81 | if match != COPYRIGHT_NOTICE: 82 | return False 83 | print("README is OK.") 84 | return True 85 | 86 | 87 | def check_copyright_headers() -> bool: 88 | """Check copyright headers are correct.""" 89 | exclude_files = {Path("scripts", "whitelist.py")} 90 | python_files = filter( 91 | lambda x: x not in exclude_files, 92 | itertools.chain( 93 | Path("python_project_template").glob("**/*.py"), 94 | Path("tests").glob("**/*.py"), 95 | Path("scripts").glob("**/*.py"), 96 | ), 97 | ) 98 | 99 | bad_files = [] 100 | for filepath in python_files: 101 | print(f"Checking file {filepath}...", end=" ") 102 | result = check_copyright(filepath) 103 | if result: 104 | print("OK") 105 | else: 106 | print("FAIL") 107 | bad_files.append(filepath) 108 | 109 | if len(bad_files) > 0: 110 | print("The following files are not well formatted:") 111 | print("\n".join(map(str, bad_files))) 112 | return False 113 | return True 114 | 115 | 116 | if __name__ == "__main__": 117 | result: bool = check_copyright_headers() 118 | result = result and check_copyright_in_readme() 119 | if not result: 120 | sys.exit(1) 121 | print("All checks have passed!") 122 | sys.exit(0) 123 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "python-project-template" 3 | version = "0.2.0" 4 | description = "A Python project template." 5 | authors = ["Marco Favorito "] 6 | license = "GPL-3.0-or-later" 7 | readme = "README.md" 8 | homepage = "https://marcofavorito.me/python-project-template" 9 | repository = "https://github.com/marcofavorito/python-project-template.git" 10 | documentation = "https://marcofavorito.me/python-project-template" 11 | keywords = [] 12 | classifiers = [ 13 | 'Development Status :: 2 - Pre-Alpha', 14 | 'Intended Audience :: Developers', 15 | 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 16 | 'Operating System :: Unix', 17 | 'Operating System :: POSIX', 18 | 'Operating System :: Microsoft :: Windows', 19 | 'Natural Language :: English', 20 | 'Programming Language :: Python :: 3', 21 | 'Programming Language :: Python :: 3.9', 22 | 'Programming Language :: Python :: 3.10', 23 | 'Programming Language :: Python :: 3.11', 24 | 'Programming Language :: Python :: 3.12', 25 | 'Programming Language :: Python :: Implementation :: CPython', 26 | ] 27 | #packages = [] 28 | include = [] 29 | 30 | 31 | #[tool.poetry.scripts] 32 | #script_name = 'path/to/script' 33 | 34 | [tool.poetry.urls] 35 | "Bug Tracker" = "https://github.com/marcofavorito/python-project-template/issues" 36 | "Pull Requests" = "https://github.com/marcofavorito/python-project-template/pulls" 37 | 38 | 39 | [tool.poetry.dependencies] 40 | python = ">=3.9,<3.13" 41 | 42 | [tool.poetry.group.dev.dependencies] 43 | bandit = "==1.7.9" 44 | codecov = "==2.1.13" 45 | hypothesis = "==6.112.0" 46 | hypothesis-pytest = "==0.19.0" 47 | ipython = "==8.18.0" 48 | jupyter = "==1.1.1" 49 | markdown = "==3.7" 50 | markdown-include = "==0.8.1" 51 | mkdocs = "==1.6.1" 52 | mkdocs-autorefs = "==1.2.0" 53 | mkdocs-bibtex = "==2.16.2" 54 | mkdocs-material = "==9.5.34" 55 | mkdocstrings = "==0.26.1" 56 | mknotebooks = "==0.8.0" 57 | mypy = "==1.11.2" 58 | pymdown-extensions = "==10.9" 59 | pytest = "==8.3.2" 60 | pytest-checkipdb = "==1.1.1" 61 | pytest-cov = "==5.0.0" 62 | pytest-randomly = "==3.15.0" 63 | ruff = "==0.6.4" 64 | safety = "==3.2.7" 65 | tox = "==4.11.0" 66 | twine = "==5.1.1" 67 | vulture = "==2.11" 68 | pre-commit = "==3.8.0" 69 | 70 | 71 | [build-system] 72 | requires = ["poetry-core>=1.0.0"] 73 | build-backend = "poetry.core.masonry.api" 74 | 75 | 76 | ################################################## 77 | # Mypy configuration 78 | ################################################## 79 | 80 | [tool.mypy] 81 | python_version = "3.9" 82 | strict_optional = true 83 | plugins = [ 84 | # "numpy.typing.mypy_plugin" 85 | ] 86 | files = [ 87 | "python_project_template", 88 | "tests", 89 | "scripts", 90 | ] 91 | #to add other directories: "other/dir.*|..." 92 | exclude = [ 93 | "scripts/whitelists*" 94 | ] 95 | disallow_untyped_defs = true 96 | 97 | # mypy per-module options: 98 | # 99 | #[[tool.mypy.overrides]] 100 | #module = "mycode.foo.*" 101 | #disallow_untyped_defs = true 102 | # 103 | #[[tool.mypy.overrides]] 104 | #module = "mycode.bar" 105 | #warn_return_any = false 106 | # 107 | #[[tool.mypy.overrides]] 108 | #module = [ 109 | # "somelibrary", 110 | # "some_other_library" 111 | #] 112 | #ignore_missing_imports = true 113 | 114 | ################################################## 115 | # Ruff configuration 116 | ################################################## 117 | [tool.ruff] 118 | # Exclude a variety of commonly ignored directories. 119 | exclude = [ 120 | ".bzr", 121 | ".direnv", 122 | ".eggs", 123 | ".git", 124 | ".git-rewrite", 125 | ".hg", 126 | ".ipynb_checkpoints", 127 | ".mypy_cache", 128 | ".nox", 129 | ".pants.d", 130 | ".pyenv", 131 | ".pytest_cache", 132 | ".pytype", 133 | ".ruff_cache", 134 | ".svn", 135 | ".tox", 136 | ".venv", 137 | ".vscode", 138 | "__pypackages__", 139 | "_build", 140 | "buck-out", 141 | "build", 142 | "dist", 143 | "node_modules", 144 | "site-packages", 145 | "venv", 146 | ] 147 | 148 | # Same as Black. 149 | line-length = 88 150 | indent-width = 4 151 | 152 | # Assume Python 3.9 153 | target-version = "py39" 154 | 155 | include = ["python_project_template/**/*.py", "scripts/**/*.py", "tests/**/*.py"] 156 | 157 | [tool.ruff.lint] 158 | select = ["ALL"] 159 | ignore = ["COM812", "D203", "D213", "ISC001"] 160 | 161 | # Allow fix for all enabled rules (when `--fix`) is provided. 162 | fixable = ["ALL"] 163 | unfixable = [] 164 | 165 | # Allow unused variables when underscore-prefixed. 166 | dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" 167 | 168 | [tool.ruff.lint.per-file-ignores] 169 | "scripts/check_copyright.py" = ["T201"] 170 | "scripts/update-deps.py" = ["T201"] 171 | "scripts/whitelist.py" = ["D100", "INP001"] 172 | 173 | 174 | 175 | [tool.ruff.format] 176 | # Like Black, use double quotes for strings. 177 | quote-style = "double" 178 | 179 | # Like Black, indent with spaces, rather than tabs. 180 | indent-style = "space" 181 | 182 | # Like Black, respect magic trailing commas. 183 | skip-magic-trailing-comma = false 184 | 185 | # Like Black, automatically detect the appropriate line ending. 186 | line-ending = "auto" 187 | 188 | ################################################## 189 | # Pytest configuration 190 | ################################################## 191 | [tool.pytest.ini_options] 192 | minversion = "6.0" 193 | addopts = [ 194 | "-ra -q", 195 | "--import-mode=importlib", 196 | "--doctest-modules" 197 | ] 198 | testpaths = [ 199 | "tests", 200 | ] 201 | log_cli = 1 202 | log_cli_level = "DEBUG" 203 | log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" 204 | log_cli_date_format = "%Y-%m-%d %H:%M:%S" 205 | 206 | 207 | ################################################## 208 | # Coverage configuration 209 | ################################################## 210 | [tool.coverage.run] 211 | branch = true 212 | omit = ["*/.tox/*"] 213 | 214 | [tool.coverage.report] 215 | # Regexes for lines to exclude from consideration 216 | exclude_also = [ 217 | # Don't complain about missing debug-only code: 218 | "def __repr__", 219 | "if self\\.debug", 220 | 221 | # Don't complain if tests don't hit defensive assertion code: 222 | "raise AssertionError", 223 | "raise NotImplementedError", 224 | 225 | # Don't complain if non-runnable code isn't run: 226 | "if 0:", 227 | "if __name__ == .__main__.:", 228 | 229 | # Don't complain about abstract methods, they aren't run: 230 | "@(abc\\.)?abstractmethod", 231 | ] 232 | 233 | ignore_errors = true 234 | 235 | exclude_lines = [ 236 | "pragma: no cover", 237 | "pragma: nocover" 238 | ] 239 | 240 | [tool.coverage.html] 241 | directory = "htmlcov" 242 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | fail_fast: false 4 | default_language_version: 5 | # force all unspecified python hooks to run python3 6 | python: python3 7 | repos: 8 | - repo: https://github.com/pre-commit/pre-commit-hooks 9 | rev: v4.5.0 10 | hooks: 11 | - id: check-added-large-files 12 | name: check for added large files 13 | description: prevents giant files from being committed. 14 | entry: check-added-large-files 15 | language: python 16 | stages: [commit, push, manual] 17 | - id: check-ast 18 | name: check python ast 19 | description: simply checks whether the files parse as valid python. 20 | entry: check-ast 21 | language: python 22 | types: [python] 23 | - id: check-byte-order-marker 24 | name: 'check BOM - deprecated: use fix-byte-order-marker' 25 | description: forbids files which have a utf-8 byte-order marker. 26 | entry: check-byte-order-marker 27 | language: python 28 | types: [text] 29 | - id: check-builtin-literals 30 | name: check builtin type constructor use 31 | description: requires literal syntax when initializing empty or zero python builtin types. 32 | entry: check-builtin-literals 33 | language: python 34 | types: [python] 35 | - id: check-case-conflict 36 | name: check for case conflicts 37 | description: checks for files that would conflict in case-insensitive filesystems. 38 | entry: check-case-conflict 39 | language: python 40 | - id: check-docstring-first 41 | name: check docstring is first 42 | description: checks a common error of defining a docstring after code. 43 | entry: check-docstring-first 44 | language: python 45 | types: [python] 46 | - id: check-executables-have-shebangs 47 | name: check that executables have shebangs 48 | description: ensures that (non-binary) executables have a shebang. 49 | entry: check-executables-have-shebangs 50 | language: python 51 | types: [text, executable] 52 | stages: [commit, push, manual] 53 | - id: check-json 54 | name: check json 55 | description: checks json files for parseable syntax. 56 | entry: check-json 57 | language: python 58 | types: [json] 59 | - id: check-shebang-scripts-are-executable 60 | name: check that scripts with shebangs are executable 61 | description: ensures that (non-binary) files with a shebang are executable. 62 | entry: check-shebang-scripts-are-executable 63 | language: python 64 | types: [text] 65 | stages: [commit, push, manual] 66 | - id: pretty-format-json 67 | name: pretty format json 68 | description: sets a standard for formatting json files. 69 | entry: pretty-format-json 70 | language: python 71 | types: [json] 72 | - id: check-merge-conflict 73 | name: check for merge conflicts 74 | description: checks for files that contain merge conflict strings. 75 | entry: check-merge-conflict 76 | language: python 77 | types: [text] 78 | - id: check-symlinks 79 | name: check for broken symlinks 80 | description: checks for symlinks which do not point to anything. 81 | entry: check-symlinks 82 | language: python 83 | types: [symlink] 84 | - id: check-toml 85 | name: check toml 86 | description: checks toml files for parseable syntax. 87 | entry: check-toml 88 | language: python 89 | types: [toml] 90 | - id: check-vcs-permalinks 91 | name: check vcs permalinks 92 | description: ensures that links to vcs websites are permalinks. 93 | entry: check-vcs-permalinks 94 | language: python 95 | types: [text] 96 | - id: check-xml 97 | name: check xml 98 | description: checks xml files for parseable syntax. 99 | entry: check-xml 100 | language: python 101 | types: [xml] 102 | - id: check-yaml 103 | name: check yaml 104 | description: checks yaml files for parseable syntax. 105 | entry: check-yaml 106 | language: python 107 | types: [yaml] 108 | - id: debug-statements 109 | name: debug statements (python) 110 | description: checks for debugger imports and py37+ `breakpoint()` calls in python source. 111 | entry: debug-statement-hook 112 | language: python 113 | types: [python] 114 | - id: destroyed-symlinks 115 | name: detect destroyed symlinks 116 | description: detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to. 117 | entry: destroyed-symlinks 118 | language: python 119 | types: [file] 120 | - id: detect-aws-credentials 121 | name: detect aws credentials 122 | description: detects *your* aws credentials from the aws cli credentials file. 123 | entry: detect-aws-credentials 124 | language: python 125 | types: [text] 126 | args: ["--allow-missing-credentials"] 127 | - id: detect-private-key 128 | name: detect private key 129 | description: detects the presence of private keys. 130 | entry: detect-private-key 131 | language: python 132 | types: [text] 133 | # - id: double-quote-string-fixer 134 | # name: fix double quoted strings 135 | # description: replaces double quoted strings with single quoted strings. 136 | # entry: double-quote-string-fixer 137 | # language: python 138 | # types: [python] 139 | - id: end-of-file-fixer 140 | name: fix end of files 141 | description: ensures that a file is either empty, or ends with one newline. 142 | entry: end-of-file-fixer 143 | language: python 144 | types: [text] 145 | stages: [commit, push, manual] 146 | - id: file-contents-sorter 147 | name: file contents sorter 148 | description: sorts the lines in specified files (defaults to alphabetical). you must provide list of target files as input in your .pre-commit-config.yaml file. 149 | entry: file-contents-sorter 150 | language: python 151 | files: '^$' 152 | - id: fix-byte-order-marker 153 | name: fix utf-8 byte order marker 154 | description: removes utf-8 byte order marker. 155 | entry: fix-byte-order-marker 156 | language: python 157 | types: [text] 158 | # - id: fix-encoding-pragma 159 | # name: fix python encoding pragma 160 | # description: 'adds # -*- coding: utf-8 -*- to the top of python files.' 161 | # language: python 162 | # entry: fix-encoding-pragma 163 | # types: [python] 164 | - id: forbid-new-submodules 165 | name: forbid new submodules 166 | description: prevents addition of new git submodules. 167 | language: python 168 | entry: forbid-new-submodules 169 | types: [directory] 170 | - id: forbid-submodules 171 | name: forbid submodules 172 | description: forbids any submodules in the repository 173 | language: fail 174 | entry: 'submodules are not allowed in this repository:' 175 | types: [directory] 176 | - id: mixed-line-ending 177 | name: mixed line ending 178 | description: replaces or checks mixed line ending. 179 | entry: mixed-line-ending 180 | language: python 181 | types: [text] 182 | - id: name-tests-test 183 | name: python tests naming 184 | description: verifies that test files are named correctly. 185 | entry: name-tests-test 186 | language: python 187 | files: (^|/)tests/.+\.py$ 188 | exclude: (^|/)tests/__init__.py 189 | args: ['--django'] 190 | # - id: no-commit-to-branch 191 | # name: "don't commit to branch" 192 | # entry: no-commit-to-branch 193 | # language: python 194 | # pass_filenames: false 195 | # always_run: true 196 | - id: requirements-txt-fixer 197 | name: fix requirements.txt 198 | description: sorts entries in requirements.txt. 199 | entry: requirements-txt-fixer 200 | language: python 201 | files: (requirements|constraints).*\.txt$ 202 | # - id: sort-simple-yaml 203 | # name: sort simple yaml files 204 | # description: sorts simple yaml files which consist only of top-level keys, preserving comments and blocks. 205 | # language: python 206 | # entry: sort-simple-yaml 207 | # files: '\.yaml$|\.yml$' 208 | - id: trailing-whitespace 209 | name: trim trailing whitespace 210 | description: trims trailing whitespace. 211 | entry: trailing-whitespace-fixer 212 | language: python 213 | types: [text] 214 | stages: [commit, push, manual] 215 | - repo: https://github.com/pre-commit/pygrep-hooks 216 | rev: v1.10.0 # Use the ref you want to point at 217 | hooks: 218 | - id: python-check-blanket-noqa 219 | - id: python-check-blanket-type-ignore 220 | - id: python-check-mock-methods 221 | - id: python-no-eval 222 | - id: python-no-log-warn 223 | - id: python-use-type-annotations 224 | - id: rst-backticks 225 | - id: rst-directive-colons 226 | - id: rst-inline-touching-normal 227 | - id: text-unicode-replacement-char 228 | -------------------------------------------------------------------------------- /.bandit.yml: -------------------------------------------------------------------------------- 1 | 2 | ### Bandit config file generated from: 3 | # '/home/marcofavorito/.cache/pypoetry/virtualenvs/python-project-template-D-_KhJwn-py3.12/bin/bandit-config-generator -o .bandit.yml' 4 | 5 | ### This config may optionally select a subset of tests to run or skip by 6 | ### filling out the 'tests' and 'skips' lists given below. If no tests are 7 | ### specified for inclusion then it is assumed all tests are desired. The skips 8 | ### set will remove specific tests from the include set. This can be controlled 9 | ### using the -t/-s CLI options. Note that the same test ID should not appear 10 | ### in both 'tests' and 'skips', this would be nonsensical and is detected by 11 | ### Bandit at runtime. 12 | 13 | # Available tests: 14 | # B101 : assert_used 15 | # B102 : exec_used 16 | # B103 : set_bad_file_permissions 17 | # B104 : hardcoded_bind_all_interfaces 18 | # B105 : hardcoded_password_string 19 | # B106 : hardcoded_password_funcarg 20 | # B107 : hardcoded_password_default 21 | # B108 : hardcoded_tmp_directory 22 | # B110 : try_except_pass 23 | # B112 : try_except_continue 24 | # B113 : request_without_timeout 25 | # B201 : flask_debug_true 26 | # B202 : tarfile_unsafe_members 27 | # B301 : pickle 28 | # B302 : marshal 29 | # B303 : md5 30 | # B304 : ciphers 31 | # B305 : cipher_modes 32 | # B306 : mktemp_q 33 | # B307 : eval 34 | # B308 : mark_safe 35 | # B310 : urllib_urlopen 36 | # B311 : random 37 | # B312 : telnetlib 38 | # B313 : xml_bad_cElementTree 39 | # B314 : xml_bad_ElementTree 40 | # B315 : xml_bad_expatreader 41 | # B316 : xml_bad_expatbuilder 42 | # B317 : xml_bad_sax 43 | # B318 : xml_bad_minidom 44 | # B319 : xml_bad_pulldom 45 | # B320 : xml_bad_etree 46 | # B321 : ftplib 47 | # B323 : unverified_context 48 | # B324 : hashlib_insecure_functions 49 | # B401 : import_telnetlib 50 | # B402 : import_ftplib 51 | # B403 : import_pickle 52 | # B404 : import_subprocess 53 | # B405 : import_xml_etree 54 | # B406 : import_xml_sax 55 | # B407 : import_xml_expat 56 | # B408 : import_xml_minidom 57 | # B409 : import_xml_pulldom 58 | # B410 : import_lxml 59 | # B411 : import_xmlrpclib 60 | # B412 : import_httpoxy 61 | # B413 : import_pycrypto 62 | # B415 : import_pyghmi 63 | # B501 : request_with_no_cert_validation 64 | # B502 : ssl_with_bad_version 65 | # B503 : ssl_with_bad_defaults 66 | # B504 : ssl_with_no_version 67 | # B505 : weak_cryptographic_key 68 | # B506 : yaml_load 69 | # B507 : ssh_no_host_key_verification 70 | # B508 : snmp_insecure_version 71 | # B509 : snmp_weak_cryptography 72 | # B601 : paramiko_calls 73 | # B602 : subprocess_popen_with_shell_equals_true 74 | # B603 : subprocess_without_shell_equals_true 75 | # B604 : any_other_function_with_shell_equals_true 76 | # B605 : start_process_with_a_shell 77 | # B606 : start_process_with_no_shell 78 | # B607 : start_process_with_partial_path 79 | # B608 : hardcoded_sql_expressions 80 | # B609 : linux_commands_wildcard_injection 81 | # B610 : django_extra_used 82 | # B611 : django_rawsql_used 83 | # B612 : logging_config_insecure_listen 84 | # B701 : jinja2_autoescape_false 85 | # B702 : use_of_mako_templates 86 | # B703 : django_mark_safe 87 | 88 | exclude_dirs: [] 89 | 90 | # (optional) list included test IDs here, eg '[B101, B406]': 91 | tests: [ 92 | "B101", 93 | "B102", 94 | "B103", 95 | "B104", 96 | "B105", 97 | "B106", 98 | "B107", 99 | "B108", 100 | "B110", 101 | "B112", 102 | "B113", 103 | "B201", 104 | "B202", 105 | "B301", 106 | "B302", 107 | "B303", 108 | "B304", 109 | "B305", 110 | "B306", 111 | "B307", 112 | "B308", 113 | "B310", 114 | "B311", 115 | "B312", 116 | "B313", 117 | "B314", 118 | "B315", 119 | "B316", 120 | "B317", 121 | "B318", 122 | "B319", 123 | "B320", 124 | "B321", 125 | "B323", 126 | "B324", 127 | "B401", 128 | "B402", 129 | "B403", 130 | "B404", 131 | "B405", 132 | "B406", 133 | "B407", 134 | "B408", 135 | "B409", 136 | "B410", 137 | "B411", 138 | "B412", 139 | "B413", 140 | "B415", 141 | "B501", 142 | "B502", 143 | "B503", 144 | "B504", 145 | "B505", 146 | "B506", 147 | "B507", 148 | "B508", 149 | "B509", 150 | "B601", 151 | "B602", 152 | "B603", 153 | "B604", 154 | "B605", 155 | "B606", 156 | "B607", 157 | "B608", 158 | "B609", 159 | "B610", 160 | "B611", 161 | "B612", 162 | "B701", 163 | "B702", 164 | "B703", 165 | ] 166 | 167 | # (optional) list skipped test IDs here, eg '[B101, B406]': 168 | skips: [] 169 | 170 | ### (optional) plugin settings - some test plugins require configuration data 171 | ### that may be given here, per-plugin. All bandit test plugins have a built in 172 | ### set of sensible defaults and these will be used if no configuration is 173 | ### provided. It is not necessary to provide settings for every (or any) plugin 174 | ### if the defaults are acceptable. 175 | 176 | any_other_function_with_shell_equals_true: 177 | no_shell: 178 | - os.execl 179 | - os.execle 180 | - os.execlp 181 | - os.execlpe 182 | - os.execv 183 | - os.execve 184 | - os.execvp 185 | - os.execvpe 186 | - os.spawnl 187 | - os.spawnle 188 | - os.spawnlp 189 | - os.spawnlpe 190 | - os.spawnv 191 | - os.spawnve 192 | - os.spawnvp 193 | - os.spawnvpe 194 | - os.startfile 195 | shell: 196 | - os.system 197 | - os.popen 198 | - os.popen2 199 | - os.popen3 200 | - os.popen4 201 | - popen2.popen2 202 | - popen2.popen3 203 | - popen2.popen4 204 | - popen2.Popen3 205 | - popen2.Popen4 206 | - commands.getoutput 207 | - commands.getstatusoutput 208 | subprocess: 209 | - subprocess.Popen 210 | - subprocess.call 211 | - subprocess.check_call 212 | - subprocess.check_output 213 | - subprocess.run 214 | assert_used: 215 | skips: [] 216 | hardcoded_tmp_directory: 217 | tmp_dirs: 218 | - /tmp 219 | - /var/tmp 220 | - /dev/shm 221 | linux_commands_wildcard_injection: 222 | no_shell: 223 | - os.execl 224 | - os.execle 225 | - os.execlp 226 | - os.execlpe 227 | - os.execv 228 | - os.execve 229 | - os.execvp 230 | - os.execvpe 231 | - os.spawnl 232 | - os.spawnle 233 | - os.spawnlp 234 | - os.spawnlpe 235 | - os.spawnv 236 | - os.spawnve 237 | - os.spawnvp 238 | - os.spawnvpe 239 | - os.startfile 240 | shell: 241 | - os.system 242 | - os.popen 243 | - os.popen2 244 | - os.popen3 245 | - os.popen4 246 | - popen2.popen2 247 | - popen2.popen3 248 | - popen2.popen4 249 | - popen2.Popen3 250 | - popen2.Popen4 251 | - commands.getoutput 252 | - commands.getstatusoutput 253 | subprocess: 254 | - subprocess.Popen 255 | - subprocess.call 256 | - subprocess.check_call 257 | - subprocess.check_output 258 | - subprocess.run 259 | ssl_with_bad_defaults: 260 | bad_protocol_versions: 261 | - PROTOCOL_SSLv2 262 | - SSLv2_METHOD 263 | - SSLv23_METHOD 264 | - PROTOCOL_SSLv3 265 | - PROTOCOL_TLSv1 266 | - SSLv3_METHOD 267 | - TLSv1_METHOD 268 | - PROTOCOL_TLSv1_1 269 | - TLSv1_1_METHOD 270 | ssl_with_bad_version: 271 | bad_protocol_versions: 272 | - PROTOCOL_SSLv2 273 | - SSLv2_METHOD 274 | - SSLv23_METHOD 275 | - PROTOCOL_SSLv3 276 | - PROTOCOL_TLSv1 277 | - SSLv3_METHOD 278 | - TLSv1_METHOD 279 | - PROTOCOL_TLSv1_1 280 | - TLSv1_1_METHOD 281 | start_process_with_a_shell: 282 | no_shell: 283 | - os.execl 284 | - os.execle 285 | - os.execlp 286 | - os.execlpe 287 | - os.execv 288 | - os.execve 289 | - os.execvp 290 | - os.execvpe 291 | - os.spawnl 292 | - os.spawnle 293 | - os.spawnlp 294 | - os.spawnlpe 295 | - os.spawnv 296 | - os.spawnve 297 | - os.spawnvp 298 | - os.spawnvpe 299 | - os.startfile 300 | shell: 301 | - os.system 302 | - os.popen 303 | - os.popen2 304 | - os.popen3 305 | - os.popen4 306 | - popen2.popen2 307 | - popen2.popen3 308 | - popen2.popen4 309 | - popen2.Popen3 310 | - popen2.Popen4 311 | - commands.getoutput 312 | - commands.getstatusoutput 313 | subprocess: 314 | - subprocess.Popen 315 | - subprocess.call 316 | - subprocess.check_call 317 | - subprocess.check_output 318 | - subprocess.run 319 | start_process_with_no_shell: 320 | no_shell: 321 | - os.execl 322 | - os.execle 323 | - os.execlp 324 | - os.execlpe 325 | - os.execv 326 | - os.execve 327 | - os.execvp 328 | - os.execvpe 329 | - os.spawnl 330 | - os.spawnle 331 | - os.spawnlp 332 | - os.spawnlpe 333 | - os.spawnv 334 | - os.spawnve 335 | - os.spawnvp 336 | - os.spawnvpe 337 | - os.startfile 338 | shell: 339 | - os.system 340 | - os.popen 341 | - os.popen2 342 | - os.popen3 343 | - os.popen4 344 | - popen2.popen2 345 | - popen2.popen3 346 | - popen2.popen4 347 | - popen2.Popen3 348 | - popen2.Popen4 349 | - commands.getoutput 350 | - commands.getstatusoutput 351 | subprocess: 352 | - subprocess.Popen 353 | - subprocess.call 354 | - subprocess.check_call 355 | - subprocess.check_output 356 | - subprocess.run 357 | start_process_with_partial_path: 358 | no_shell: 359 | - os.execl 360 | - os.execle 361 | - os.execlp 362 | - os.execlpe 363 | - os.execv 364 | - os.execve 365 | - os.execvp 366 | - os.execvpe 367 | - os.spawnl 368 | - os.spawnle 369 | - os.spawnlp 370 | - os.spawnlpe 371 | - os.spawnv 372 | - os.spawnve 373 | - os.spawnvp 374 | - os.spawnvpe 375 | - os.startfile 376 | shell: 377 | - os.system 378 | - os.popen 379 | - os.popen2 380 | - os.popen3 381 | - os.popen4 382 | - popen2.popen2 383 | - popen2.popen3 384 | - popen2.popen4 385 | - popen2.Popen3 386 | - popen2.Popen4 387 | - commands.getoutput 388 | - commands.getstatusoutput 389 | subprocess: 390 | - subprocess.Popen 391 | - subprocess.call 392 | - subprocess.check_call 393 | - subprocess.check_output 394 | - subprocess.run 395 | subprocess_popen_with_shell_equals_true: 396 | no_shell: 397 | - os.execl 398 | - os.execle 399 | - os.execlp 400 | - os.execlpe 401 | - os.execv 402 | - os.execve 403 | - os.execvp 404 | - os.execvpe 405 | - os.spawnl 406 | - os.spawnle 407 | - os.spawnlp 408 | - os.spawnlpe 409 | - os.spawnv 410 | - os.spawnve 411 | - os.spawnvp 412 | - os.spawnvpe 413 | - os.startfile 414 | shell: 415 | - os.system 416 | - os.popen 417 | - os.popen2 418 | - os.popen3 419 | - os.popen4 420 | - popen2.popen2 421 | - popen2.popen3 422 | - popen2.popen4 423 | - popen2.Popen3 424 | - popen2.Popen4 425 | - commands.getoutput 426 | - commands.getstatusoutput 427 | subprocess: 428 | - subprocess.Popen 429 | - subprocess.call 430 | - subprocess.check_call 431 | - subprocess.check_output 432 | - subprocess.run 433 | subprocess_without_shell_equals_true: 434 | no_shell: 435 | - os.execl 436 | - os.execle 437 | - os.execlp 438 | - os.execlpe 439 | - os.execv 440 | - os.execve 441 | - os.execvp 442 | - os.execvpe 443 | - os.spawnl 444 | - os.spawnle 445 | - os.spawnlp 446 | - os.spawnlpe 447 | - os.spawnv 448 | - os.spawnve 449 | - os.spawnvp 450 | - os.spawnvpe 451 | - os.startfile 452 | shell: 453 | - os.system 454 | - os.popen 455 | - os.popen2 456 | - os.popen3 457 | - os.popen4 458 | - popen2.popen2 459 | - popen2.popen3 460 | - popen2.popen4 461 | - popen2.Popen3 462 | - popen2.Popen4 463 | - commands.getoutput 464 | - commands.getstatusoutput 465 | subprocess: 466 | - subprocess.Popen 467 | - subprocess.call 468 | - subprocess.check_call 469 | - subprocess.check_output 470 | - subprocess.run 471 | try_except_continue: 472 | check_typed_exception: false 473 | try_except_pass: 474 | check_typed_exception: false 475 | weak_cryptographic_key: 476 | weak_key_size_dsa_high: 1024 477 | weak_key_size_dsa_medium: 2048 478 | weak_key_size_ec_high: 160 479 | weak_key_size_ec_medium: 224 480 | weak_key_size_rsa_high: 1024 481 | weak_key_size_rsa_medium: 2048 482 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/tex,vim,tags,latex,linux,macos,python,textmate,sublimetext,pycharm+all,intellij+all,visualstudiocode 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=tex,vim,tags,latex,linux,macos,python,textmate,sublimetext,pycharm+all,intellij+all,visualstudiocode 4 | 5 | ### Intellij+all ### 6 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 7 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 8 | 9 | # User-specific stuff 10 | .idea/**/workspace.xml 11 | .idea/**/tasks.xml 12 | .idea/**/usage.statistics.xml 13 | .idea/**/dictionaries 14 | .idea/**/shelf 15 | 16 | # Generated files 17 | .idea/**/contentModel.xml 18 | 19 | # Sensitive or high-churn files 20 | .idea/**/dataSources/ 21 | .idea/**/dataSources.ids 22 | .idea/**/dataSources.local.xml 23 | .idea/**/sqlDataSources.xml 24 | .idea/**/dynamic.xml 25 | .idea/**/uiDesigner.xml 26 | .idea/**/dbnavigator.xml 27 | 28 | # Gradle 29 | .idea/**/gradle.xml 30 | .idea/**/libraries 31 | 32 | # Gradle and Maven with auto-import 33 | # When using Gradle or Maven with auto-import, you should exclude module files, 34 | # since they will be recreated, and may cause churn. Uncomment if using 35 | # auto-import. 36 | # .idea/artifacts 37 | # .idea/compiler.xml 38 | # .idea/jarRepositories.xml 39 | # .idea/modules.xml 40 | # .idea/*.iml 41 | # .idea/modules 42 | # *.iml 43 | # *.ipr 44 | 45 | # CMake 46 | cmake-build-*/ 47 | 48 | # Mongo Explorer plugin 49 | .idea/**/mongoSettings.xml 50 | 51 | # File-based project format 52 | *.iws 53 | 54 | # IntelliJ 55 | out/ 56 | 57 | # mpeltonen/sbt-idea plugin 58 | .idea_modules/ 59 | 60 | # JIRA plugin 61 | atlassian-ide-plugin.xml 62 | 63 | # Cursive Clojure plugin 64 | .idea/replstate.xml 65 | 66 | # Crashlytics plugin (for Android Studio and IntelliJ) 67 | com_crashlytics_export_strings.xml 68 | crashlytics.properties 69 | crashlytics-build.properties 70 | fabric.properties 71 | 72 | # Editor-based Rest Client 73 | .idea/httpRequests 74 | 75 | # Android studio 3.1+ serialized cache file 76 | .idea/caches/build_file_checksums.ser 77 | 78 | ### Intellij+all Patch ### 79 | # Ignores the whole .idea folder and all .iml files 80 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 81 | 82 | .idea/ 83 | 84 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 85 | 86 | *.iml 87 | modules.xml 88 | .idea/misc.xml 89 | *.ipr 90 | 91 | # Sonarlint plugin 92 | .idea/sonarlint 93 | 94 | ### LaTeX ### 95 | ## Core latex/pdflatex auxiliary files: 96 | *.aux 97 | *.lof 98 | *.log 99 | *.lot 100 | *.fls 101 | *.out 102 | *.toc 103 | *.fmt 104 | *.fot 105 | *.cb 106 | *.cb2 107 | .*.lb 108 | 109 | ## Intermediate documents: 110 | *.dvi 111 | *.xdv 112 | *-converted-to.* 113 | # these rules might exclude image files for figures etc. 114 | # *.ps 115 | # *.eps 116 | # *.pdf 117 | 118 | ## Generated if empty string is given at "Please type another file name for output:" 119 | .pdf 120 | 121 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 122 | *.bbl 123 | *.bcf 124 | *.blg 125 | *-blx.aux 126 | *-blx.bib 127 | *.run.xml 128 | 129 | ## Build tool auxiliary files: 130 | *.fdb_latexmk 131 | *.synctex 132 | *.synctex(busy) 133 | *.synctex.gz 134 | *.synctex.gz(busy) 135 | *.pdfsync 136 | 137 | ## Build tool directories for auxiliary files 138 | # latexrun 139 | latex.out/ 140 | 141 | ## Auxiliary and intermediate files from other packages: 142 | # algorithms 143 | *.alg 144 | *.loa 145 | 146 | # achemso 147 | acs-*.bib 148 | 149 | # amsthm 150 | *.thm 151 | 152 | # beamer 153 | *.nav 154 | *.pre 155 | *.snm 156 | *.vrb 157 | 158 | # changes 159 | *.soc 160 | 161 | # comment 162 | *.cut 163 | 164 | # cprotect 165 | *.cpt 166 | 167 | # elsarticle (documentclass of Elsevier journals) 168 | *.spl 169 | 170 | # endnotes 171 | *.ent 172 | 173 | # fixme 174 | *.lox 175 | 176 | # feynmf/feynmp 177 | *.mf 178 | *.mp 179 | *.t[1-9] 180 | *.t[1-9][0-9] 181 | *.tfm 182 | 183 | #(r)(e)ledmac/(r)(e)ledpar 184 | *.end 185 | *.?end 186 | *.[1-9] 187 | *.[1-9][0-9] 188 | *.[1-9][0-9][0-9] 189 | *.[1-9]R 190 | *.[1-9][0-9]R 191 | *.[1-9][0-9][0-9]R 192 | *.eledsec[1-9] 193 | *.eledsec[1-9]R 194 | *.eledsec[1-9][0-9] 195 | *.eledsec[1-9][0-9]R 196 | *.eledsec[1-9][0-9][0-9] 197 | *.eledsec[1-9][0-9][0-9]R 198 | 199 | # glossaries 200 | *.acn 201 | *.acr 202 | *.glg 203 | *.glo 204 | *.gls 205 | *.glsdefs 206 | *.lzo 207 | *.lzs 208 | 209 | # uncomment this for glossaries-extra (will ignore makeindex's style files!) 210 | # *.ist 211 | 212 | # gnuplottex 213 | *-gnuplottex-* 214 | 215 | # gregoriotex 216 | *.gaux 217 | *.gtex 218 | 219 | # htlatex 220 | *.4ct 221 | *.4tc 222 | *.idv 223 | *.lg 224 | *.trc 225 | *.xref 226 | 227 | # hyperref 228 | *.brf 229 | 230 | # knitr 231 | *-concordance.tex 232 | # TODO Comment the next line if you want to keep your tikz graphics files 233 | *.tikz 234 | *-tikzDictionary 235 | 236 | # listings 237 | *.lol 238 | 239 | # luatexja-ruby 240 | *.ltjruby 241 | 242 | # makeidx 243 | *.idx 244 | *.ilg 245 | *.ind 246 | 247 | # minitoc 248 | *.maf 249 | *.mlf 250 | *.mlt 251 | *.mtc[0-9]* 252 | *.slf[0-9]* 253 | *.slt[0-9]* 254 | *.stc[0-9]* 255 | 256 | # minted 257 | _minted* 258 | *.pyg 259 | 260 | # morewrites 261 | *.mw 262 | 263 | # nomencl 264 | *.nlg 265 | *.nlo 266 | *.nls 267 | 268 | # pax 269 | *.pax 270 | 271 | # pdfpcnotes 272 | *.pdfpc 273 | 274 | # sagetex 275 | *.sagetex.sage 276 | *.sagetex.py 277 | *.sagetex.scmd 278 | 279 | # scrwfile 280 | *.wrt 281 | 282 | # sympy 283 | *.sout 284 | *.sympy 285 | sympy-plots-for-*.tex/ 286 | 287 | # pdfcomment 288 | *.upa 289 | *.upb 290 | 291 | # pythontex 292 | *.pytxcode 293 | pythontex-files-*/ 294 | 295 | # tcolorbox 296 | *.listing 297 | 298 | # thmtools 299 | *.loe 300 | 301 | # TikZ & PGF 302 | *.dpth 303 | *.md5 304 | *.auxlock 305 | 306 | # todonotes 307 | *.tdo 308 | 309 | # vhistory 310 | *.hst 311 | *.ver 312 | 313 | # easy-todo 314 | *.lod 315 | 316 | # xcolor 317 | *.xcp 318 | 319 | # xmpincl 320 | *.xmpi 321 | 322 | # xindy 323 | *.xdy 324 | 325 | # xypic precompiled matrices and outlines 326 | *.xyc 327 | *.xyd 328 | 329 | # endfloat 330 | *.ttt 331 | *.fff 332 | 333 | # Latexian 334 | TSWLatexianTemp* 335 | 336 | ## Editors: 337 | # WinEdt 338 | *.bak 339 | *.sav 340 | 341 | # Texpad 342 | .texpadtmp 343 | 344 | # LyX 345 | *.lyx~ 346 | 347 | # Kile 348 | *.backup 349 | 350 | # gummi 351 | .*.swp 352 | 353 | # KBibTeX 354 | *~[0-9]* 355 | 356 | # TeXnicCenter 357 | *.tps 358 | 359 | # auto folder when using emacs and auctex 360 | ./auto/* 361 | *.el 362 | 363 | # expex forward references with \gathertags 364 | *-tags.tex 365 | 366 | # standalone packages 367 | *.sta 368 | 369 | # Makeindex log files 370 | *.lpz 371 | 372 | # REVTeX puts footnotes in the bibliography by default, unless the nofootinbib 373 | # option is specified. Footnotes are the stored in a file with suffix Notes.bib. 374 | # Uncomment the next line to have this generated file ignored. 375 | #*Notes.bib 376 | 377 | ### LaTeX Patch ### 378 | # LIPIcs / OASIcs 379 | *.vtc 380 | 381 | # glossaries 382 | *.glstex 383 | 384 | ### Linux ### 385 | *~ 386 | 387 | # temporary files which can be created if a process still has a handle open of a deleted file 388 | .fuse_hidden* 389 | 390 | # KDE directory preferences 391 | .directory 392 | 393 | # Linux trash folder which might appear on any partition or disk 394 | .Trash-* 395 | 396 | # .nfs files are created when an open file is removed but is still being accessed 397 | .nfs* 398 | 399 | ### macOS ### 400 | # General 401 | .DS_Store 402 | .AppleDouble 403 | .LSOverride 404 | 405 | # Icon must end with two \r 406 | Icon 407 | 408 | # Thumbnails 409 | ._* 410 | 411 | # Files that might appear in the root of a volume 412 | .DocumentRevisions-V100 413 | .fseventsd 414 | .Spotlight-V100 415 | .TemporaryItems 416 | .Trashes 417 | .VolumeIcon.icns 418 | .com.apple.timemachine.donotpresent 419 | 420 | # Directories potentially created on remote AFP share 421 | .AppleDB 422 | .AppleDesktop 423 | Network Trash Folder 424 | Temporary Items 425 | .apdisk 426 | 427 | ### PyCharm+all ### 428 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 429 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 430 | 431 | # User-specific stuff 432 | 433 | # Generated files 434 | 435 | # Sensitive or high-churn files 436 | 437 | # Gradle 438 | 439 | # Gradle and Maven with auto-import 440 | # When using Gradle or Maven with auto-import, you should exclude module files, 441 | # since they will be recreated, and may cause churn. Uncomment if using 442 | # auto-import. 443 | # .idea/artifacts 444 | # .idea/compiler.xml 445 | # .idea/jarRepositories.xml 446 | # .idea/modules.xml 447 | # .idea/*.iml 448 | # .idea/modules 449 | # *.iml 450 | # *.ipr 451 | 452 | # CMake 453 | 454 | # Mongo Explorer plugin 455 | 456 | # File-based project format 457 | 458 | # IntelliJ 459 | 460 | # mpeltonen/sbt-idea plugin 461 | 462 | # JIRA plugin 463 | 464 | # Cursive Clojure plugin 465 | 466 | # Crashlytics plugin (for Android Studio and IntelliJ) 467 | 468 | # Editor-based Rest Client 469 | 470 | # Android studio 3.1+ serialized cache file 471 | 472 | ### PyCharm+all Patch ### 473 | # Ignores the whole .idea folder and all .iml files 474 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 475 | 476 | 477 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 478 | 479 | 480 | # Sonarlint plugin 481 | 482 | ### Python ### 483 | # Byte-compiled / optimized / DLL files 484 | __pycache__/ 485 | *.py[cod] 486 | *$py.class 487 | 488 | # C extensions 489 | *.so 490 | 491 | # Distribution / packaging 492 | .Python 493 | build/ 494 | develop-eggs/ 495 | dist/ 496 | downloads/ 497 | eggs/ 498 | .eggs/ 499 | lib/ 500 | lib64/ 501 | parts/ 502 | sdist/ 503 | var/ 504 | wheels/ 505 | pip-wheel-metadata/ 506 | share/python-wheels/ 507 | *.egg-info/ 508 | .installed.cfg 509 | *.egg 510 | MANIFEST 511 | 512 | # PyInstaller 513 | # Usually these files are written by a python script from a template 514 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 515 | *.manifest 516 | *.spec 517 | 518 | # Installer logs 519 | pip-log.txt 520 | pip-delete-this-directory.txt 521 | 522 | # Unit test / coverage reports 523 | htmlcov/ 524 | .tox/ 525 | .nox/ 526 | .coverage 527 | .coverage.* 528 | .cache 529 | nosetests.xml 530 | coverage.xml 531 | *.cover 532 | *.py,cover 533 | .hypothesis/ 534 | .pytest_cache/ 535 | pytestdebug.log 536 | 537 | # Translations 538 | *.mo 539 | *.pot 540 | 541 | # Django stuff: 542 | local_settings.py 543 | db.sqlite3 544 | db.sqlite3-journal 545 | 546 | # Flask stuff: 547 | instance/ 548 | .webassets-cache 549 | 550 | # Scrapy stuff: 551 | .scrapy 552 | 553 | # Sphinx documentation 554 | docs/_build/ 555 | doc/_build/ 556 | 557 | # PyBuilder 558 | target/ 559 | 560 | # Jupyter Notebook 561 | .ipynb_checkpoints 562 | 563 | # IPython 564 | profile_default/ 565 | ipython_config.py 566 | 567 | # pyenv 568 | .python-version 569 | 570 | # pipenv 571 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 572 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 573 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 574 | # install all needed dependencies. 575 | #Pipfile.lock 576 | 577 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 578 | __pypackages__/ 579 | 580 | # Celery stuff 581 | celerybeat-schedule 582 | celerybeat.pid 583 | 584 | # SageMath parsed files 585 | *.sage.py 586 | 587 | # Environments 588 | .env 589 | .venv 590 | env/ 591 | venv/ 592 | ENV/ 593 | env.bak/ 594 | venv.bak/ 595 | 596 | # Spyder project settings 597 | .spyderproject 598 | .spyproject 599 | 600 | # Rope project settings 601 | .ropeproject 602 | 603 | # mkdocs documentation 604 | /site 605 | 606 | # mypy 607 | .mypy_cache/ 608 | .dmypy.json 609 | dmypy.json 610 | 611 | # Pyre type checker 612 | .pyre/ 613 | 614 | # pytype static type analyzer 615 | .pytype/ 616 | 617 | ### SublimeText ### 618 | # Cache files for Sublime Text 619 | *.tmlanguage.cache 620 | *.tmPreferences.cache 621 | *.stTheme.cache 622 | 623 | # Workspace files are user-specific 624 | *.sublime-workspace 625 | 626 | # Project files should be checked into the repository, unless a significant 627 | # proportion of contributors will probably not be using Sublime Text 628 | # *.sublime-project 629 | 630 | # SFTP configuration file 631 | sftp-config.json 632 | 633 | # Package control specific files 634 | Package Control.last-run 635 | Package Control.ca-list 636 | Package Control.ca-bundle 637 | Package Control.system-ca-bundle 638 | Package Control.cache/ 639 | Package Control.ca-certs/ 640 | Package Control.merged-ca-bundle 641 | Package Control.user-ca-bundle 642 | oscrypto-ca-bundle.crt 643 | bh_unicode_properties.cache 644 | 645 | # Sublime-github package stores a github token in this file 646 | # https://packagecontrol.io/packages/sublime-github 647 | GitHub.sublime-settings 648 | 649 | ### Tags ### 650 | # Ignore tags created by etags, ctags, gtags (GNU global) and cscope 651 | TAGS 652 | .TAGS 653 | !TAGS/ 654 | tags 655 | .tags 656 | !tags/ 657 | gtags.files 658 | GTAGS 659 | GRTAGS 660 | GPATH 661 | GSYMS 662 | cscope.files 663 | cscope.out 664 | cscope.in.out 665 | cscope.po.out 666 | 667 | 668 | ### TeX ### 669 | 670 | # these rules might exclude image files for figures etc. 671 | # *.ps 672 | # *.eps 673 | # *.pdf 674 | 675 | 676 | 677 | 678 | # latexrun 679 | 680 | # algorithms 681 | 682 | # achemso 683 | 684 | # amsthm 685 | 686 | # beamer 687 | 688 | # changes 689 | 690 | # comment 691 | 692 | # cprotect 693 | 694 | # elsarticle (documentclass of Elsevier journals) 695 | 696 | # endnotes 697 | 698 | # fixme 699 | 700 | # feynmf/feynmp 701 | 702 | 703 | # glossaries 704 | 705 | # uncomment this for glossaries-extra (will ignore makeindex's style files!) 706 | # *.ist 707 | 708 | # gnuplottex 709 | 710 | # gregoriotex 711 | 712 | # htlatex 713 | 714 | # hyperref 715 | 716 | # knitr 717 | # TODO Comment the next line if you want to keep your tikz graphics files 718 | 719 | # listings 720 | 721 | # luatexja-ruby 722 | 723 | # makeidx 724 | 725 | # minitoc 726 | 727 | # minted 728 | 729 | # morewrites 730 | 731 | # nomencl 732 | 733 | # pax 734 | 735 | # pdfpcnotes 736 | 737 | # sagetex 738 | 739 | # scrwfile 740 | 741 | # sympy 742 | 743 | # pdfcomment 744 | 745 | # pythontex 746 | 747 | # tcolorbox 748 | 749 | # thmtools 750 | 751 | # TikZ & PGF 752 | 753 | # todonotes 754 | 755 | # vhistory 756 | 757 | # easy-todo 758 | 759 | # xcolor 760 | 761 | # xmpincl 762 | 763 | # xindy 764 | 765 | # xypic precompiled matrices and outlines 766 | 767 | # endfloat 768 | 769 | # Latexian 770 | 771 | # WinEdt 772 | 773 | # Texpad 774 | 775 | # LyX 776 | 777 | # Kile 778 | 779 | # gummi 780 | 781 | # KBibTeX 782 | 783 | # TeXnicCenter 784 | 785 | # auto folder when using emacs and auctex 786 | 787 | # expex forward references with \gathertags 788 | 789 | # standalone packages 790 | 791 | # Makeindex log files 792 | 793 | # REVTeX puts footnotes in the bibliography by default, unless the nofootinbib 794 | # option is specified. Footnotes are the stored in a file with suffix Notes.bib. 795 | # Uncomment the next line to have this generated file ignored. 796 | 797 | ### TeX Patch ### 798 | # LIPIcs / OASIcs 799 | 800 | # glossaries 801 | 802 | ### TextMate ### 803 | *.tmproj 804 | *.tmproject 805 | tmtags 806 | 807 | ### Vim ### 808 | # Swap 809 | [._]*.s[a-v][a-z] 810 | !*.svg # comment out if you don't need vector files 811 | [._]*.sw[a-p] 812 | [._]s[a-rt-v][a-z] 813 | [._]ss[a-gi-z] 814 | [._]sw[a-p] 815 | 816 | # Session 817 | Session.vim 818 | Sessionx.vim 819 | 820 | # Temporary 821 | .netrwhist 822 | # Auto-generated tag files 823 | # Persistent undo 824 | [._]*.un~ 825 | 826 | ### VisualStudioCode ### 827 | .vscode/* 828 | !.vscode/settings.json 829 | !.vscode/tasks.json 830 | !.vscode/launch.json 831 | !.vscode/extensions.json 832 | *.code-workspace 833 | 834 | ### VisualStudioCode Patch ### 835 | # Ignore all local history of files 836 | .history 837 | 838 | # End of https://www.toptal.com/developers/gitignore/api/tex,vim,tags,latex,linux,macos,python,textmate,sublimetext,pycharm+all,intellij+all,visualstudiocode 839 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------