Skip to content

Latest commit

 

History

History
78 lines (49 loc) · 2.78 KB

File metadata and controls

78 lines (49 loc) · 2.78 KB

Python Poetry Project Template

Python + Poetry

A Python project template for CLIs using Poetry as the dependency manager.

Poetry | Python

linting: pylint

🎧 Quick Start

Ensure Python and Python Poetry are installed.

Dependency installation is managed via poetry. Once cloned, you can install dependencies from the project root:

poetry install

Once dependencies are installed, you can run the package-name:

poetry run package-name

And boom! You're ready to customize a Python project! 🎉

🧪 Running Tests

pytest is used as a test runner and its configuration can be found in the tool.pytest.ini_options section of pyproject.toml. pytest-cov is used as a coverage reporter.

Running pytest with no arguments will:

  • Automatically add src to PYTHONPATH (pythonpath: src)
  • Only run unit tests (testpaths: tests/unit/package_name)
  • Increase verbosity (-vv)
  • Calculate coverage (using pytest-cov) and display any modules missing coverage

You can specify different paths to run different groupings of tests:

pytest tests/unit         # Run unit tests
pytest tests/integration  # Run integration tests
pytest tests/e2e          # Run end-to-end tests
pytest tests              # Run all tests

(Optional) Running CI Workflow Tests

Ensure Docker and act are installed and a github-act-cache-server is up and running.

Local workflow runs are executed via act. Once all dependencies are setup, you can test workflows with:

# TBD script to run all tests

See example act commands to better understand how to run GitHub actions locally.

Configuring Developer Standards

Use git to install commit message, pre-commit, and pre-push commit hooks:

git config --local core.hooksPath .github/hooks/
git config --local commit.template .github/.gitmessage

These will ensure commit messages are consistent, code is correctly formatted and linted, and tests before committing or pushing.

Style decisions are based on the Google Python Style Guide.

🪪 License

This tool is MIT licensed.