- Python 3.8, 3.9, 3.10 and 3.11 supported
- Poetry for package/dependency management
- Version
>= 1.3.0
supported
- Version
- Tests are based on
pytest
- Pre-commit hooks with pre-commit
- Linting using flake8
- Code style via black
- Notebooks cleaning via nbstripout
- Security checks via bandit
- Local hooks for issues number substitution into commit comment for GitHub and Bitbucket (JIRA)
- VSCode editor config with EditorConfig
- Numpydoc format for docstring
- Ready-to-go Dockerfile to build image with package
- Install cookiecutter
- Create project from template
cookiecutter gh:KaiL4eK/pyproject-cookiecutter
- Answer some questions and get ready to code!
Check that you've installed version for python3
. You can call python3 -m cookiecutter gh:KaiL4eK/pyproject-cookiecutter
to ensure that it is called with required python version.
Check this answer. In short, setup git config core.autocrlf false
to disable line-ending check. Or you can setup as you wish.
[Linux] Use safety as pre-commit hook to check for security
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.3.0
hooks:
- id: python-safety-dependencies-check
This hook sometimes breaks on Windows, be careful!
Use bandit as pre-commit hook to check for security
- repo: https://github.com/PyCQA/bandit
rev: 1.7.0
hooks:
- id: bandit
exclude: ^tests/
args:
- -s
- B311
Use black or other formatter as pre-commit hook or just setup in your IDE/Development Environment
- repo: local
# Requires to be installed in venv
- id: black
name: black
entry: poetry run black --config pyproject.toml
types: [python]
language: system
# For pyptoject.toml
[tool.black]
# https://github.com/psf/black
target-version = ["py38"]
line-length = 100
color = true
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| env
| venv
)/
'''
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args:
- --py3-plus
- repo: https://github.com/humitos/mirrors-autoflake
rev: v1.3
hooks:
- id: autoflake
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
"--remove-duplicate-keys",
]