Package: pantsbuild.pants.testutil
Pants is an Apache2 licensed build tool written in Python and Rust.The latest documentation can be found atpantsbuild.org.2.17.x Release Series❗❗❗ This project is no longer being released via PyPI, and is instead released via GitHub Releases. Seehttps://github.com/pantsbuild/pants/releasesWhat's NewIndividuals and companies can nowsponsor Pants financially.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 offerformal sponsorship tiers for companies, as well as individual sponsorships viaGitHub.OverallThepantslauncher binary(akascie-pants) is now the recommended way to run Pants.
Use of a./pantsshell script in a repository is deprecated.Thepantslauncher has numerous benefits, such as:automatically download and maintain a Python distribution for running Pantsrunpantsfrom any directory within a repository and not just the build rootfar less overhead when starting commands (up to 4-5×)See thePants  installation
instructionsfor additional information on how to migrate to thepantslauncher binary.Related to this, pants' distribution model is changing, and 2.17 will be the last version where:thepantsbuild.pantspackage is published to PyPI. Usethepants_requirementstargetfor installing the requisite packages for plugins, rather thanpython_requirementor similar.the universal (cross-platform)pantsPEX is published to GitHub Releases. For future releases, smaller per-platform PEXes will be attached instead.PerformanceAs mentioned above, the new launcher binary reduces start-up overhead.Large files are now cached as standalone files on disk, rather than stored directly in the internal database pants uses for cache (but still under the~/.cache/pants/lmdb_storedirectory). This improves performance for manipulating these files, especially when the cache directory and sandbox temporary directory are on the same file system and thus allow hard-linking.BackendsPythonPython dependencies are now analyzed via an intrinsic rule implemented in Rust for increased performance
over the prior Python implementation of the rule. See#18854for
discusion of the performance improvements.Exported mutable virtualenvs can now includePEP-660editable installs ofpython_distributiontargets.
To enable this feature for a resolve, add that resolve's name to the[export].py_editables_in_resolveslist inpants.toml.
See#18639for details on Pants' PEP-660 implementation.The defaultpipPants uses under the hood has changed from 20.3.4 to 23.1.2. This newerpiphas better dependency resolution performance in many cases, but may give different results than the earlierpip. Of course those results will still be correct in the sense that they will be compatible with your requirements and constraints.Thepython_awslambdaorpython_google_cloud_functiontargets now support a new 'zip' layout, as recommended by the cloud vendors. This layout gives smaller packages and faster cold starts than the existing Lambdex layout, and will become the default in 2.18. See the docsforpython_awslambdaandforpython_google_cloud_function.The default value for the[python].interpreter_constraintsoption was deprecated in 2.16 and is now removed:pants.tomlmust provide this option. We recommend constraining to a single interpreter minor version if you can, for instance:interpreter_constraints = ['==3.11.*']. Seethe Interpreter Compatibility docs for more details.DockerThe Docker backend now supports authenticating with registries via theDOCKER_HOST,DOCKER_CONFIGandDOCKER_CERT_PATHenvironment variables.New: Javascript (experimental!)Pants now hasvery earlyexperimental support for Javascript thanks to ongoing efforts by Tobias Nilsson and
Theo Ribeiro. Please note that the Javascript backend is still incomplete, is being actively developed, andprobably
has critical bugs. Despite that, the Pants maintainers would appreciate any feedback from the community to help
guide our development efforts.Supported goals are:test: Letting you run tests via runners installed with the package manager of your choice.packagegoal, either to run a customizedpackage.jsonscript that produces an artifact vianode_build_script, or to pack a tarball for npm-registry publication via thenpm_distributiontarget.tailor: Generates build file targets for*.js,*.test.jsandpackage.jsonfiles.generate-lockfile: Creates the lockfile in the format matching a projects package manager.The backend supports all package managers provided bycorepack.yarn@v2andPlugNPlayis not supported.Enable thepants.backend.experimental.javascriptbackend to try out this support. Pleasefile issuesfor any issues encountered, and follow alongthe stabilization ticket on github.New: Taplo TOML FormatterPants now supports theTaplo TOML formatter. Enable thepants.backend.tools.taplobackend to add this support.Plugin API ChangesRules should now request output types which do not need an input type via the new one-argument form ofGet. For
example, rules can now writeawait Get(ChosenLocalEnvironmentName). Certain request types which exists only to
work around the previous lack of such synax are now deprecated in favor of the one argumentGet()form.ThePythonBinarytype is now deprecated, usePythonBuildStandaloneinstead.2.17.1 (Nov 10, 2023)The second stable release of the2.17.xseries, with only documentation changes since the previousrc!2.17.1rc3 (Oct 28, 2023)Bug FixesAdd best-effort limits on async file opens to reduce file handle counts (Cherry-pick of #20055) (#20078)2.17.1rc2 (Oct 17, 2023)Bug FixesFix algorithm for gathering Go build requests with coverage. (Cherry-pick of #20030) (#20033)docker_image: Theimage_tagsfield must not be empty. (Cherry-pick of #19980) (#19991)Documentationdocs: Remove pants 2.15 example configuration. (Cherry-pick of #19995) (#19997)2.17.1rc1 (Oct 06, 2023)Bug FixesSupport using__defaults__in same BUILD file as environment targets. (Cherry-pick of #19446) (#19969)Fetch shellcheck from vscode-shellcheck for M1 support (Cherry-pick of #19945) (#19952)Immediately invalidate written files in write_digest (Cherry-pick of #19903) (#19949)Fix "failed to create hardlink" error due to multiple mounts on the same device (Cherry-pick of #19894) (#19914)Add missing__init__.pyfile for theyamllintbackend. (Cherry-pick of #19899) (#19906)DocumentationAdd Tom and Gautham to the Contributors page. (Cherry-pick of #19955) (#19962)Remove references to PyPI/pantsbuild.pantswheels in docs (Cherry-pick of #19924) (#19936)2.17.1rc0 (Sep 20, 2023)New Featureswith contextlib.suppress(ImportError)weakens imports (Cherry-pick of #19293) (#19789)Bug FixesPortpantsdfingerprinting to Rust, and validate from native client (Cherry-pick of #19833) (#19867)Add additional directories with register.py to pants bin deps (Cherry pick of #19848) (#19855)Fix global report coverage for namespaced packages (Cherry-pick of #19821) (#19837)Allow requesters ofTargetRootsToFieldSetsto turn off the secondary ownership warning (Cherry-pick of #19721) (#19734)PerformanceRemove memoization of thePathsintrinsic to reduce memory usage (Cherry-pick of #19689) (#19717)Documentationdocs: remove Toolchain references (cherrypick #19508) (#19828)docs: Improve the help string for the global option 'PANTS_CONCURRENT'. (Cherry-pick of #19822) (#19824)Fix Documentation (InitialConfiguration) go backend (Cherry-pick of #19806) (#19809)Fix typoed artifact name in Lambda docs (Cherry-pick of #19739) (#19746)Update the docs changelog to include 2.17.x. (Cherry-pick of #19729) (#19736)2.17.0 (Aug 29, 2023)The first stable release of the series, with no changes since the previousrc!2.17.0rc5 (Aug 26, 2023)Bug FixesRemovetensorboardmapping from our default mapping (Cherry-pick of #19673) (#19677)DocumentationBackport to 2.17: docs: set EnvironmentBehavior in plugin Goal examples (#19590) (#19664)2.17.0rc4 (Aug 23, 2023)User API ChangesRequire scie-pants 0.9.2 or newer, for new distribution model (Cherry-pick of #19654) (#19655)Add Python 3.12 to the default interpreter universe (Cherry-pick of #19641) (#19651)Bug FixesHave Pants create theimmutable_inputsbase parent(s) (Cherry-pick of #19646) (#19652)Use hardlinking when possible for mypy cache (Cherry-pick of #19633) (#19650)Undo pyenv install marking files as RO (Cherry-pick of #19645) (#19648)Make mypy cache move truly atomic (Cherry-pick of #19610) (#19615)Use named cache for Docker-env PBS (Cherry-pick of #19611) (#19616)Add path to cache key for Rust dep inference, for relative imports (cherry-pick of #19630) (#19640)DocumentationBackport to 2.17: Fix dead doc links (#19546) (#19659)Additional mentions and tweaks in 2.17's "What's new" (Cherry-pick of #19629) (#19642)docs: fix code examples forsetting-up-ideandinterpreter-compatibilitydocs (Cherry-pick of #19624) (#19639)docs: fix markdown inconsistencies (Cherry pick of #19363) (#19622)docs: add 2.16 entry to changelog (Cherry-pick of #19589) (#19597)2.17.0rc3 (Aug 13, 2023)User API ChangesUpgrade the default pip to v23.1.2. (Cherry-pick of #19538) (#19541)Bug FixesScala: support Enums in dependency inference (Cherry pick of #19588) (#19593)Fix the new tool lockfile deprecation message. (#19565)Fix golangci-lint runner script (Cherry-pick of #19015) (#19473)DocumentationInitial draft of What's New for v2.17.x (Cherry-pick of #19168) (#19595)Add ruff, adjust pyugprade, autoflake in docs (Cherry-pick of #19555) (#19576)Catch google artifact registry gotcha (Cherry-pick of #19568) (#19570)Stop referring to ~/.cache/pants/setup in CI docs (Cherry-pick of #19554) (#19561)Visibility: documentation fixes and clarifications. (Cherry-pick of #19438) (#19494)2.17.0rc2 (Jul 14, 2023)Bug FixesVisibility: fix issue with using target type in verbose rule selector. (Cherry-pick of #19437) (#19456)Use the "package_name" variable to fix an UnboundLocalError. (Cherry-pick of #19433) (#19453)Fix helm documentation example (Cherry-pick of #19271) (#19313)DocumentationTweak getting-help docs (Cherry-pick of #19418) (#19419)Refinerun_shell_commanddocs (Cherry-pick of #19413) (#19421)Add a sponsorships page to the docsite. (Cherry-pick of #19412) (#19416)Get doc titles from the in-repo markdown files (Cherry-pick of #19311) (#19321)docs: layout tweak of caching info, remove toolchain :( and additional info about bazel-remote-cache (Cherry-pick of #19299) (#19329)2.17.0rc1 (Jun 08, 2023)Plugin API ChangesDeprecate usingPythonBinary(Cherry-pick of #19209) (#19222)Bug FixesImprove handling of additional files in Helm unit tests (Cherry-pick of #19263) (#19268)Add taplo to the release (Cherry-pick of #19258) (#19259)Handle from foo import * wildcard imports in Rust dep inference parser (Cherry-pick of #19249) (#19255)Fix secondary ownership warning semantics (Cherry-pick of #19191) (#19224)2.17.0rc0 (Jun 01, 2023)User API ChangesDeprecate theversion/extra_requirementsoptions on python tools. (Cherry-pick of #19204) (#19211)Terraform: Hashes for MacOS binaries have changed (Cherry-pick of #19004) (#19136)Implement layout="zip" for Lambda/GCF, deprecating lambdex (Cherry-pick of #19076) (#19120)Deprecate[mypy].extra_type_stubsand its lockfile. (Cherry-pick of #19084) (#19087)Bring the tool--exportoption deprecation forward. (Cherry-pick of #19079) (#19083)Bug FixesDiscover Scala REPL main class and coordinates (Cherry-pick of #19189) (#19203)Scrub the Pyenv install dir before attempting an install. (Cherry-pick of #19193) (#19197)Avoid extra.infrom .. importparent imports in Rust Python dep inference (Cherry-pick of #19175) (#19177)Don't try and garbage collect tempfiles (Cherry-pick of #19103) (#19113)If a shebang already exists when adding a preamble, preserve it. (Cherry-pick of #19133) (#19138)Workaroundbotocorebug in S3 URL Handler backend (Cherry-pick of #19056) (#19111)DocumentationAddtobnito Maintainers (Cherry-pick of #19195) (#19207)Adjust FaaS docs forlayout = "zip"(Cherry-pick of #19180) (#19198)Addbotocore-a-la-cartereference tos3URL Handler (Cherry-pick of #19055) (#19109)add bazel-remote to list of compatible remote caches (Cherry-pick of #19041) (#19115)Fix docs link topants_from_sourcesscript. (Cherry-pick of #19088) (#19091)2.17.0a1 (May 19, 2023)Due to infrastructure issues,2.17.0a1is a second attempt at publishing2.17.0a0.2.17.0a0 (May 18, 2023)NOTE:2.17.0a0was not released to PyPI due to infrastructure issues.New FeaturesAdd a workunit logging plugin (#18984)javascript: Addyarn@v1support (#18928)javascript: Support Node.js subpath imports (#18934)Add Taplo toml formatter (#18865)Include the Pants native client in released wheels (#18957)Extract Python dependencies in an intrinsic (#18854)User API ChangesDo not publish wheels for all SHAs, and publish to PyPI from Github Actions. (#19028)Support Python requirement target addrs in tool requirements. (#19014)javascript: Add an explicitnpm_distributiontarget instead of coupling tonode_package(#18925)Shorten the deprecation forexportwithout--resolve. (#19000)Upgrade Pex to 2.1.137. (#19003)Remove the underlying implementation ofanonymous-telemetry(#18952)Plugin API ChangesPort Django migrations inference away fromPythonDependencyVisitorRequest(#19008)fmtrequest -> abstractfmtrequest (#18935)Bug FixesUse{bin_name()} runas$0inrun_shell_command(#19020)MakeDigestSubsetsymlink-aware (#18963)javascript: Do not add literal {chroot} to pnpm cache path (#18921)DocumentationClarify how to set $0 properly inrun_in_shell_command(#19019)Docs tweaks for 2.16.x (#19009)Fix examplefirst_party_dependency_version_schemein docs (#18993)2.17.0.dev5 (May 08, 2023)New Featuresjavascript: Implement dependency inference opt-out and improve resillience (#18931)javascript: Add support for the pnpm package manager (#18864)Eagerly clean running nodes rather than interrupting them. (#18855)javascript: Nodejs tests batch support (#18742)New API type:CurrentExecutingGoals. (#18788)User API Changesjavascript: Supportpackagegoal innode_build_scripttarget (#18926)Deprecate running Pants outside scie-pants. (#18833)Upgrade Pex to 2.1.135. (#18876)Plugin API ChangesRemove redundant PythonToolBase/JvmToolBase features. (#18805)Bug FixesEnsure packaged artefacts are fully replaced in dist/ (#18930)Use a set when calculating resolve names (#18939)Use a set when calculating resolve names (#18939)javascript: Handle package.json placed at the root of the repository (#18919)Actually run deprecated targets fixer (#18860)Remove existing entry if any when materialising symlink (#18873)Ensure non-ambiguous args/env vars injection into PEXes (#18861)Handle workdir="."/default properly in run_shell_command (#18840)Write adhoc_tool(stdout/stderr="...") relative to workdir, support absolute paths (#18814)PatchStreamingWorkunitContext.get_expanded_specs(). (#18713)help backends: Only list enabled experimental backends unless advanced help. (#18821)Use build root as workdir for shell_command(workdir="") (#18813)Includepants.backend.url_handlers.s3in pants distribution. (#18826)PerformanceOptimizeTargetandFieldSetoperations (#18917)Triage some noqa: PNT30 await-in-loops (#18831)DocumentationUpdate the identity of the response team for CoC violation reporting. (#16410)Fix adhoc output_... example, document run_shell_command workdir changes (#18894)Add missing backtick in help string (#18907)Add Salesforce to the users list (#18891)update troubleshooting document about self-hosted action runner (#18900)Credit the Works on ARM program for our CI resources. (#18892)feat: update installation.md (#18836)Remove reference to readme.com as the way to edit documentation (#18863)Fix library name typo in third party example (#18862)Update mypy and pytest documentation to refer to install_from_resolve (#18791)Includesymbolsas topic in usage help. (#18825)docs: reorder contributor steps, rustup is required for git hooks install to work smoothly (#18828)2.17.0.dev4 (Apr 23, 2023)New Featuresjavascript: Managenpmversion with corepack (#18748)python_distributioneditable installs in exports (#18639)User API ChangesDefault to using the entire tool lockfile. (#18793)Upgrade Pex to 2.1.134. (#18785)Use the resolve's ICs for tools. (#18776)Use Self backport inBinaryPathfactory method. (#18763)Deprecate "Secondary Ownership" semantics (#18737)Expand versions range forruff+ upgrade it (#18707)Plugin API ChangesAllowBinaryPathsto close over their type. (#18760)Set a central default ICs for tools. (#18714)Bug FixesTheOverridesField.compute_value()must return a hashable value. (#18787)Dedup graph errors. (#18770)Flush metadata to disk before renaming immutable store files (#18768)Clear FSDB materialization cache whenremoveing a file (#18747)Use address as stable key when batching field sets inlint/test(#18725)FixreprforFields that don't definedefault. (#18719)Addrufflint rules (#18716)javascript: Use binary shims in nodejs sandboxes (#18682)DocumentationImprove error location for invalid targets/target fields. (#18366)Add info on how to configure Docker Desktop for usingdocker_environment(#18786)Update linter documentation to refer toinstall_from_resolve(#18781)docs: Fix typo on requirements-overrides code snippet (#18750)Edit Python publishing docs for clarity. (#18718)2.17.0.dev3 (Apr 10, 2023)New FeaturesHelm: Add support for DNS lookups in Chart templates (#18670)Include global Git ignore file and.git/info/excludeinpants_ignoreto ignore for file watching (#18649)User API ChangesRemove deprecated default ICs. (#18627)Plugin API ChangesMove/Rename:goals/setup_py.py->{util_rules,goals}/package_dists.py+subsystems/setup_py_generation.py(#18702)Deprecate someRequesttypes in favor ofGet()with only one arg (#18655)Add support forGet(MyType)syntax with no input args (#18648)Bug fixesAdds a fully-qualified path to a Python interpreter forpex_binaryRunRequests (#18699)Remove implicit conversion fromstd::io::ErrortoStoreError(#18696)Add timeout to remote store calls, and adjust name of cache timeout. (#18695)Makesadhoc_toolactually respect theextra_env_varsfield; adds tests (#18692)doc: Describe relevant error modes during rule compilation (#18663)Bump minimum supported version of Pex to v2.1.129. (#18678)Fix JVM resource JAR creation on older Mac OSes (#18673)javascript: Do not read none mapped package.json files in javascript rules (#18523)DocumentationAdd PEP 621 pyproject.toml file docs (#18672)Document AWS CDK issue that multiple users have encountered. (#18656)Error when goals used without relevant backends activated (#18420)Improve lockfile consumption error message. (#18638)Remove a python-specific tip from the general prereqs page. (#18637)Make UUID message clearer (#18561)2.17.0.dev2 (Mar 31, 2023)New Featuresjavascript: Test goal with package manager installed test runner support (#18554)expose PANTS_VERSION and make it string-comparable (#18573)User API ChangesUpgrade Pex to 2.1.131. (#18626)Bug fixesEnsure that sandboxed processes exit before their sandboxes are cleaned up (#18632)Plumb entire lockfile/internal only code throughcreate_pex_from_targets(#18622)narrow pex_binary files warning (#18619)Fix PexPEX invocations (#18610)Improve debug information for docker auth, and expose an environment variable. (#18599)PerformanceOnly materialize immutable files once per process (#18600)DocumentationFix a string that should have been an f-string (#18608)Fix./pants->pantsin some docs and help strings. (#18596)2.17.0.dev1 (Mar 24, 2023)New Featuresengine: add an option to clear the destination directory when writing digest to disk (#18534)javascript: NodeJS bootstrapping via binary paths, PATH, asdf or nvm (#18520)javascript: Initial NPM support (#18326)Always provide Python-for-Pants-scripts (#18433)User API ChangesUpgrade Pex to 2.1.130. (#18576)Deprecate old-style custom tool lockfiles. (#18494)Let a user resolve shadow a tool lockfile of the same name (#18481)Bug fixesEnsure that a symlinked exported venv exists and is valid. (#18575)Fail fast for attempts to usetest --debugwith a docker environment (#18560)Declare ruff outputs as files. (#18551)Add support for Docker registry auth (#18541)Fix Poetry req synthesis for URLs with markers. (#18535)Re-enable hardlinking usingfclonefileaton macOS. (#18501)PerformanceMaterialize "large" files in a new store location and hardlink them in sandboxes (#18153)Finish parallelizing materialization of Process inputs (#18469)DocumentationFirst pass atadhoc_tooldocumentation (#18531)Add Tobias Nilsson to team page (#18571)docs: fix an f-string in help (#18539)Clarify thatexperimental_shell functions are deprecated and replaced (#18529)Update docs on running pants from sources with scie-pants. (#18513)Add ExoFlare to user list. (#18496)Fix malformed pantsbuild/example-python link in documentation (#18484)update scie-jump cache directory reference (#18485)Expand lockfile documentation to its own page. (#18471)2.17.0.dev0 (Mar 10, 2023)New FeaturesExpose environment information on process metadata (#18458)Support runningpantsfrom anywhere in the project. (#18412)User API ChangesAudit and update requirements for Python tools. (#18431)Upgrade Pex to 2.1.128. (#18453)Bug fixesPreserve environment variables inpantsdto allow Docker auth. (#18465)Only expose the equiv offrom typing import *in prelude files (#18452)Support type hints in prelude files. (#18442)Synthesized lockfile targets should never err on missing lockfiles. (#18406)Fixes to visualisations for xdot (#18421)