Skip to content

Generic-Tree/python-package

Repository files navigation

Python Package

This intends to be an readme-documented, open-source-licensed, semantic-versioned, conventional-committed and changelogged git repository starting point for the development of a brand-new python package

A straightforward beginning for an open-source python package project repository

Beside consider PyPA and setuptools packing instructions, and bring useful Makefile targets to help development process, it also provides a release-and-publish-on-tag automation through PyPA's official pypi-publish GitHub action.

Table of Contents

See all

Getting started

First of all, create a new repository from this template,
Name it accordingly and place where it best fits for your team.

Development environment

Make sure you have Git, Make and Python installed:

$ git --version
git version 2.25.1
$ make --version
GNU Make 4.2.1
$ python3 --version
Python 3.10

Thus, clone the recent-created repository locally, and set up its development environment:

$ make init
$ . venv/bin/activate

You're then ready to start developing your distributable python modules.

Continuous delivery

Release and publish on tag

To set up this automation, you need to have a Python Package Index account.
There, and register it into your fresh-repo secrets as PYPI_API_TOKEN.

After that, every tagged commit pushed will result in a new version of your package released at GitHub and published to PyPI.

Repo publication

After all, you should make this project your own.

  • Write a good README.md to present it to the world.
  • Ensure to tailor the project LICENSE to your needs,
  • Assign a suitable maintenance status.
  • Update package metadata on setup.cfg
  • Reflect all this changes in CHANGELOG.md

Project specifications

Here some descriptions about this template project:

Features

This project shortens a repository start setup, considering:

It also powers up python packing workflow by:

  • Compliance with both PyPA and setuptools recommendations
  • Adopt a PEP 440-compliant single-source package versioning strategy
  • Inclusion of proficient Makefile that improves development management
  • Inclusion of appropriate .gitignore file
  • Commented references and instructions through configuration files
  • Inclusion of convenient Github Actions workflows that:
    • Setup project releases
    • Publish package in PyPI

Folder structure

.
├── .git/                       Version control system folder
├── .github/                    Repository customization directory
│   └── workflows               Continuous automation setup folder
│       └── release.yml         Release on tag procedure
├── .gitignore                  VCS ignored files manifest
├── CHANGELOG.md                Release notes description
├── LICENSE                     License file
├── Makefile                    Development management facilities
├── pyproject.toml              Development declarative configuration
├── README.md                   Repo readme document
├── requirements.txt            Packing dependence descriptor
├── setup.cfg                   Package declarative configuration
└── src/
    ├── <package>               Python package root folder
    │   ├── __init__.py         Python package init script
    │   └── __main__.py         Package main entry-point
    └── utils                   Auxiliary functions module
        └── version.py          PEP 440-compliant version management

Maintenance

This project is maintained by the author, @artu-hnrq.
Though, minimal or no implementation has been done yet, it's only intended to be a limited example, demo, or proof-of-concept.

License

This project is published under the permissions established by GNU General Public License v3.0.