Skip to content

runnig/python-template

Repository files navigation

Python Template

A minimal Python project template demonstrating best practices for packaging, testing, and linting.

Project Overview

  • Source code lives in the src/ directory.
  • Tests are located in the tests/ directory.
  • Build configuration is defined in pyproject.toml.
  • Development utilities (linting, formatting) are available via the Makefile.

Prerequisites

  • Install uv (https://github.com/astral-sh/uv) for dependency management
  • uv venv creates a virtual environment
  • IMPORTANT: source .venv/bin/activate activates the virtual environment
  • uv sync to install dependencies

Running the code

There is no dedicated entry‑point script, but you can experiment with the example module:

# Run an interactive session
uv run python -c "from src.arithm import sum; print(sum(2, 3))"

Another example script is located at scripts/example_script.py

  • uv run example-script

Testing

Run all tests:

make test

Or invoke pytest directly for a concrete test file:

uv run pytest tests/test_arithm.py

Linting & Formatting

# Run pre‑commit hooks (lint, type checking, etc.)
make lint

# Auto‑format code with ruff
make format

Project Structure

  • src/ – source modules
  • tests/ – test suite
  • Makefile – convenient shortcuts for common tasks
  • pyproject.toml – project metadata and dependencies
  • .pre-commit-config.yaml – pre‑commit hook configuration

License

This project is licensed under the terms found in the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors