Skip to content

AmineDjeghri/python-package-template

Repository files navigation

Python Package Template

This project is a template for a Python package.

Check my Generative AI Project Template

python Debian macOS

Style: Ruff MkDocs mkdocs-material Docker GitLab CI GitHub Actions

This package is a template for a python package. This project uses uv for package management. We will follow the same naming conventions. For example, there is a difference between a library (package) project and an application project. This is a library (package) project.

It contains the following parts :

  • The Python package (python_package_template): contains the code for the project. It can be used by users by pip installing the wheel and is maintained by the maintainers.

  • Autogenerated documentation: Docs made using MkDocs.

site-img

👥 Authors

  • (Author) Amine Djeghri

🧠 Features

Engineering tools:

  • Use UV to manage packages
  • pre-commit hooks: use ruff to ensure the code quality & detect-secrets to scan the secrets in the code.
  • Logging using loguru (with colors)
  • Pytest for unit tests
  • Dockerized project (Dockerfile & docker-compose): for the evaluation pipeline.
  • Make commands to handle everything for you: install, run, test

CI/CD & Maintenance tools:

  • CI/CD pipelines: .github/workflows for GitHub and .gitlab-ci.yml for GitLab
  • Local CI/CD pipelines: GitHub Actions using github act and local GitLab CI using gitlab-ci-local

Documentation tools:

  • Wiki creation and setup of documentation website using Mkdocs
  • GitHub Pages deployment using mkdocs gh-deploy plugin

Upcoming features:

1. Getting started

The following files are used in the contribution pipeline:

  • .env.example: example of the .env file.
  • .env : contains the environment variables used by the app.
  • Makefile: contains the commands to run the app locally.
  • Dockerfile: the dockerfile used to build the project inside a container. It uses the Makefile commands to run the app.
  • .pre-commit-config.yaml: pre-commit hooks configuration file
  • pyproject.toml: contains the pytest, ruff & other configurations.
  • src/python_package_tempalte/utils.py: logger using logguru and settings using pydantic. the frontend.
  • .github/workflows/**.yml: GitHub actions configuration files.
  • .gitlab-ci.yml: Gitlab CI configuration files.
  • .gitignore: contains the files to ignore in the project.

1.1. Local Prerequisites

  • Ubuntu 22.04 or MacOS
  • Python 3.11

⚙️ Steps for Installation (Users)

Use pip or uv pip to install the package :

pip install "dist/dist/python_package_template-0.1.0-py3-none-any.whl"
# or
uv pip install "dist/dist/python_package_template-0.1.0-py3-none-any.whl"

Usage

from python_package_template.example import hello
hello()
# Output: 2025-01-05 08:05:38.143 | INFO     | python_package_template.example:hello:5 - Hello world

Check the documentation

You can check the documentation (website), or the notebook.ipynb.

1.3 ⚙️ Steps for Installation (Contributors and maintainers)

Check the CONTRIBUTING.md file for installation instructions

2. Contributing

Check the CONTRIBUTING.md file for more information.

About

This project is a template for a Python package.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published