LinuxCommandLibrary

dh_numpy

Build Debian packages using NumPy

SYNOPSIS

dh_numpy [debhelper options] [--multi] [--name=<module-name>]

PARAMETERS

-ppackage, --package=package
    Limit operation to specific binary package.

-i, --incoming
    Act on packages listed in debian/files.

-aarch, --arch
    Act on architecture-dependent packages.

-Xitem, --exclude=item
    Exclude specified files from processing.

--no-act
    Show what would be done without acting.

--multi
    Process all packages listed in debian/control simultaneously.

--name=module-name
    Use module-name instead of package name for .numpy files.

DESCRIPTION

dh_numpy is a specialized debhelper program designed to simplify packaging Python modules that use NumPy or SciPy. It generates essential maintainer scripts such as postinst, prerm, and postrm, and updates debian/substvars for proper NumPy extension handling.

This tool ensures modules are relocatable by managing site-packages paths across Python versions and multiarch setups. It processes package.numpy (or package.name.numpy) files listing modules, installing .so files, byte-compiling Python code, and configuring alternatives or symlinks.

Commonly invoked via dh with '--with numpy' in debian/rules, it automates build dependencies like python3-all-dev and python3-numpy, reducing manual configuration errors in Debian packaging workflows. Ideal for scientific Python libraries requiring compiled extensions.

CAVEATS

Requires debhelper compatibility level 9+; specific to Debian/Ubuntu packaging; ensure .numpy files list valid modules.

USAGE EXAMPLE

In debian/rules:
override_dh_auto_install:
  dh_auto_install --buildsystem=setuptools
  dh_numpy --name=myextension

INPUT FILE FORMAT

package.numpy contains one module per line, e.g.:
my_package._core
my_package.utils

HISTORY

Introduced in dh-python 1.20110328 for NumPy 1.5+ support in Debian; evolved for multi-Python and multiarch in later versions.

SEE ALSO

dh(1), debhelper(7), dh_python3(1), dh_installdirs(1)

Copied to clipboard