Skip to content

This is a template repository for Python projects. It uses Poetry for dependency management and includes pre-configured tools such as Black, Flake8, mypy, Pylint, pytest, and others, for formatting, linting, testing, and documentation management.

License

Notifications You must be signed in to change notification settings

brunobotelhobr/My-Template-Python

Repository files navigation

My-Python-Template

Icon

GitHub Action CI GitHub Action CodeQL GitHub Action Trivy codecov

This is a template repository for Python CLI projects.

It uses Poetry for dependency management and includes pre-configured tools such as black, flake8, mypy, pylint, pytest, and others, for formatting, linting, testing, and documentation management. The project also includes security tools like trivy and bandit.

The pyproject.toml file contains various configurations like project metadata, dependencies, build system, and commands for release and documentation management.

To have more details, check the Documentation

Features

  • Project Management
    • Poetry
    • ✅ Script to manage project metadata (Name, Version, Description, etc)
    • ✅ Script to Upgrade all dependencies
    • ✅ Script to clean all temporary files
  • Code Formatting
  • Code Linting
  • Testing
    • Pytest
    • Coverage
    • ✅ Default tests structure folder for unit and functional tests
  • Security
  • Automation commands
  • PyPI
    • ✅ Scripts to build and publish to PyPI
  • Docker
    • ✅ Scripts to build and publish to Docker Hub
  • Documentation
  • CI/CD
    • ✅ GitHub Actions to do CI/CD

Tasks

This project uses Taskipy to automate common development tasks.

All tasks are defined in the pypoject.toml file.

Almost all tools used in this project uses pyproject.toml to store their configurations.

List of preset tasks:

pre-commit      Run all pre-commit tasks
pre-release     Run all pre-release tasks
-----------     ----------------------------------------
info            Show project info
meta            Update project properties
upgrade         Upgrade all dependencies
sec             Run all security checks
format          Run all formaters
lint            Run all linters
bom             Generate BOM
req             Generate requirements.txt
test            Run all tests
pypi-build      Build package for PyPI
pypi-auth       Authenticate to PyPI
pypi-pub        Publish package to PyPI
docker-list     List docker images
docker-build    Build docker image
docker-sec-scan Scan a docker image looking for vulenrabilities
docker-auth     Authenticate to Docker Hub
docker-latest   Tag a docker image as latest
docker-pub      Publish docker image to Docker Hub
docs            Run docs server
docs-list       List docs versions
docs-build      Add a new version to docs
docs-delete     Delete a version of the docs
docs-latest     Set the latest Version.
docs-purge      Purge all versions of the docs.
docs-pub        Publish documentation to the doc branch on GitHub.
clean           Clean all generated files

Requirements

You must install manually the following tools:

Be sure you have installed all the requirements and that you on the desired python Version, you can check it with: python --version

Setup

# Clone the repository
git clone https://github.com/brunobotelhobr/My-Template=Python.git

# Check the python version, you must use the version that the project will use.
python -V

# Install the dependencies
pip install poetry
poetry shell
poetry install

# Check the taskipi commands:
task --list

# Update projetct metadata
task meta

How Start?

1. Fork the project

# Clone the repository
git clone

# Check the python version, you must use the version that the project will use.
python -V

# Install the dependencies
pip install poetry
poetry shell
poetry install

# Check the taskipi commands:
task --list

2. Create a new branch with your changes

# Create a new branch
git checkout -b <branch-name>

3. Make the changes and commit

# Check for lint errors
task format
task lint

# Check for security errors
task sec

# Update the meta
task meta
task bom
task req

# Add the changes
git add .

4. Open a Pull Request

git commit -m "feat: add a new feature"
git push origin <branch-name>

Hints

  • How add a Dev Package
    • poetry add --dev <package-name>
  • How add a Prod Package
    • poetry add <package-name>
  • How add a Package with extras
    • poetry add <package-name> -E <extras>
  • How remove a Package
    • poetry remove <package-name>

Call for Contributors

We invite you to contribute to this repository and help us make it even better. Whether it's bug fixes, new features, or documentation improvements, we welcome all contributions. Please read our documentation for guidelines on how to contribute. Happy coding!

check the Documentation for more details.

"Buy Me A Coffee"

About

This is a template repository for Python projects. It uses Poetry for dependency management and includes pre-configured tools such as Black, Flake8, mypy, Pylint, pytest, and others, for formatting, linting, testing, and documentation management.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published