A template place for starting a new python project:
- pyproject.toml to manage all tools, configurations and dependencies in one place.
- poetry: python packaging and dependency management made easy.
- to get started with poetry it is best to follow documentation from here.
- or just install poetry and create a virtual env in project directory:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - poetry config virtualenvs.create true \ && poetry config virtualenvs.in-project true \ && poetry install --no-interaction --no-ansi
- to activate the virtual env with poetry just type:
poetry shell - to deactivate the virtual env
shelltypeexitorCtrl-D
- git's pre-commit hooks for code format and linting
- default python .gitignore file.
- editorconfig - instructs code editors for some files format conventions.
- commitzen for git commits convention, Changelog, and Semantic versioning.
default is python3.8
There are some places that need to pay attention to, when using a different python version: I think the only place that matters is the poetry (No.1.ii below), but feel free to try.
- pyproject.toml
- Black
[tool.black] target-version = ['py3']
- Poetry
[tool.poetry.dependencies] python = "^3.8"
- Black
- .pre-commit-config.yaml
- flake8
- id: flake8 additional_dependencies: - flake8-black>=0.1.1 language_version: python3
- flake8