Skip to content

Latest commit

 

History

History
218 lines (134 loc) · 16.7 KB

File metadata and controls

218 lines (134 loc) · 16.7 KB

2.25.x Release Series

Pants is a fast, scalable, user-friendly build system for codebases of all sizes.

Pants is an open-source project that is not owned or controlled by any one company or organization, and does incur some expenses. These expenses are managed by Pants Build, a non-profit that was established for this purpose. This non-profit's only source of revenue is sponsorship by individuals and companies that use Pants.

We offer formal sponsorship tiers for companies, as well as individual sponsorships via GitHub.

Thank you to Klaviyo and Normal Computing for their Platinum tier support throughout this release!

What's New

Highlights

  • New backend: Python for OpenAPI
  • The AWS Lambda backend now provides built-in complete platforms for the Python 3.13 runtime.
  • Javascript / Typescript dependency inference improvements
  • Improvements to the Python Build Standalone Python provider backend
  • Bug fixes!

Deprecations

  • macOS versions: Pants v2.25 is now built and tested on newer macOS versions: 13 (x86-64, previously 10.15) and macOS 14 (arm64, previously 11). The deprecation of the older versions was announced in Pants 2.23 and 2.24, and is driven by Apple's support schedule; it also helps reduce costs for the volunteer-driven Pantsbuild organization. Using Pants on older versions may or may not work.

