Skip to content
/ python-template Public template

GitHub repository template for Python with pre-commit and pip support.

Notifications You must be signed in to change notification settings

HiveMinds/python-template

Repository files navigation

Python Repository Template

Python 3.12 License: AGPL v3 Code Style: Black

Example Python repository to quickly fork into new clean environment.

  • typechecking
  • pre-commit

Usage

First install this pip package with:

pip install pythontemplate

Then run:

python -m src.pythontemplate

Tests

python -m pytest

Developer

conda env create --file environment.yml
conda activate pythontemplate

pre-commit install
pre-commit autoupdate
pre-commit run --all

Publish pip package

Install the pip package locally with:

rm -r build
python -m build
pip install -e .

Upload the pip package to the world with:

rm -r build
python -m build
python3 -m twine upload dist/\*

Sphinx documentation

To generate the documentation ensure the pip package is installed locally, such that the documentation is able to import its Python files.

rm -r build
python -m build
pip install -e .

Then build the documentation with::

cd docs
make html

You can now see all your auto-generated Sphinx documentation in: docs/build/html/index.html. This repository auto-generates the Sphinx documentation for all your Python files using the /docs/source/conf.py file.

Additional manual documentation

  • The docs/source/index.rst is autogenerated and contains the main page and documentation file-structure.
  • You can also add additional manual documentation in Markdown format as files in:
docs/source/manual_documenation/your_manual_documentation_filename.md
docs/source/manual_documenation/another_manual_documentation_filename.md

and then adding those filepaths into the docs/source/manual.rst file like:

Handwritten Documentation
=========================
.. toctree::
   :maxdepth: 2

   manual_documenation/your_manual_documentation_filename.md
   another_manual_documentation_filename.md

About

GitHub repository template for Python with pre-commit and pip support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages