A template for the python project. It uses poetry for dependency management and tox for testing.
MIT License
A template for the python project. It uses poetry for dependency management and tox for testing.
Some features in this template project:
Contains the following projects under src
as demo:
Run project need the following environment installed:
If you want development, you need to install pre-commit V3 for git hook scripts.
following the steps below to setup the project:
# Clone the repository
git clone [email protected]:funnyzak/pyproject-starter.git && cd pyproject-starter
# Install all dependencies
poetry install --sync --all-extras --with dev,test,coverage
# install git hook scripts for development
pre-commit install
# Other useful installation dependencies commands
# Install dependencies with all extras
poetry install --all-extras
# Install dependencies with extras 'pdf' for pdf_parse project
poetry install --extras "pdf"
# Install dependencies with group 'dev'、'test' for development
poetry install --with dev,test
# Only install required dependencies for production
poetry install
# Specify python version
poetry env use python3.9
There are some useful commands for development:
# Run project => hello
poetry run hello
# Run project => pdf_parse: merge pdf
poetry run merge_pdf_demo
# Run project => pdf_parse: parse multi pdf to multi-layer pdf
poetry run multi_layer_pdf_demo
# Extract text to json from pdf
poetry run extract_text_from_pdf
# Debug "hello" project with ipdb3
poetry run ipdb3 ./src/hello/main.py
# Code test
poetry run pytest -s
# Run default coverage test
poetry run tox
# Run hello project coverage test at python 3.9 and 3.10
poetry run tox -e py{39,310}-hello
# Lint with black
poetry run black ./src --check
# Format code with black
poetry run black ./src
# Check with mypy
poetry run mypy ./src
# Check import order with isort
poetry run isort ./src --check
# Lint with flake8
poetry run flake8 ./src
src
folder.hello
project as a template.packages
in pyproject.toml
file.tests
folder.pyproject.toml
file. like poetry run hello
command.tox.ini
file for coverage test.mypy.ini
file for static type checking.See poetry installation.
See python installation.
some useful references:
If you have any questions or suggestions, please feel free to open an issue or pull request.
MIT License © 2022 funnyzak