You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# python-project-template — showcasing good software practices
7
-
A minimal Python project demonstrating best practices for testing, documentation, CI/CD, packaging, examples.
8
-
The library provides a tiny Calculator API that can register and compose simple mathematical operations.
7
+
The library provides a small dependence-free Calculator API (Operation, OperationRegistry, Calculator) that can register and compose simple mathematical operations.
8
+
This simple code is used to showcase some good coding practices.
- Example operations (add, sub, mul, div, neg, sqr)
23
-
- Utilities and clear error handling
24
-
- Tests (pytest) and CI workflow included
22
+
23
+
-**Argument validation** with type annotations and runtime checking using the ``typing`` module.
24
+
-**Consistent error messages** for invalid operations and inputs via custom ``Exceptions``.
25
+
-**Unit tests** with ``pytest``. Global testing variables set in :file:`tests/convtest.py`.
26
+
-**Example notebooks and scripts** for demonstration and exploration.
27
+
-**Google-style documentation** generated with ``sphinx``.
28
+
-**Pre-commit routine** configured in :file:`.pre-commit-config.yaml`:
29
+
30
+
- Code formatting with ``black``
31
+
- Linting with ``ruff-pre-commit``
32
+
- Type checking with ``mypy``
33
+
- Additional checks and fixes (trailing whitespace removal, enforcing empty line at EOF, YAML syntax checks, blocking large files) via ``pre-commit-hooks``
34
+
35
+
-**Modern packaging** and easy installation using ``pyproject.toml``.
36
+
-**Automated test suite and coverage reporting** integrated with GitHub Actions; coverage reports can be published to GitHub Pages. Setup in :file:`.github/workflows/tests.yml`.
37
+
-**Automatic documentation deployment** to GitHub Pages with GitHub Actions. Setup in :file:`.github/workflows/docs.yml`[TODO].
38
+
-**Easy contribution workflow** for new features and improvements.
25
39
26
40
## Installation
27
41
28
-
Clone the repository and create a virtual environment (recommended):
42
+
Clone the repository, create a virtual environment (recommended), and install dependencies and an editable installation of `python-project-template`:
This installs the package in editable mode and the development extras (pytest,
40
-
pre-commit, formatting and linting tools) so you can run tests and linters.
53
+
This installs the package in editable mode and the development extras (pytest, pre-commit, formatting and linting tools) so you can run tests and linters.
41
54
42
55
## Quick usage
43
56
44
-
Interactive example using the package API:
57
+
The following is a quick example for the Calculator API.
45
58
46
59
```python
47
60
from python_project_template import default_calculator, Operation
0 commit comments