Skip to content

KaiL4eK/pyproject-cookiecutter

Repository files navigation

Python project template for cookiecutter

PythonSupported Dependencies Status

Code style: black Pre-commit Bandit

Features

How to start

cookiecutter gh:KaiL4eK/pyproject-cookiecutter
  • Answer some questions and get ready to code!

Notes

Cookiecutter is not working properly (errors during project creation)

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.

[Windows] warning: LF will be replaced by CRLF in ...

Check this answer. In short, setup git config core.autocrlf false to disable line-ending check. Or you can setup as you wish.

How to improve project MORE

[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
)/
'''

Use other ways to update code via formatters just if you know what they do

  - 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",
          ]

Thanks to

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published