Python package layout

From Software Heritage Wiki
Jump to navigation Jump to search

This page documents the expected layout/behavior of Python packages developed by Software Heritage.

Naming convention

  • a Git repository called swh-something-else contains the Python package swh.something.else

Makefile

Packages should have a top-level Makefile with the following targets:

check
run static code checks
test
run test suite
coverage
run test suite and verify code coverage
docs
generate HTML documentation using Sphinx

Generic Python Makefile

The simplest way to fulfill Makefile requirements is to use the common Python Makefile available in swh-environment, e.g.:

$ cd swh-environment/swh-core 
$ cat Makefile 
# Makefile driver for SWH Python packages. DO NOT CHANGE.
# You can add custom Makefile rules to Makefile.local

include ../Makefile.python
-include Makefile.local

Package metadata

Each Python package should use the following top-level files to capture its metadata:

requirements.txt
dependencies on other packages, as expected by pip
setup.py
setuptools packaging driver

See also