Skip to main content
Version: 2.25 (dev)

debian_package


A Debian package containing an artifact.

This will not install the package, only create a .deb file that you can then distribute and install, e.g. via dpkg.

See https://www.pantsbuild.org/2.24/reference/targets/debian_package.

Backend: pants.backend.experimental.debian


packages

Iterable[str]
required

Addresses to any targets that can be built with pants package, e.g. ["project:app"].

Pants will build the assets as if you had run pants package. It will include the results in your Debian package using the same name they would normally have, but without the --distdir prefix (e.g. dist/).

You can include anything that can be built by pants package, e.g. a pex_binary, a python_distribution, or an archive.

sources

Iterable[str]
required

Paths that will be included in the package to be produced such as Debian metadata files. You must include a DEBIAN/control file.

Paths are relative to the BUILD file's directory and all paths must belong to the same parent directory. For example, sources=['dir/**'] is valid, but sources=['top_level_file.txt'] and sources=['dir1/*', 'dir2/*'] are not.

description

str | None
default: None

A human-readable description of the target.

Use pants list --documented :: to see all targets with descriptions.

install_prefix

str | None
default: '/opt'

Absolute path to a directory where Debian package will be installed to.

output_path

str | None
default: '${spec_path_normalized}/${target_name_normalized}${file_suffix}'

Where the built asset should be located.

This field supports the following template replacements:

  • ${spec_path_normalized}: The path to the target's directory ("spec path") with forward slashes replaced by dots.

  • ${target_name_normalized}: The target's name with paramaterizations escaped by replacing dots with underscores.

  • ${file_suffix}: For target's which produce single file artifacts, this is the file type suffix to use with a leading dot, and is empty otherwise when not applicable.

If undefined, this will use the path to the BUILD file, followed by the target name. For example, src/python/project:app would be src.python.project/app.ext. This behavior corresponds to the default template: ${spec_path_normalized}/${target_name_normalized}${file_suffix}

When running pants package, this path will be prefixed by --distdir (e.g. dist/).

Warning: setting this value risks naming collisions with other package targets you may have.

Dict[str, str] | None
default: None

Symlinks to create for each target being packaged.

For example, you could set symlinks={'command-name': 'entrypoint-name'}.

tags

Iterable[str] | None
default: None

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run pants --tag='integration_test' test :: to only run on targets with that tag.