Skip to main content

pants-backend-platforms

A Pants backend for building targets for more than one platform. It has no build rules of its own: language backends (such as pants-backend-cmake) use it to know which platforms to build and how to ask another backend for a dependency built for the same platform. The C and C++ toolchain for each platform is in pants-backend-cc.

This release targets Pants 2.32.x. Install it with pants-backend-platforms==0.1.0 in [GLOBAL].plugins in pants.toml, and enable pants_backend_platforms in [GLOBAL].backend_packages.

Status: alpha.

Targets

platform(name="linux-x86_64", os="linux", arch="x86_64")
platform(name="windows-x86_64", os="windows", arch="x86_64")
  • platform: os (linux, windows, macos) and arch (x86_64, aarch64). Everything refers to a platform by its target name, so names are unique.
  • The host is the platform matching the machine Pants runs on. When several match, choose with [platforms].host; when none does, there is an implicit <os>-<arch> platform.

Choosing what to build

A target of a backend that supports platforms has a platforms field: the platforms it can be built for, the host alone when unset.

cmake_target(name="app", project=":project", platforms=["linux-x86_64", "windows-x86_64"])

pants package builds the platforms in that list that are the host or in [platforms].enabled. The host's output keeps its usual path in dist/, and every other platform's goes under dist/<platform>/:

pants --platforms-enabled="['windows-x86_64']" package ::

A target built for a platform has its dependencies built for the same platform, enabled or not. A dependency whose platforms does not list it is an error naming both targets.

Enable extra platforms where the packages are published rather than in pants.toml: whatever packages a target, such as a test's runtime_package_dependencies or an archive, gets every enabled platform too.

For backend authors

  • Make the field set a PlatformBuildFieldSet member, which brings the platforms field, and register UnionRule(PlatformBuildFieldSet, MyFieldSet). Its rule takes the field set and a TargetPlatform and returns a PlatformBuild: the files at the paths pants package writes them to for the host.
  • build_platform_dependencies(PlatformDependenciesRequest(address, targets, platform)) builds the members among targets for the platform and checks their platforms. A tool that runs during the build is built with build_for_platform for KnownPlatforms.host.
  • The package rule returns package_for_platforms(PackageForPlatformsRequest(field_set)). Goals that run what they build, such as run and test, build for the host.

Metadata

Release files for pants-backend-platforms 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pants-backend-platforms 0.1.0
File Size Uploaded Provenance Actions
pants_backend_platforms-0.1.0.tar.gz 8.8 kB Without provenance Details for pants_backend_platforms-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pants-backend-platforms 0.1.0
File Interpreter ABI Platform Actions
pants_backend_platforms-0.1.0-py3-none-any.whl Python 3 none any Details for pants_backend_platforms-0.1.0-py3-none-any.whl

Total release size: 19.6 kB

Release files / pants_backend_platforms-0.1.0.tar.gz

Download URL pants_backend_platforms-0.1.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cefa79f54373c57b2b190b4227a0d29e95dec9e05b8cdfd9375568aa3938cf57
BLAKE2b-256 checksum
How to use checksums
38761d1083331c2754847e1aee1ada769d0f8ca8ec8de805f0c76715ed637a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / pants_backend_platforms-0.1.0-py3-none-any.whl

Download URL pants_backend_platforms-0.1.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fa4d88b88952a4d444de2dbfbcdaaa26423604f874e65125ed30383b9fca17c
BLAKE2b-256 checksum
How to use checksums
7560fc56b380689f115fb98add686989a01140eb3c342768fba359481450cc92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for pants-backend-platforms 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page