Difference between revisions of "Python package layout"

From Software Heritage Wiki
Jump to navigation Jump to search
 
(→‎Makefile: document "docs" target)
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
 
;coverage
 
;coverage
 
:run test suite and verify code coverage
 
:run test suite and verify code coverage
 +
;docs
 +
:generate HTML documentation using Sphinx
  
 
=== Generic Python Makefile ===
 
=== Generic Python Makefile ===

Latest revision as of 13:07, 7 September 2017

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