|
1 | | -# my python copier template |
| 1 | +# Modern Python Project Template |
2 | 2 |
|
3 | 3 | [](https://github.com/copier-org/copier) |
4 | 4 | [](https://github.com/tsvikas/python-template/actions/workflows/uv-tests.yml) |
| 5 | +[](http://makeapullrequest.com) |
5 | 6 |
|
6 | | -## features |
| 7 | +A modern Python project template using recommended development tools and best practices. |
7 | 8 |
|
8 | | -This is a modern python project template, aiming to use modern and recommended tools for developments. |
| 9 | +## Features |
9 | 10 |
|
10 | | -Partial list of included tools: |
| 11 | +This template provides a comprehensive set of tools to streamline your Python development workflow: |
11 | 12 |
|
12 | | -### code: |
| 13 | +### Code Structure |
| 14 | +- Command-line interface with [Typer](https://typer.tiangolo.com/) |
| 15 | +- Advanced logging with [Loguru](https://loguru.readthedocs.io/) |
| 16 | +- Modern project layout following best practices |
13 | 17 |
|
14 | | -- cli with [typer](https://typer.tiangolo.com/) |
15 | | -- logging with [loguru](https://loguru.readthedocs.io/) |
| 18 | +### Development Tools |
| 19 | +- Python dependency management with [uv](https://docs.astral.sh/uv/) (faster alternative to pip/poetry) |
| 20 | +- Versioning management with [uv-dynamic-versioning](https://github.com/ninoseki/uv-dynamic-versioning) |
| 21 | +- Task automation with [Just](https://just.systems/man/en/) command runner |
16 | 22 |
|
17 | | -### dev tools: |
| 23 | +### Code Quality |
| 24 | +- Testing framework with [pytest](https://docs.pytest.org/) |
| 25 | + - Coverage reports via [pytest-coverage](https://pytest-cov.readthedocs.io/) |
| 26 | + - Performance benchmarking with [pytest-benchmark](https://pytest-benchmark.readthedocs.io/) |
| 27 | + - Additional pytest plugins for a better testing experience |
| 28 | +- Code formatting with [Black](https://black.readthedocs.io/) or [Ruff formatter](https://docs.astral.sh/ruff/formatter/) |
| 29 | +- Comprehensive linting with [Ruff](https://docs.astral.sh/ruff/) |
| 30 | +- Static type checking with [MyPy](https://mypy-lang.org/) |
18 | 31 |
|
19 | | -- python dependency management with [uv](https://docs.astral.sh/uv/) |
20 | | -- versioning with |
21 | | - [uv-dynamic-versioning](https://github.com/ninoseki/uv-dynamic-versioning) |
22 | | -- task runner [just](https://just.systems/man/en/) |
| 32 | +### CI/CD Integration |
| 33 | +- Git hooks via [pre-commit](https://pre-commit.com/) with many hooks pre-configured |
| 34 | +- Ready-to-use [GitHub workflows](https://docs.github.com/en/actions/writing-workflows) |
23 | 35 |
|
24 | | -### code quality tools: |
| 36 | +### Configuration Files |
| 37 | +- [EditorConfig](https://editorconfig.org/) for consistent formatting across editors |
| 38 | +- Comprehensive [.gitignore](https://gitignore.io/) file |
| 39 | +- Sensible defaults for all included tools |
25 | 40 |
|
26 | | -- testing with [pytest](https://docs.pytest.org/), |
27 | | - [pytest-coverage](https://pytest-cov.readthedocs.io/), |
28 | | - [pytest-benchmark](https://pytest-benchmark.readthedocs.io/), |
29 | | - and more |
30 | | -- formatting with [black](https://black.readthedocs.io/) |
31 | | - or [ruff-format](https://docs.astral.sh/ruff/formatter/) |
32 | | -- linting with [ruff](https://docs.astral.sh/ruff/) |
33 | | -- type checking with [mypy](https://mypy-lang.org/) |
| 41 | +### Documentation (Coming Soon) |
| 42 | +- Documentation generation |
| 43 | +- Automatic API documentation |
34 | 44 |
|
35 | | -### ci tools: |
| 45 | +## Getting Started |
36 | 46 |
|
37 | | -- [pre-commit](https://pre-commit.com/) |
38 | | - with many hooks pre-configured |
39 | | -- [github workflows](https://docs.github.com/en/actions/writing-workflows) |
| 47 | +### Prerequisites |
40 | 48 |
|
41 | | -### other pre-set config files: |
| 49 | +- To copy from this template, you need [Copier](https://copier.readthedocs.io/) with the [copier_templates_extensions](https://github.com/copier-org/copier-templates-extensions) package |
| 50 | + ```bash |
| 51 | + uv tool install copier --with copier_templates_extensions |
| 52 | + ``` |
42 | 53 |
|
43 | | -- [EditorConfig](https://editorconfig.org/) |
44 | | -- [gitignore](https://gitignore.io/) |
| 54 | +- After the template is used, Only [uv](https://docs.astral.sh/uv/getting-started/installation/) is required to begin development |
45 | 55 |
|
46 | | -### documentation generation: |
| 56 | +- All the other tools are installed and managed automatically by uv using python's [dependency-groups](https://packaging.python.org/en/latest/specifications/dependency-groups/). |
| 57 | + uv make sure that the versions are the same for all development environments. |
47 | 58 |
|
48 | | -WIP |
| 59 | +- Out of those tools, manually installing [just](https://just.systems/man/en/packages.html), |
| 60 | + is convenient, as it allows you to run `just <taskname>` instead of `uv run just <taskname>` |
49 | 61 |
|
50 | | -## Usage |
| 62 | +### Creating a New Project |
51 | 63 |
|
52 | | -### Requirements |
| 64 | +Generate a new project with: |
53 | 65 |
|
54 | | -- To create a project from the template, you need [copier](https://copier.readthedocs.io/), |
55 | | - with [copier_templates_extensions](https://github.com/copier-org/copier-templates-extensions). |
56 | | - To install: `uv tool install copier --with copier_templates_extensions` |
| 66 | +```bash |
| 67 | +copier copy gh:tsvikas/python-template ~/path/to/project/directory/ |
| 68 | +``` |
57 | 69 |
|
58 | | -- The development requirements for the created project is only |
59 | | - [uv](https://docs.astral.sh/uv/getting-started/installation/). |
| 70 | +Follow the interactive questionnaire to customize your project. |
60 | 71 |
|
61 | | -- Other dev-tools can be installed too, but on default they are easily managed by uv using |
62 | | - python's [dependency-groups](https://packaging.python.org/en/latest/specifications/dependency-groups/). |
63 | | - It is convenient to install [just](https://just.systems/man/en/packages.html), |
64 | | - as it allows you to run `just <taskname>` instead of `uv run just <taskname>` |
| 72 | +### Developing Your Project |
65 | 73 |
|
66 | | -### Create a new project from the template: |
| 74 | +After creating your project, run those commands from the project directory: |
67 | 75 |
|
68 | | -Run |
69 | | -`copier copy gh:tsvikas/python-template ~/path/to/project/directory/` |
70 | | -and answer the questionnaire. |
| 76 | +- Run the test suite: `just test` |
| 77 | +- Run linting and formatting: `just lint` and `just format` |
71 | 78 |
|
72 | | -### Developing your project |
| 79 | +See the generated `justfile` for all available commands. |
73 | 80 |
|
74 | | -WIP |
| 81 | +## Contributing |
| 82 | + |
| 83 | +I am exicited to see this template being used. |
| 84 | +Feel free to suggest improvements or tell me about issues. |
| 85 | +Contributions and Pull Requests are welcome! |
0 commit comments