This template is designed to make it easy to set up a Python project that is well-structured, organized, and easy to maintain. It comes pre-configured with several tools that will help you develop your project more efficiently, including:
- Visual Studio Code integration: with the
RunOnSave,even-better-tomlandruffextensions installed, you can format, lint, and type-check your code automatically every time you save a file. - Type checking: this template is configured to use
mypyandpyrightto automatically infer types when possible, without imposing strict typing requirements on your code. - Linting:
ruff, an extremely fast Python linter, written in Rust is configured well to help you catch and fix code style issues. - Formatting:
yapf,ruff, andunifyare configured to help you keep your code clean and well-organized. - Testing:
pytestis configured to make it easy to run tests, andpytest-covis configured to help you measure code coverage. - Dependency management:
poetryis configured to help you manage your project's dependencies. - Toolkits:
invokeis configured to provide a range of useful tasks, such as running your code, running tests, formatting your code, and checking your code style and types. These tasks are fully configurable in the tasks.py file.
To install this template, simply follow these steps:
git clone git@github.com:code-yeongyu/Python-Poetry-Template.git
cd Python-Poetry-Template
poetry install
code --install-extension emeraldwalk.RunOnSave
code --install-extension tamasfe.even-better-toml
code --install-extension charliermarsh.ruffTo use this template, you can follow these steps:
To open a shell in the project directory, use the following command:
poetry shellinvoke rename-project <your-project-name>To run your code, use the following command:
poetry run invoke runTo run your tests, use the following command:
poetry run invoke testTo run the code formatters, use the following command:
poetry run invoke format_codeTo check your code style and type hints, use the following command:
poetry run invoke check