astariul / pytere

Python Template Repository

Home Page:https://astariul.github.io/pytere

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytere

Python Template repository

GitHub release Test status Lint status Coverage status Docs
black ruff pre-commit licence

DescriptionInstallUsageUse this templateFAQContribute
Documentation

Description

pytere stands for Python template repository.

It's just a template repository for python, with the following features :

  • 📚 Beautiful documentation with Material for Mkdocs, published as a Github page with mike automatically
  • ✨ Modern code style checks with black and ruff
  • 🅿️ Easy development with pre-commit hooks
  • ✅ Tests with pytest and coverage without external tools
  • :octocat: CI with Github actions
  • 📝 Issues & PR templates
  • 🤖 Stale bot & Dependabot
  • 🚀 Releases automatically published to PyPi

Install

Install pytere by running :

pip install pytere

For development, you can install it locally by first cloning the repository :

git clone https://github.com/astariul/pytere.git
cd pytere
pip install -e .

Usage

pytere does not contain any useful code because it's a template repository.
But you can check if the package is correctly installed with :

from pytere import is_odd

print(is_odd(2))  # False

Use this template

To use this template, click the button "Use this template" :

Use template

It will prompt you to create a new Github repository.

Then replace the content in your freshly created repository, with your own package name, own code, and update the links to point to your own repository.
More details in the documentation.

FAQ

Why creating yet another template, there is already plenty on the internet ?

True, but I couldn't find one that entirely satisfies my needs and uses the tools I want.

For example, a lot of templates use Sphinx for the documentation, but I'm much more comfortable with MkDocs. Or the test coverage was provided by an external tool, but I wanted everything in Github. Etc...
Hence the creation of this repository.

Can I use this template for a private repository ?

Absolutely !

But some things might not work (for example the release badge), and you might want to remove some features (like automatically pushing to PyPi, or publishing the documentation to Github page)

Contribute

To contribute, install the package locally, create your own branch, add your code (and tests, and documentation), and open a PR !

Pre-commit hooks

Pre-commit hooks are set to check the code added whenever you commit something.

If you never ran the hooks before, install it with :

pre-commit install

Then you can just try to commit your code. If your code does not meet the quality required by linters, it will not be committed. You can just fix your code and try to commit again !


You can manually run the pre-commit hooks with :

pre-commit run --all-files

Tests

When you contribute, you need to make sure all the unit-tests pass. You should also add tests if necessary !

You can run the tests with :

pytest

Tests are not included in the pre-commit hooks, because running the tests might be slow, and for the sake of developpers we want the pre-commit hooks to be fast !

Pre-commit hooks will not run the tests, but it will automatically update the coverage badge !

Documentation

The documentation should be kept up-to-date. You can visualize the documentation locally by running :

mkdocs serve

About

Python Template Repository

https://astariul.github.io/pytere

License:MIT License


Languages

Language:Python 100.0%