Test support for writing Pants plugins.
Project description
Pants is an Apache2 licensed build tool written in Python and Rust.
The latest documentation can be found at pantsbuild.org.
2.15.x Release Series
What's New
Pants 2.15 brings support for several new features:
Environments
Pants now supports alternate execution "environments" for build actions. These "environments" can be explicitly
configured as desired via several new target types (including having multiple environments of the same type).
The new environment
field on many targets tells Pants which environment to use for a particular target.
Pants previously supported local execution (which is now configured by the local_environment
target type) and
remote execution via the Remote Execution API (which is now configured by the remote_environment
target type).
New in Pants 2.15 is support for executing build actions within a Docker container configured via the
docker_environment
target type.
See the Environments documentation for more information.
Test Batching
./pants test
now supports batching compatible tests together so that they execute in the same process.
This can improve performance of test execution by sharing test environment setup across multiple test files,
but must be balanced against the impact on caching and concurrency.
The Python backend is the first user of the test batching support.
New goal: fix
The fix
goal has been added to run tools which generally will perform more invasive changes on your source
files than the fmt
goal. The fmt
goal remains for tools which merely format code without making
semantic changes.
Backends
Python
Several changes have been made to the Python backend:
- Support for the new Environments feature. Relevant targets now have a new
environment
field to configure which environment to use for that target. - Batched execution of
pytest
tests. - Support for
lcov
coverage format. - Support for
pyright
typechecking. - Python lockfiles are now represented in the build graph via synthetic targets.
- Upgrades to default version of several tools including coverage and Flake8.
Go
The Go backend received several changes including:
- Basic support for Cgo
- Coverage reports can be generated in HTML and not just the raw data file used by
go tool cover
. - Support for the
golangci-lint
linter. - Support for multiple
go_mod
targets in same repository. - A new
go-generate
custom goal to rungo generate
on any//go:generate
instructions in a package. $GOROOT/bin
is now prepended toPATH
when running tests to enable them to easily find thego
binary for the Go toolchain in use.
Note: Due to certain changes in Go v1.20, Pants 2.15.x and earlier Pants versions will not work with Go v1.20 and later releases. Instead, use Pants v2.16.x or later Pants versions to support Go v1.20 and later releases.
New: OpenAPI
The new OpenAPI backend provides support for linting OpenAPI API specifications using the spectral
tool
and generating Java code from the OpenAPI specifications.
Enable the pants.backend.experimental.openapi
backend for base OpenAPI support,
the pants.backend.experimental.openapi.lint.spectral
backend for linting support, and
the pants.backend.experimental.openapi.codegen.java
backend for Java code generation support.
Plugin API changes
Several changes were made to the Plugin API including the changes highlighted below. Read the Plugin upgrade guide for a full description of the changes highlighted below (as well as other changes not highlighted here), including how to migrate existing plugins.
Formatters / Linters
The schema used for formatters and linters has been changed in order to allow for formatters and linters which do not require a target on which to operate. See the applicable section of the Plugin upgrade guide for the specific changes.
Batched Tests
The plugin API used by the test
goal has been changed significantly to support the explicit batching of tests. See the
applicable section of the Plugin upgrade guide
for the specific changes.
Synthetic Targets
Plugins may now add "synthetic targets" to the build graph to create freestanding targets programmatically. These synthetic targets can also be generator targets in order to further create generated targets. See the plugin documentation for the Synthetic Targets API for more information.
2.15.2rc0 (Jun 08, 2023)
Bug Fixes
- Improve handling of additional files in Helm unit tests (Cherry-pick of #19263) (#19266)
Documentation
-
update scie-jump cache directory reference (Cherry-pick of #18485) (#19153)
-
Fix docs link to pants_from_sources script. (Cherry-pick of #19088) (#19089)
2.15.1 (May 18, 2023)
The second stable release of the 2.15.x
series, with no changes since the previous rc
!
2.15.1rc3 (May 14, 2023)
Bug Fixes
-
Require urllib3<2, to reduce installation issues (cherry-pick of #18959) (#18973)
-
Do not choke on missing lockfiles. (Cherry-pick of #18940) (#18947)
Performance
- Optimize
Target
andFieldSet
operations (Cherry-pick of #18917) (#18949)
Documentation
- Fix
awslambda-python
documentation (Cherry-pick of #18302) (#18929)
2.15.1rc2 (Apr 23, 2023)
Bug Fixes
-
The
OverridesField.compute_value()
must return a hashable value. (Cherry-pick of #18787) (#18798) -
Use address as stable key when batching field sets in
lint
/test
(Cherry-pick of #18725) (#18733) -
Fix
repr
forField
s that don't definedefault
. (Cherry-pick of #18719) (#18723) -
Fix JVM resource JAR creation on older Mac OSes (Cherry-pick of #18673) (#18675)
Documentation
-
Jacob Floyd/Huon Wilson updates to team page (Cherry-pick of #18221) (#18795)
-
Remove defunct newsletter (Cherry-pick of #18355) (#18796)
-
Add Pylint post (Cherry-pick of #18079) (#18794)
-
Remove a python-specific tip from the general prereqs page. (Cherry-pick of #18637) (#18651)
2.15.1rc1 (Mar 31, 2023)
Bug fixes
-
Ensure that sandboxed processes exit before their sandboxes are clean… (#18641)
-
Plumb entire lockfile/internal only code through
create_pex_from_targets
(cherry-pick of #18622) (#18636) -
Fix export-codgen with multiple output types from same input type (Cherry-pick of #18373) (#18377)
-
Improve debug information for docker auth, and expose an environment variable. (Cherry-pick of #18599) (#18603)
Documentation
- Fix
./pants
->pants
in some docs and help strings. (cherrypick of #18596) (#18607)
2.15.1rc0 (Mar 24, 2023)
Bug fixes
-
Fail fast for attempts to use
test --debug
with a docker environment (Cherry-pick of #18560) (#18567) -
Add support for Docker registry auth (Cherry-pick of #18541) (#18550)
-
Fix Poetry req synthesis for URLs with markers. (Cherry-pick of #18535) (#18537)
-
Preserve environment variables in
pantsd
to allow Docker auth. (Cherry-pick of #18465) (#18467) -
Synthesized lockfile targets should never err on missing lockfiles. (Cherry-pick of #18406) (#18446)
-
go: skip go v1.20+ when searching for the GOROOT (#18429)
Documentation
- Some doc fixes suggested by users. (Cherry-pick of #18393) (#18394)
2.15.0 (Feb 24, 2023)
The first stable release of the series, with no changes since the previous rc
!
2.15.0rc7 (Feb 22, 2023)
Bug fixes
-
Docker environment uses a volume for named caches (Cherry-pick of #18327) (#18337)
-
go: add backends which were missing from distribution (Cherrypick of #18312) (#18316)
-
Ensure that the pep-517 backend shim works on Python 2.7. (Cherry-pick of #18295) (#18300)
2.15.0rc6 (Feb 16, 2023)
New Features
- Allow exporting codegenerated files/resources (Cherry-pick of #18236) (#18241)
Bug fixes
-
Fix bootstrap issue with
__defaults__
and environments. (Cherry-pick of #18251) (#18262) -
Upgrade to Lambdex 0.1.9 (Cherry-pick of #18257) (#18261)
-
Delete override of expected
exe
name forshfmt
. (Cherry-pick of #18258) (#18259) -
Allow breakpoints to be hit when run_in_sandbox is False (Cherry-pick of #18244) (#18245)
Documentation
- docs: add What's New section for 2.15.x release notes (#18226)
2.15.0rc5 (Feb 10, 2023)
Bug fixes
-
Fix published wheel RECORDs. (Cherry-pick of #18219) (#18220)
-
Always explicitly shutdown executors (Cherry-pick of #18216) (#18218)
-
Use
EnvironmentAwarePackageRequest
in many more contexts. (Cherry-pick of #18203) (#18206) -
Have lambdex create a new output file. (Cherry-pick of #18200) (#18201)
2.15.0rc4 (Feb 07, 2023)
Bug fixes
- Shutdown all threads as part of Scheduler shutdown (Cherry-pick of #18166) (#18188)
2.15.0rc3 (Feb 02, 2023)
New Features
- Add
environment=
toexperimental_shell_command
. (Cherry-pick of #17575) (#18064)
Bug fixes
-
Add the
environment
field to most Python binary target types (Cherry-pick of #18144) (#18150) -
Run
pyupgrade
until convergance (Cherry-pick of #18128) (#18130) -
Make mypy cache per-repo (Cherry-pick of #18043) (#18061)
-
go: detect when
go.sum
needs additional entries filled in (Cherrypick of #17811) (#18118) -
Explicitly use "python" ijson backend (cherry-pick of #17787) (#18077)
-
Fix caching of PATH lookups in remote execution (Cherry-pick of #18026) (#18062)
Documentation
-
Document the new get-pants.sh name. (Cherry-pick of #18137) (#18139)
-
Recommend checking the pantsup.sh script in. (Cherry-pick of #18120) (#18134)
-
Change ./pants to pants in the docs (cherry-pick of #18121) (#18124)
-
docs: fix markdown inline code typo in a docstring (Cherry-pick of #18002) (#18103)
-
docs: add tutorials to get started writing plugins (Cherry-pick) (#18107)
-
docs: mention name clashing between custom goals and options when writing plugins (Cherry-pick of #17899) (#18105)
-
docs: tidy up Writing plugins : rules-api directory files (Cherry-pick of #17710) (#18102)
-
Document new pants launcher binary, aka scie-pants. (Cherry-pick of #18056) (#18075)
-
Docs: improve docs on handling option values in cli (Cherry-pick of #17506) (#18069)
-
Update and reorganize resource hub (#17922) (#18068)
-
Add Daniel Goldman and Darcy Shen to team page (Cherry-pick of #17921) (#18066)
-
Nudge more technical support toward GH Discussions (Cherry-pick of #17906) (#18065)
2.15.0rc2 (Jan 18, 2023)
New Features
- Added support for discovering and patching
pyright
config files (cherry-pick of #17771) (#18030)
Bug fixes
-
Streamline local dist handling when running python sources. (Cherry-pick of #17742) (#18035)
-
Adds workunit for interactive processes. (Cherry-pick of #17544) (#17996)
-
Pyright should grab non-transitive dependencies and make them available in the sandbox (Cherry-pick of #17235) (#17980)
-
add
skip_pyright
field to python test targets (Cherry-pick of #17960) (#17968) -
Do not load the BUILD file prelude (macros) in the bootstrap scheduler. (Cherry-pick of #17939) (#17941)
Documentation
- Document how to update the pants script. (Cherry-pick of #17976) (#17979)
2.15.0rc1 (Dec 26, 2022)
Bug fixes
-
scala: support scala v3 which has different compiler/library artifacts (Cherry pick of #17855) (#17866)
-
Restore support for :all: in
only_binary
/no_binary
. (Cherry-pick of #17779) (#17784) -
Test DebugAdapter requests, and fix issues (Cherry-pick of #17678) (#17768)
-
chdir in
rule_runner.run_interactive_process
(Cherry-pick of #17722) (#17765)
Performance
- Run python sources with a VenvPex (Cherry-pick of #17700) (#17761)
Documentation
-
Document batched
pytest
execution. (Cherry-pick of #17845) (#17853) -
Tweak the docs about defaults. (Cherry-pick of #17829) (#17838)
2.15.0rc0 (Dec 08, 2022)
Bug fixes
-
More precise running workunit for processes executing remotely (Cherry-pick of #17719) (#17725)
-
Fix twine env vars propagation for
publish
goal. (Cherry-pick of #17650) (#17659) -
Allow for
run --debug-adapter
to match breakpoints when source is running in a sandbox (Cherry-pick of #17566) (#17584) -
Do not try to create
""
output directory inCreateArchive
(Cherry-pick of #17538) (#17548)
Documentation
-
Fix broken docs links to manual build instructions (Cherry-pick of #17608) (#17610)
-
Update team pages for SJ and Dan! (Cherry-pick of #17534) (#17568)
-
Add Shantanu Kumar to Contributors list (Cherry-pick of #17579) (#17587)
2.15.0a1 (Nov 11, 2022)
New Features
- A --resolve flag, to specify the resolves to export. (Cherry-pick of #17416) (#17461)
User API Changes
- Deprecate the old export semantics. (Cherry-pick of #17465) (#17466)
Bug fixes
-
Fix memoization of
CoarsenedTarget.closure
(Cherry-pick of #17516) (#17518) -
Support parsing targets from additional paths not containing BUILD files. (Cherry-pick of #17451) (#17513)
-
Ensure lockfile target exists before injecting a dependency to it. (Cherry-pick of #17365) (#17505)
-
Ensure correct eq/hash semantics for PythonArtifact. (Cherry-pick of #17484) (#17492)
-
Flip the default for
pull
ondocker_image
toFalse
(Cherry-pick of #17459) (#17460) -
Isolate config seed values from the DEFAULT section. (Cherry-pick of #17474) (#17485)
-
Fix poorly understood stdout redirection issue. (Cherry-pick of #17471) (#17473)
-
Fix propagation of the remote-execution-append-only-caches path (Cherry-pick of #17469) (#17472)
-
Fix dep inference from
shuint2_tests
targets. (Cherry-pick of #17417) (#17422) -
Fix
EnvironmentName
used intest
runs (Cherry-pick of #17412) (#17415) -
Restore debug hints for
test
execution (Cherry-pick of #17406) (#17407)
Performance
-
Skip loading of local cache data when possible (Cherry-pick of #17495) (#17524)
-
Symlink site-packages into
pylint
venvs when possible. (Cherry-pick of #17488) (#17491) -
Filter coarsened targets to only those that are relevant in
pylint
runner rule (Cherry-pick of #17487) (#17490)
Documentation
-
Fix line breaks in a docs page. (Cherry-pick of #17527) (#17528)
-
Clarify how
__defaults__
apply to target generators. (Cherry-pick of #17493) (#17499) -
Fix version templating in
vcs_version
docs (Cherry-pick of #17423) (#17425)
2.15.0a0 (Oct 28, 2022)
New Features
-
Add support for batched
pytest
execution (#17385) -
Add a
batch_size
parameter to thetest
subsystem. (#17361) -
Replace
skip
placeholders with realSkipOption
s in test subsystems. (#17360)
Plugin API Changes
-
Refactor optional typing in generic partitioning utils. (#17371)
-
Refactor plumbing for
test
goal to support batched tests. (#17134) -
Rework partitioning types for more flexibility. (#17288)
Bug fixes
-
Ensure PATH to shims are absolute for the protobuf buf linter. (#17367)
-
Include process execution strategy in Process cache key (#17340)
-
Fix use of
--shard
with--debug
/--debug-adapter
intest
. (#17321) -
go: properly handle xtest packages when building (#17307)
-
Retry the streaming portion of downloads, as well as the setup. (#17298)
Performance
- Implement cancellation of remote processes (#17341)
Documentation
-
Document Synthetic Targets API.(#17330)
-
Initial documentation for Environments (#17096)
-
Add 2.14 blog post link to changelog page. (#17381)
-
Document the existence of the init-pants action. (#17378)
-
Add a section about
test
to plugin API guide. (#17362) -
Revise the error message associated with OOM-killed events (#17373)
-
Fix linebreak issues in the targets docs page. (#17364)
-
Fix a nit in the Getting Help docs. (#17295)
2.15.0.dev5 (Oct 19, 2022)
New Features
-
Synthesize targets for Python lockfiles (#17097)
-
Refactor
shunit2
into a proper subsystem. (#17257) -
Add lcov support (#17256)
-
New API to create synthetic targets. (#16998)
-
Support custom post renderers in Helm deployments (#17215)
-
Add a
fix
goal (#17202) -
Add basic support for pyright typechecking (#17163)
User API Changes
-
Upgrade Pex to 2.1.111. (#17267)
-
Upgrade the Pants-provided
coverage
to version 6.5.X (#17254) -
Upgrade default Flake8 version to 5.0 (#17226)
-
Add Snowflake connector to module mapping (#17165)
-
Always include relevant params in workunit descriptions, and include descriptions in traces by default (#17119)
Plugin API Changes
-
Rename
SubPartition
toBatch
in partitioning types. (#17263) -
Make fmt/lint result types less boilerplate-y (#17192)
-
Begin migration to explicitly scoped environments (#17155)
Bug fixes
-
Fix remote execution not working with remote caching and eager fetch mode (#17272)
-
Remote cache reads are resilient to remote execution writing to the cache (#17195)
-
Adjust
ensure_remote_has_recursive
to succeed if content only exists remotely (#17204) -
Declaring Javascript, Prettier, and Pyright backends/plugins in BUILD (#17190)
-
Set PEX_ROOT for export post-processing command. (#17177)
-
Fix macros depending on macros from other files (#17183)
-
go/gofmt: filter out non-go files from file list (#17171)
-
Fix dep inference with empty lines in multiline imports. (#17284)
Documentation
2.15.0.dev4 (Oct 07, 2022)
New Features
-
Optionally export venvs via symlink into the pex_root. (#17130)
-
go: add cgo support for tailor (#17087)
User API Changes
- Upgrade Pex to 2.1.108. (#17112)
Plugin API Changes
-
Switch
LintRequest.name
to.tool_subsystem
(#17103) -
Rename/Refactor
style_request
to better capture intent. (#17084)
Bug fixes
- Move pyoxidized pants binary out of the main source tree (#16703)
Documentation
-
Generate help info about target_field_name to the docsite. (#17138)
-
Add Aiven to user list. (#17131)
-
Fix
bsp-groups.toml
example in documentation (#17125) -
Update maintainer job description (#17022)
2.15.0.dev3 (Oct 03, 2022)
New Features
-
Add
venv_site_packages_copies
field topex_binary
(#17046) -
Add golangci-lint to go backend (#16994)
-
go: add
go-generate
goal to rungo generate
on a package (#16909) -
Support Java codegen for the OpenAPI backend (#16862)
-
go: render coverage reports as HTML (#16995)
-
Environment-aware subsystems (#16965)
-
Environment sensitive options (#16840)
-
Add retries to NetDownload intrinsic. (#16798)
-
go: add basic support for cgo (#16413)
-
Add support for add-trailing-comma tool (#16776)
User API Changes
Plugin API Changes
-
Improve usability of the
--engine-visualize-to
option (#17080) -
Change
fmt
plugin schema to allow for targetless formatters (#16980) -
Renames
SubsystemRule()
toSubsystem.rules()
(#16954) -
Introduce new schema for lint plugins (#16735)
-
Environment
,EnvironmentRequest
, andCompleteEnvironment
now includeVars
in the name (#16851) -
MockGet
expectsinput_types
kwarg, notinput_type
(#16839)
Bug fixes
-
Fix dirtying of uncacheable nodes (#17079)
-
Make interpreter path expansion cache-correct (#17051)
-
Add python 3.10 to acceptable GCF runtimes (#17028)
-
Don't cache VCS version outside the current pants session. (#17017)
-
Fix Pantsd not properly invalidating when
CPPFLAGS
andLDFLAGS
change (#17009) -
Add
parametrize()
support for__defaults__
. (#16977) -
go: prepend $GOROOT/bin to PATH for tests (#16993)
-
Fix for hang with redirected stdio. (#16970)
-
Fix invalid field error message for parametrized fields. (#16911)
-
Fix venv re-population race. (#16931)
-
wait
for killed nailgun processes. (#16924) -
remove override of register_plugin_field (#16919)
-
Only request source roots for PEP-517 deps that belong on the syspath (#16903)
-
Upgrade
javaparser
, and use a permissive language level to support parsing more code (#16896) -
docker: upgrade bollard crate for bug fix (#16850)
-
Preserve stdio when a local process times out. (#16841)
Performance
-
Add an optional speculation delay when using a remote cache (#16922)
-
Only use remote cache when cache scope is Always or Successful (#16920)
Documentation
-
Fix Helm K8S parser help message (#17091)
-
Update
pytest-xdist
docs. (#17071) -
Fix the [python-bootstrap].search_path option name in the docs. (#17063)
-
Add Doron Somech's proudest contribution (#17029)
-
improve remote cache logging for hit or miss (#16975)
-
Remove bad linebreaks from python-run-goal page. (#16976)
-
Update changelog on docsite with 2.13, 2.14 links (#16918)
-
Add Marcelo to team page, move Josh Reed to Maintainer (#16826)
-
Don't mention a specific version in the manual install instructions. (#16888)
2.15.0.dev2 (Sep 09, 2022)
New Features
-
Force colors from mypy always, strip in pants when --no-colors (#16586)
-
Add OpenAPI backend (#16199)
-
go: analyze imports paths by module to enable multiple
go_mod
targets (#16386)
Bug fixes
-
docker: capture output once after container exits (#16783)
-
docker: lazily initialize docker connection (#16779)
Documentation
-
Add IBM, Coinbase, and Astranis case studies (#16805)
-
Fix broken shortlinks that invoked "docs:" instead of "doc:" (#16804)
-
Add Brand24 to user list. (#16793)
2.15.0.dev1 (Sep 04, 2022)
New Features
-
go: support placing resource files in packages (and not just embedding) (#16688)
-
"naive" docker command runner (#16670)
-
Adds
binary_name
field to PyOxidizer support (#16696)
Plugin API Changes
-
The environment to use becomes a context-specific parameter (#16721)
-
Deprecate
Platform.current
in favor of requesting an injectedPlatform
(#16765) -
Allow
@union
s to declare additional types which are provided to implementers (#16717) -
Deprecate remote_auth_plugin option - plugins can use entry points now. (#16691)
Bug fixes
-
Add support for inferring dependencies used in type context bounds (#16709)
-
Resolve properly provided symbol names for types defined at top level package (#16690)
-
Include type bound constraints in consumed symbols during Scala inference (#16692)
-
Make experimental_shell_command deterministic (#16675)
Documentation
-
List commercial Pants services that optionally supplement community's extensive free tier (#16706)
-
In python resource example, use importlib.resources to read assets (#16695)
-
Welcome community members to consider joining team (#16681)
2.15.0.dev0 (Aug 29, 2022)
New Features
-
Add support for string interpolation in Helm deployments (#16611)
-
Add --squash and --pull options support for docker build (#16607)
-
Support Pex's
--path-mapping
with lockfiles for better local requirement support (#16584) -
[experimental] adds
pants_oxidized_experimental
target, creating a standalone binary distribution for Pants (#16484)
User API Changes
-
Remove deprecated
[python].only_binary
,[python].no_binary
, and[python].tailor_ignore_solitary_init_files
(#16638) -
Remove deprecated
[python].lockfile_generator
and deprecatepoetry
subsystem (used previously for lockfile generation) (#16633) -
Remove deprecated
use_deprecated_directory_cli_args_semantics
option (#16630)
Plugin API Changes
-
Add support for passing multiple input params to a
@rule
Get
(#16668) -
Remove deprecated
matches_filespec
andget_git
functions (#16629) -
Remove unnecessary type parameter from
Get
(#16634)
Bug fixes
-
Fix dirtying of uncacheable nodes (#17079)
-
Make
FilespecMatcher
case-sensitive (#16673) -
Ensure the sandbox distdir exists when creating dists via PEP517. (#16647)
Performance
-
Implement a batched local lookup for missing fingerprints. (#16627)
-
Optimize
CreateDigest
implementation. (#16617)
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pantsbuild.pants.testutil-2.15.2rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86e01d0575469d7e90669e5d43d78777364b69089e2964fc4ed27d965daf1946 |
|
MD5 | 6a412ed73e9a255d3494eb22d0c09c1d |
|
BLAKE2b-256 | 166d2cf5462e7cc1a30f069517c565e948bdbab8583aa30572255b5cba0be7f4 |