General

  • Fixed a longstanding bug in the processing of synthetic targets. This fix has the side-effect of requiring immutability and hashability of scalar values in BUILD files, which was always assumed but not enforced. This may cause BUILD file parsing errors if you have custom field types involving custom mutable data structures. See (#21725) for more.
  • Fixed a bug where pants --export-resolve=<resolve> --export-py-generated-sources-in-resolve=<resolve> fails (see #21659 for more info).
  • Fixed a bug where an archive target is unable to produce a ZIP file with no extension (see #21693 for more info).
  • The [subprocess-environment].env_vars and extra_env_vars options (which are available on many subsystems and targets) now support a generalized glob syntax using Python's fnmatch to construct patterns like AWS_*, TF_*, and S2TESTS_*.
  • Suspicious values now generate a warning instead of a hard error when using the <PATH> special value to inject shell PATH values to the system-binaries subsystem.
  • Fixed a bug where negative target specs (e.g., -folder::) were not recognized on the command line.

Remote Caching/Execution

Pants now sends a user-agent header with every request to a remote store or a remote execution service, even when other headers are configured. If necessary, the user may override the user agent by specifying one in the [GLOBAL].remote_store_headers or [GLOBAL].remote_execution_headers options.

Pants now supports the {chroot} replacement marker in remote execution contexts. (With local and Docker execution, the {chroot} marker is replaced with the absolute path of the sandbox directory if it appears in program arguments or environment variables. Pants will do the same now in remote execution contexts. This requires /bin/bash to be available on the remote execution server.)

The OpenDAL library powering the GitHub Actions cache backend has been updated, picking up support for the new GitHub Actions cache v2, and some bug fixes for GitHub Enterprise Server instances using AWS S3 as backing storage for the GitHub Actions cache.

New Options System

The "legacy" options system is removed in this release. All options parsing is now handled by the new, native parser.

Internal Python Upgrade

The version of Python used by Pants itself has been updated to 3.11. To support this, the Pants Launcher Binary (also known as scie-pants) now has a minimum version of 0.12.2. To update to the latest launcher binary, either:

  • Use the package manager you used to install Pants. For example, with Homebrew: brew update && brew upgrade pantsbuild/tap/pants.
  • Use its built-in self-update functionality: SCIE_BOOT=update pants.

Note: Pants uses its own separately-installed Python installation to run itself. This installation is managed by the Pants Launcher Binary. The Pants choice of Python 3.11 for its own code does not limit the versions of Python that you can use to test and build your own code.

For GitHub Actions users that use the pantsbuild/actions/init-pants action with setup-python-for-plugins=true, you will need to update your GHA workflows to use v10 or newer to get the correct version of Python.

Backends

Docker

Future versions of Pants will use a new parser for Dockerfiles, implemented in Rust. This parser is faster and does not require installing extra dependencies. To aid in this migration, you may opt-in by setting the [dockerfile-parser].use_rust_parser option to true. (Please let us know if you find any issues with the new parser):

# Opt-in to the new parser now:
[dockerfile-parser]
use_rust_parser = true

# Or, continue using the old parser if you find issues with the new parser:
[dockerfile-parser]
use_rust_parser = false

Strict adherence to the schema of Docker registry configuration is now required. Previously, we did ad-hoc coercion of some field values, so that, e.g., you could provide a "true"/"false" string as a boolean value. Now we require actual booleans.

Fixed an error which was caused when the same tool appeared in both the [docker].tools and [docker].optional_tools options.

Stages in multi-stage builds which only used a hash to identify the image version (that is, no tag) are now surfaced. They can now be used in the docker_image.target_state field.

Go

Fixed a bug with the setup of the gRPC protobuf plugins where a go install invocation was prevented from accessing the Go module proxy during its build of those plugins, which caused those builds to fail.

Helm

Strict adherence to the schema of Helm OCI registry configuration is now required. Previously, we did ad-hoc coercion of some field values, so that, e.g., you could provide a "true" / "false" string as a boolean value. Now we require actual booleans.

The helm_infer.external_docker_images glob syntax has been generalized. In addition to *, you can now use Python fnmatch to construct patterns like quay.io/*.

Fixed a bug where linting with the Helm backend enabled could induce serialization errors with the workunit-logger.

The default "globs" for matching yaml in charts now match more common structures.

Javascript

Fixed an issue where pants run ... commands only worked if the package.json file was in the root directory.

The dependency inference now considers .ts and .tsx file extensions.

The dependency inference now considers scoped npm packages.

The NodeJS subsystem now supports configuring additional tools that should be available in the NodeJS process execution. These tools can be configured via two options:

  • [nodejs].tools: Specify additional executables required by NodeJS processes.
  • [nodejs].optional_tools: Additional tools that may be needed but aren't required. Unlike tools, the build won't fail if these aren't found. Useful for tools that only exist in some environments.

The paths to these tools will be included in the PATH used in the execution sandbox, so that they may be used by NodeJS processes during execution.

TypeScript

The dependency inference now considers .tsx files.

nFPM

The nFPM backend has a new plugin hook that allows plugins to inject field values that are used to generate nfpm config. To use this, a plugin needs to implement InjectNfpmPackageFieldsRequest:

from pants.backend.nfpm.fields.version import NfpmVersionField, NfpmVersionReleaseField
from pants.backend.nfpm.util_rules.inject_config import InjectedNfpmPackageFields, InjectNfpmPackageFieldsRequest
from pants.engine.internals.native_engine import Address, Field
from pants.engine.rules import rule

class MyCustomInjectFieldsRequest(InjectNfpmPackageFieldsRequest):
    @classmethod
    def is_applicable(cls, target) -> bool:
        # this could check the target's address, packager, package_name field, etc.
        return True

@rule
async def inject_my_custom_fields(request: MyCustomInjectFieldsRequest) -> InjectedNfpmPackageFields:
    # this could get the version from a file
    version = "9.8.7-dev+git"
    release = 6
    fields: list[Field] = [
        NfpmVersionField(version, request.target.address),
        NfpmVersionReleaseField(release, request.target.address),
    ]
    return InjectedNfpmPackageFields(fields, address=request.target.address)

Python

The AWS Lambda backend now provides built-in complete platforms for the Python 3.13 runtime.

Constrained the transitive dependencies within the built-in lockfile for twine to work around a bug.

Several improvements to the Python Build Standalone backend (pants.backend.python.providers.experimental.python_build_standalone):

  • The backend now supports filtering PBS releases via their "release tag" via the new --python-build-standalone-release-constraints option. The PBS "known versions" database now contains metadata on all known PBS versions, and not just the latest PBS release tag per Python patch level.

  • The backend will now infer metadata for a PBS release from a given URL if the URL conforms to the naming convention used by the PBS project. The inferred metadata is Python version, PBS release tag, and platform.

  • The --python-build-standalone-provider-known-python-versions option now accepts a three-field format where each value is SHA256|FILE_SIZE|URL. All of the PBS release metadata will be parsed from the URL (which must use the naming convention used by the PBS project). (The existing five-field format is still accepted and will now allow the version and platform fields to be blank if that data can be inferred from the URL.)

  • Metadata on PBS releases is current to PBS release 20250311.

  • Changed references to Python Build Standalone to refer to the new GitHub organization as described in Transferring Python Build Standalone Stewardship to Astral.

The default version of the Pex tool has been updated from 2.20.3 to 2.32.1. Among many improvements and bug fixes, this unlocks support for pip 24.3.1 and Pip 25.0.

The pants.backend.experimental.python.lint.ruff.check backend now supports including Ruff's output file as a report.

NEW: Python for OpenAPI

A new experimental pants.backend.experimental.openapi.codegen.python backend was added to support Python codegen for OpenAPI documents.

Black

The pants.backend.python.lint.black backend now uses version 24.8.0 by default, upgrading from 23.12.1. This comes with a new stable style (see release notes for 24.1.0 for details) which may result in extensive reformatting.

To override Pants' default version, use the install_from_resolve option and/or the interpreter_constraints option. The style changes may be extensive, so, to make upgrading to Pants 2.25 easier, we provide the old lockfile as built-in, for now (Pants will remove this in the future, so you should switch to your own lockfile, and/or upgrade to the default Black 24, soon). To use this lockfile, and remain on Black 23, configure a resolve as follows:

# pants.toml

[python.resolves]
...
black = "resource://pants.backend.python.lint.black/black-23.12.lock"

[black]
install_from_resolve = "black"

To take control of your Black version independent of Pants' default, configure a resolve similar to the following, and generate the lockfile with pants generate-lockfiles --resolve=your-resolve-name:

# pants.toml

[python.resolves]
...
your-resolve-name = "3rdparty/python/your-resolve-name.lock"

[black]
install_from_resolve = "your-resolve-name"
# BUILD
python_requirement(name="black", resolve="your-resolve-name", requirements=["black>=23,<24"])

Terraform

Bugfix: fixed an issue with cache concurrency. This affected initialization of modules without lockfiles (for example, with the check goal) and the generation of lockfiles. (#21805)

Shell

The previously deprecated [shell-setup].tailor option has now been removed. See [shell-setup].tailor_sources and [shell-setup].tailor_shunit2_tests to update.

Plugin API changes

The version of Python used by Pants itself is now 3.11 (up from 3.9).

The oldest glibc version supported by the published Pants wheels is now 2.28. This should have no effect unless you are running on extremely old Linux distributions. See https://github.com/pypa/manylinux for background context on Python wheels and C libraries.

The integration testing framework in the pantsbuild.pants.testutil package now supports streaming the output of the Pants invocation under test to the console. This is useful when debugging long-running integration tests which would otherwise show no output while they run since the integration test framework previously only captured output to a buffer. To use, adjust specific test(s) to use the new stream_output parameter, for example, run_pants_with_workdir(..., stream_output=True) or run_pants(..., stream_output=True), and then run the test with pants test --debug path/to:test -- --capture=no so the test is invoked as an interactive process and pytest does not capture the output during the run.

Full Changelog

For the full changelog, see the individual GitHub Releases for this series: https://github.com/pantsbuild/pants/releases