diff --git a/build-support/bin/generate_completions.py b/build-support/bin/generate_completions.py index 97f79aeb9da9..fe466c5958e8 100644 --- a/build-support/bin/generate_completions.py +++ b/build-support/bin/generate_completions.py @@ -82,7 +82,7 @@ def _run_pants_help(): def _parse_help_for_options(help: dict, scope: str) -> tuple[frozenset[str], frozenset[str]]: - """scope represents the goal or subsystem of interest Returns a tuple containing the scoped + """Scope represents the goal or subsystem of interest Returns a tuple containing the scoped options, followed by unscoped.""" scoped_help_info = help["scope_to_help_info"][scope] diff --git a/build-support/bin/generate_json_schema.py b/build-support/bin/generate_json_schema.py index da6e2ccc3d6b..3b8f5903c9ff 100644 --- a/build-support/bin/generate_json_schema.py +++ b/build-support/bin/generate_json_schema.py @@ -66,8 +66,8 @@ def get_default(option: dict) -> Any: """Get default value for an option. Ensure options that depend on any machine specific environment are properly handled. E.g. - `"default": "/.pants.d"` will be expanded to the `"default": "/home/your-user.name/code/pants/.pants.d"` - which is not what we want to have in a public schema. + `"default": "/.pants.d"` will be expanded to the `"default": "/home/your- + user.name/code/pants/.pants.d"` which is not what we want to have in a public schema. """ return ENV_SPECIFIC_OPTION_DEFAULTS.get(option["config_key"], option["default"]) diff --git a/build-support/bin/terraform_tool_versions.py b/build-support/bin/terraform_tool_versions.py index 2774ff04e2da..9de9689e48b4 100644 --- a/build-support/bin/terraform_tool_versions.py +++ b/build-support/bin/terraform_tool_versions.py @@ -3,11 +3,11 @@ # Licensed under the Apache License, Version 2.0 (see LICENSE). """Fetch versions of Terraform and format them for use in known_versions. -The main version page lists the available versions in descending order. -It includes stable releases but also various levels of pre-release. +The main version page lists the available versions in descending order. It includes stable releases +but also various levels of pre-release. -Each version links to a version-specific page. -This page includes links to download the binary, sha256sum file, and a signature of the sha256sum file. +Each version links to a version-specific page. This page includes links to download the binary, +sha256sum file, and a signature of the sha256sum file. """ import csv diff --git a/build-support/migration-support/fix_deprecated_globs_usage.py b/build-support/migration-support/fix_deprecated_globs_usage.py index 44c488c61651..98ebff44e5a5 100755 --- a/build-support/migration-support/fix_deprecated_globs_usage.py +++ b/build-support/migration-support/fix_deprecated_globs_usage.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A script to replace deprecated uses of `globs`, `rglobs`, and `zglobs` in BUILD files with a direct list of files and globs. @@ -77,10 +76,11 @@ class GlobFunction(NamedTuple): def normalize_rglob(rglob: str) -> str: """We must expand rglobs for them to work properly. - In rglobs, * at the beginning of a path component means "any number of directories, including 0". - So every time we see ^*, we need to output "**/*whatever". + In rglobs, * at the beginning of a path component means "any number of directories, + including 0". So every time we see ^*, we need to output "**/*whatever". - See https://github.com/pantsbuild/pants/blob/9832c8f6d8b60648cf906775506864aad0ffdb33/src/python/pants/source/wrapped_globs.py#L303 + See + https://github.com/pantsbuild/pants/blob/9832c8f6d8b60648cf906775506864aad0ffdb33/src/python/pants/source/wrapped_globs.py#L303 for the original implementation. """ components = rglob.split(os.path.sep) diff --git a/build-support/migration-support/migrate_to_toml_config.py b/build-support/migration-support/migrate_to_toml_config.py index 0a28b32b065d..11737110b2ef 100755 --- a/build-support/migration-support/migrate_to_toml_config.py +++ b/build-support/migration-support/migrate_to_toml_config.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A script to automatically convert an INI Pants config file to TOML. There will still likely be some issues remaining which require manual fixes, but this script will automate most of the tedium. diff --git a/src/python/pants/backend/awslambda/python/register.py b/src/python/pants/backend/awslambda/python/register.py index f6f646b812d8..7cd265ce6bd3 100644 --- a/src/python/pants/backend/awslambda/python/register.py +++ b/src/python/pants/backend/awslambda/python/register.py @@ -1,6 +1,5 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Create AWS Lambdas from Python code. See https://www.pantsbuild.org/docs/awslambda-python. diff --git a/src/python/pants/backend/cc/lint/clangformat/subsystem.py b/src/python/pants/backend/cc/lint/clangformat/subsystem.py index bf3a73d1b4bf..2ef78abde1ee 100644 --- a/src/python/pants/backend/cc/lint/clangformat/subsystem.py +++ b/src/python/pants/backend/cc/lint/clangformat/subsystem.py @@ -37,7 +37,7 @@ class ClangFormat(PythonToolBase): default_lockfile_resource = ("pants.backend.cc.lint.clangformat", "clangformat.lock") def config_request(self, dirs: Iterable[str]) -> ConfigFilesRequest: - """clang-format will use the closest configuration file to the file currently being + """Clang-format will use the closest configuration file to the file currently being formatted, so add all of them.""" config_files = ( ".clang-format", diff --git a/src/python/pants/backend/codegen/protobuf/python/register.py b/src/python/pants/backend/codegen/protobuf/python/register.py index 3211453c3909..ff244ebe0dcd 100644 --- a/src/python/pants/backend/codegen/protobuf/python/register.py +++ b/src/python/pants/backend/codegen/protobuf/python/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Generate Python sources from Protocol Buffers (Protobufs). See https://www.pantsbuild.org/docs/protobuf. diff --git a/src/python/pants/backend/experimental/cc/lint/clangformat/register.py b/src/python/pants/backend/experimental/cc/lint/clangformat/register.py index ae3cf36579ab..4c30e43e636e 100644 --- a/src/python/pants/backend/experimental/cc/lint/clangformat/register.py +++ b/src/python/pants/backend/experimental/cc/lint/clangformat/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A formatter for C/C++ (and several other languages). See https://clang.llvm.org/docs/ClangFormat.html for details. diff --git a/src/python/pants/backend/experimental/javascript/lint/prettier/register.py b/src/python/pants/backend/experimental/javascript/lint/prettier/register.py index 273d4c390a65..cfa0f3f3f587 100644 --- a/src/python/pants/backend/experimental/javascript/lint/prettier/register.py +++ b/src/python/pants/backend/experimental/javascript/lint/prettier/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A formatter for JS/TS (and several other languages). See https://prettier.io/ for details. diff --git a/src/python/pants/backend/experimental/python/framework/stevedore/register.py b/src/python/pants/backend/experimental/python/framework/stevedore/register.py index bad4823cb55d..a333c074624e 100644 --- a/src/python/pants/backend/experimental/python/framework/stevedore/register.py +++ b/src/python/pants/backend/experimental/python/framework/stevedore/register.py @@ -1,6 +1,5 @@ # Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A python "framework" for apps to dynamically load plugins. See https://github.com/openstack/stevedore for details. diff --git a/src/python/pants/backend/experimental/python/lint/add_trailing_comma/register.py b/src/python/pants/backend/experimental/python/lint/add_trailing_comma/register.py index cec91b42fad6..1c8cab39232f 100644 --- a/src/python/pants/backend/experimental/python/lint/add_trailing_comma/register.py +++ b/src/python/pants/backend/experimental/python/lint/add_trailing_comma/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Autoformatter to automatically add trailing commas to calls and literals. See https://github.com/asottile/add-trailing-comma for details. diff --git a/src/python/pants/backend/experimental/python/lint/ruff/register.py b/src/python/pants/backend/experimental/python/lint/ruff/register.py index 9caaa924e81b..bf922c612769 100644 --- a/src/python/pants/backend/experimental/python/lint/ruff/register.py +++ b/src/python/pants/backend/experimental/python/lint/ruff/register.py @@ -1,6 +1,5 @@ # Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Linter & formatter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and https://docs.astral.sh/ruff/ diff --git a/src/python/pants/backend/experimental/python/typecheck/pyright/register.py b/src/python/pants/backend/experimental/python/typecheck/pyright/register.py index 2f3c7c9a1e7e..8fbe9c2da365 100644 --- a/src/python/pants/backend/experimental/python/typecheck/pyright/register.py +++ b/src/python/pants/backend/experimental/python/typecheck/pyright/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Static type checker for Python, running on NodeJS. See https://github.com/Microsoft/pyright for details. diff --git a/src/python/pants/backend/experimental/tools/semgrep/register.py b/src/python/pants/backend/experimental/tools/semgrep/register.py index 589cf36713b5..13385e73ca8a 100644 --- a/src/python/pants/backend/experimental/tools/semgrep/register.py +++ b/src/python/pants/backend/experimental/tools/semgrep/register.py @@ -1,6 +1,5 @@ # Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Lightweight static analysis for many languages. Find bug variants with patterns that look like source code. diff --git a/src/python/pants/backend/experimental/tools/yamllint/register.py b/src/python/pants/backend/experimental/tools/yamllint/register.py index c0cb52cc2ac3..d2b2ab8d5215 100644 --- a/src/python/pants/backend/experimental/tools/yamllint/register.py +++ b/src/python/pants/backend/experimental/tools/yamllint/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """A configurable linter for YAML files. See https://yamllint.readthedocs.io/ for details. diff --git a/src/python/pants/backend/google_cloud_function/python/register.py b/src/python/pants/backend/google_cloud_function/python/register.py index c74852da6d21..38000c7bce3e 100644 --- a/src/python/pants/backend/google_cloud_function/python/register.py +++ b/src/python/pants/backend/google_cloud_function/python/register.py @@ -1,6 +1,5 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Create Google Cloud Functions from Python code. See https://www.pantsbuild.org/docs/google-cloud-function-python. diff --git a/src/python/pants/backend/project_info/count_loc_test.py b/src/python/pants/backend/project_info/count_loc_test.py index f7cef7c7f1be..a54a5f618e5f 100644 --- a/src/python/pants/backend/project_info/count_loc_test.py +++ b/src/python/pants/backend/project_info/count_loc_test.py @@ -84,7 +84,7 @@ def test_passthrough_args(rule_runner: RuleRunner) -> None: def test_files_without_owners(rule_runner: RuleRunner) -> None: - """cloc works on any readable file in the build root, regardless of whether it's declared in a + """Cloc works on any readable file in the build root, regardless of whether it's declared in a BUILD file.""" rule_runner.write_files( { diff --git a/src/python/pants/backend/project_info/register.py b/src/python/pants/backend/project_info/register.py index ca47d3fdc463..5376583b3e64 100644 --- a/src/python/pants/backend/project_info/register.py +++ b/src/python/pants/backend/project_info/register.py @@ -1,6 +1,5 @@ # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Information on your project, such as listing the targets in your project.""" from pants.backend.project_info import ( diff --git a/src/python/pants/backend/python/dependency_inference/default_module_mapping.py b/src/python/pants/backend/python/dependency_inference/default_module_mapping.py index 7e59bc46ed20..a433ec194560 100644 --- a/src/python/pants/backend/python/dependency_inference/default_module_mapping.py +++ b/src/python/pants/backend/python/dependency_inference/default_module_mapping.py @@ -36,7 +36,7 @@ def two_groups_hyphens_two_replacements_with_suffix( second_group_replacement: str = "", custom_suffix: str = "", ) -> str: - """take two groups, and by default, the first will have '-' replaced with '.', the second will + """Take two groups, and by default, the first will have '-' replaced with '.', the second will have '-' replaced with '' e.g. google-cloud-foo-bar -> group1(google.cloud.)group2(foobar) >>> two_groups_hyphens_two_replacements_with_suffix(re.match(r"^(google-cloud-)([^.]+)", "google-cloud-foo-bar")) diff --git a/src/python/pants/backend/python/dependency_inference/module_mapper.py b/src/python/pants/backend/python/dependency_inference/module_mapper.py index 60d11dde673e..138a367b9823 100644 --- a/src/python/pants/backend/python/dependency_inference/module_mapper.py +++ b/src/python/pants/backend/python/dependency_inference/module_mapper.py @@ -143,7 +143,6 @@ class FirstPartyPythonModuleMapping: resolves_to_modules_to_providers: FrozenDict[ ResolveName, FrozenDict[str, Tuple[ModuleProvider, ...]] ] - """A merged mapping of each resolve name to the first-party module names contained and their owning addresses. diff --git a/src/python/pants/backend/python/lint/autoflake/register.py b/src/python/pants/backend/python/lint/autoflake/register.py index b9e19abcd38a..e523d371e065 100644 --- a/src/python/pants/backend/python/lint/autoflake/register.py +++ b/src/python/pants/backend/python/lint/autoflake/register.py @@ -1,6 +1,5 @@ # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Autoformatter for removing unused Python imports. See https://github.com/myint/autoflake for details. diff --git a/src/python/pants/backend/python/lint/bandit/register.py b/src/python/pants/backend/python/lint/bandit/register.py index 5364a91b5323..47e97053a9f0 100644 --- a/src/python/pants/backend/python/lint/bandit/register.py +++ b/src/python/pants/backend/python/lint/bandit/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Security linter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/black/register.py b/src/python/pants/backend/python/lint/black/register.py index 3cade15690d0..c71f9024306d 100644 --- a/src/python/pants/backend/python/lint/black/register.py +++ b/src/python/pants/backend/python/lint/black/register.py @@ -1,6 +1,5 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Autoformatter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/docformatter/register.py b/src/python/pants/backend/python/lint/docformatter/register.py index 084fef62ed2c..e2307b179c78 100644 --- a/src/python/pants/backend/python/lint/docformatter/register.py +++ b/src/python/pants/backend/python/lint/docformatter/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Python autoformatter for PEP257 docstring conventions. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/flake8/register.py b/src/python/pants/backend/python/lint/flake8/register.py index 3cbc4c94e65c..754ad9bbbfb2 100644 --- a/src/python/pants/backend/python/lint/flake8/register.py +++ b/src/python/pants/backend/python/lint/flake8/register.py @@ -1,6 +1,5 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Linter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/isort/register.py b/src/python/pants/backend/python/lint/isort/register.py index eac6a591e365..8ef2f4c141f3 100644 --- a/src/python/pants/backend/python/lint/isort/register.py +++ b/src/python/pants/backend/python/lint/isort/register.py @@ -1,6 +1,5 @@ # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Autoformatter for Python import statements. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/pydocstyle/register.py b/src/python/pants/backend/python/lint/pydocstyle/register.py index 5015dd74cd66..df60696bfc25 100644 --- a/src/python/pants/backend/python/lint/pydocstyle/register.py +++ b/src/python/pants/backend/python/lint/pydocstyle/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Static analysis tool for checking compliance with Python docstring conventions. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/lint/pylint/register.py b/src/python/pants/backend/python/lint/pylint/register.py index 918ad6086635..7769d87a6c43 100644 --- a/src/python/pants/backend/python/lint/pylint/register.py +++ b/src/python/pants/backend/python/lint/pylint/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Linter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and https://www.pylint.org. diff --git a/src/python/pants/backend/python/lint/pyupgrade/register.py b/src/python/pants/backend/python/lint/pyupgrade/register.py index 4800c8471c82..23b12ae58cd5 100644 --- a/src/python/pants/backend/python/lint/pyupgrade/register.py +++ b/src/python/pants/backend/python/lint/pyupgrade/register.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """https://github.com/asottile/pyupgrade. A tool to automatically upgrade syntax for newer versions of the language. diff --git a/src/python/pants/backend/python/lint/yapf/register.py b/src/python/pants/backend/python/lint/yapf/register.py index f61fed9dbe6d..999970fb25a6 100644 --- a/src/python/pants/backend/python/lint/yapf/register.py +++ b/src/python/pants/backend/python/lint/yapf/register.py @@ -1,6 +1,5 @@ # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Autoformatter for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/providers/pyenv/rules.py b/src/python/pants/backend/python/providers/pyenv/rules.py index 4bcf60bdb497..159f4bb0f2a1 100644 --- a/src/python/pants/backend/python/providers/pyenv/rules.py +++ b/src/python/pants/backend/python/providers/pyenv/rules.py @@ -104,8 +104,8 @@ def generate_exe(self, plat: Platform) -> str: If the downloaded artifact is the executable itself, you can leave this unimplemented. - If the downloaded artifact is an archive, this should be overridden to provide a - relative path in the downloaded archive, e.g. `./bin/protoc`. + If the downloaded artifact is an archive, this should be overridden to provide a relative + path in the downloaded archive, e.g. `./bin/protoc`. """ return f"./pyenv-{self.version}/bin/pyenv" diff --git a/src/python/pants/backend/python/register.py b/src/python/pants/backend/python/register.py index 38ee925abecc..2de5b4c7e2ab 100644 --- a/src/python/pants/backend/python/register.py +++ b/src/python/pants/backend/python/register.py @@ -1,6 +1,5 @@ # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Support for Python. See https://www.pantsbuild.org/docs/python-backend. diff --git a/src/python/pants/backend/python/target_types_rules.py b/src/python/pants/backend/python/target_types_rules.py index 2d2aab73e6fd..6d948d4596ea 100644 --- a/src/python/pants/backend/python/target_types_rules.py +++ b/src/python/pants/backend/python/target_types_rules.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Rules for the core Python target types. This is a separate module to avoid circular dependencies. Note that all types used by call sites are diff --git a/src/python/pants/backend/python/typecheck/mypy/register.py b/src/python/pants/backend/python/typecheck/mypy/register.py index 119898bab1fa..b05dd379d2cc 100644 --- a/src/python/pants/backend/python/typecheck/mypy/register.py +++ b/src/python/pants/backend/python/typecheck/mypy/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Type checker for Python. See https://www.pantsbuild.org/docs/python-linters-and-formatters and diff --git a/src/python/pants/backend/python/typecheck/pytype/subsystem.py b/src/python/pants/backend/python/typecheck/pytype/subsystem.py index a6d061bef65d..6a39fd2ceec8 100644 --- a/src/python/pants/backend/python/typecheck/pytype/subsystem.py +++ b/src/python/pants/backend/python/typecheck/pytype/subsystem.py @@ -45,7 +45,8 @@ def config_request(self) -> ConfigFilesRequest: """Pytype will look for a `pyproject.toml` (with a `[tool.pytype]` section) in the project root. - Pytype's configuration content is specified here: https://github.com/google/pytype#config- + Pytype's configuration content is specified here: + https://github.com/google/pytype#config- file. """ diff --git a/src/python/pants/backend/python/util_rules/local_dists_pep660.py b/src/python/pants/backend/python/util_rules/local_dists_pep660.py index 079787d100bc..53d8fe5dbbb7 100644 --- a/src/python/pants/backend/python/util_rules/local_dists_pep660.py +++ b/src/python/pants/backend/python/util_rules/local_dists_pep660.py @@ -378,13 +378,12 @@ class EditableLocalDistsRequest: class EditableLocalDists: """A Digest populated by editable (PEP660) wheels of local dists. - According to PEP660, these wheels should not be exported to users and must be discarded - after install. Anything that uses this should ensure that these wheels get installed and - then deleted. + According to PEP660, these wheels should not be exported to users and must be discarded after + install. Anything that uses this should ensure that these wheels get installed and then deleted. - Installing PEP660 wheels creates an "editable" install such that the sys.path gets - adjusted to include source directories from the build root (not from the sandbox). - This is decidedly not hermetic or portable and should only be used locally. + Installing PEP660 wheels creates an "editable" install such that the sys.path gets adjusted to + include source directories from the build root (not from the sandbox). This is decidedly not + hermetic or portable and should only be used locally. PEP660 wheels have .dist-info metadata and the .pth files (or similar) that adjust sys.path. """ diff --git a/src/python/pants/backend/python/util_rules/package_dists.py b/src/python/pants/backend/python/util_rules/package_dists.py index 392a485414a8..dbbd8c2cd23e 100644 --- a/src/python/pants/backend/python/util_rules/package_dists.py +++ b/src/python/pants/backend/python/util_rules/package_dists.py @@ -163,8 +163,8 @@ class OwnedDependency: Code in this target is published in the owner's distribution. - The owner of a target T is T's closest filesystem ancestor among the python_distribution - targets that directly or indirectly depend on it (including T itself). + The owner of a target T is T's closest filesystem ancestor among the python_distribution targets + that directly or indirectly depend on it (including T itself). """ target: Target diff --git a/src/python/pants/backend/python/util_rules/partition.py b/src/python/pants/backend/python/util_rules/partition.py index e9c64c3ed52e..94394d4ea43f 100644 --- a/src/python/pants/backend/python/util_rules/partition.py +++ b/src/python/pants/backend/python/util_rules/partition.py @@ -59,9 +59,9 @@ async def _find_all_unique_interpreter_constraints( This will find the constraints for each individual matching field set, and then OR across all unique constraints. Usually, Pants partitions when necessary so that conflicting interpreter - constraints can be handled gracefully. But in some cases, like the `generate-lockfiles` goal, - we need to combine those targets into a single value. This ORs, so that if you have a - ==2.7 partition and ==3.6 partition, for example, we return ==2.7 OR ==3.6. + constraints can be handled gracefully. But in some cases, like the `generate-lockfiles` goal, we + need to combine those targets into a single value. This ORs, so that if you have a ==2.7 + partition and ==3.6 partition, for example, we return ==2.7 OR ==3.6. Returns the global interpreter constraints if no relevant targets were matched. """ diff --git a/src/python/pants/base/deprecated.py b/src/python/pants/base/deprecated.py index d065b73c3338..1a705d47079d 100644 --- a/src/python/pants/base/deprecated.py +++ b/src/python/pants/base/deprecated.py @@ -46,8 +46,8 @@ class CodeRemovedError(Exception): I.e., that the option/function/module with that removal_version has already been removed. - Note that the code in question may not actually have been excised from the codebase yet, but - it may be at any time. + Note that the code in question may not actually have been excised from the codebase yet, but it + may be at any time. """ diff --git a/src/python/pants/base/exception_sink.py b/src/python/pants/base/exception_sink.py index e2a8861d4aa9..4cc4b3da6968 100644 --- a/src/python/pants/base/exception_sink.py +++ b/src/python/pants/base/exception_sink.py @@ -26,9 +26,9 @@ class SignalHandler: """A specification for how to handle a fixed set of nonfatal signals. This is subclassed and registered with ExceptionSink.reset_signal_handler() whenever the signal - handling behavior is modified for different pants processes, for example in the remote client when - pantsd is enabled. The default behavior is to exit "gracefully" by leaving a detailed log of which - signal was received, then exiting with failure. + handling behavior is modified for different pants processes, for example in the remote client + when pantsd is enabled. The default behavior is to exit "gracefully" by leaving a detailed log + of which signal was received, then exiting with failure. Note that the terminal will convert a ctrl-c from the user into a SIGINT. """ diff --git a/src/python/pants/build_graph/build_configuration.py b/src/python/pants/build_graph/build_configuration.py index 003c5b58fec7..5bb3a32bc3f7 100644 --- a/src/python/pants/build_graph/build_configuration.py +++ b/src/python/pants/build_graph/build_configuration.py @@ -143,11 +143,11 @@ class Builder: def registered_aliases(self) -> BuildFileAliases: """Return the registered aliases exposed in BUILD files. - These returned aliases aren't so useful for actually parsing BUILD files. - They are useful for generating online documentation. + These returned aliases aren't so useful for actually parsing BUILD files. They are + useful for generating online documentation. :returns: A new BuildFileAliases instance containing this BuildConfiguration's - registered alias mappings. + registered alias mappings. """ return BuildFileAliases( objects=self._exposed_object_by_alias.copy(), diff --git a/src/python/pants/build_graph/build_file_aliases.py b/src/python/pants/build_graph/build_file_aliases.py index c8fd9039557f..c8062fba5784 100644 --- a/src/python/pants/build_graph/build_file_aliases.py +++ b/src/python/pants/build_graph/build_file_aliases.py @@ -75,9 +75,7 @@ def __init__( objects: dict[str, Any] | None = None, context_aware_object_factories: dict[str, ContextAwareObjectFactory] | None = None, ) -> None: - """ - :API: public - """ + """:API: public.""" object.__setattr__(self, "_objects", self._validate_objects(objects)) object.__setattr__( self, @@ -87,16 +85,12 @@ def __init__( @property def objects(self) -> FrozenDict[str, Any]: - """ - :API: public - """ + """:API: public.""" return self._objects @property def context_aware_object_factories(self) -> FrozenDict[str, ContextAwareObjectFactory]: - """ - :API: public - """ + """:API: public.""" return self._context_aware_object_factories def merge(self, other: BuildFileAliases) -> BuildFileAliases: diff --git a/src/python/pants/core/goals/test.py b/src/python/pants/core/goals/test.py index d5091fe85fc7..0e4f580edd41 100644 --- a/src/python/pants/core/goals/test.py +++ b/src/python/pants/core/goals/test.py @@ -315,20 +315,12 @@ class TestFieldSet(FieldSet, metaclass=ABCMeta): class TestRequest: """Base class for plugin types wanting to be run as part of `test`. - Plugins should define a new type which subclasses this type, and set the - appropriate class variables. - E.g. - class DryCleaningRequest(TestRequest): - tool_subsystem = DryCleaningSubsystem - field_set_type = DryCleaningFieldSet - - Then register the rules which tell Pants about your plugin. - E.g. - def rules(): - return [ - *collect_rules(), - *DryCleaningRequest.rules(), - ] + Plugins should define a new type which subclasses this type, and set the appropriate class + variables. E.g. class DryCleaningRequest(TestRequest): tool_subsystem = + DryCleaningSubsystem field_set_type = DryCleaningFieldSet + + Then register the rules which tell Pants about your plugin. E.g. def rules(): return + [ *collect_rules(), *DryCleaningRequest.rules(), ] """ tool_subsystem: ClassVar[type[SkippableSubsystem]] @@ -434,7 +426,7 @@ def materialize(self, console: Console, workspace: Workspace) -> PurePath | None :param console: A handle to the terminal. :param workspace: A handle to local disk. :return: If a report was materialized to disk, the path of the file in the report one might - open first to start examining the report. + open first to start examining the report. """ ... diff --git a/src/python/pants/core/register.py b/src/python/pants/core/register.py index 0c0e19bde4ed..5185cb6d67a0 100644 --- a/src/python/pants/core/register.py +++ b/src/python/pants/core/register.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Core rules for Pants to operate correctly. These are always activated and cannot be disabled. diff --git a/src/python/pants/core/util_rules/adhoc_binaries.py b/src/python/pants/core/util_rules/adhoc_binaries.py index b0d3642e6141..4072b24d0cfc 100644 --- a/src/python/pants/core/util_rules/adhoc_binaries.py +++ b/src/python/pants/core/util_rules/adhoc_binaries.py @@ -25,7 +25,8 @@ class PythonBuildStandaloneBinary: """A Python interpreter for use by `@rule` code as an alternative to BashBinary scripts. - This interpreter is provided by Python Build Standalone https://gregoryszorc.com/docs/python-build-standalone/main/, + This interpreter is provided by Python Build Standalone + https://gregoryszorc.com/docs/python-build-standalone/main/, which has a few caveats. Namely it doesn't play nicely with third-party sdists. Meaning Pants' scripts being run by Python Build Standalone should avoid third-party sdists. """ diff --git a/src/python/pants/core/util_rules/environments.py b/src/python/pants/core/util_rules/environments.py index 796b2870a641..9a3d76f3f46a 100644 --- a/src/python/pants/core/util_rules/environments.py +++ b/src/python/pants/core/util_rules/environments.py @@ -489,8 +489,9 @@ def executable_search_path_cache_scope( session (i.e. Pants run), but we instead settle for every Pantsd lifetime to have more acceptable performance. - Meanwhile, when running with Docker, we already invalidate whenever the image changes - thanks to https://github.com/pantsbuild/pants/pull/17101. + Meanwhile, when running with Docker, we already invalidate whenever the image changes thanks + to + https://github.com/pantsbuild/pants/pull/17101. Remote execution often is safe to cache, but depends on the remote execution server. So, we rely on the user telling us what is safe. diff --git a/src/python/pants/core/util_rules/external_tool.py b/src/python/pants/core/util_rules/external_tool.py index 7e7e34acd8ee..2a99515a3647 100644 --- a/src/python/pants/core/util_rules/external_tool.py +++ b/src/python/pants/core/util_rules/external_tool.py @@ -204,8 +204,8 @@ def generate_exe(self, plat: Platform) -> str: If the downloaded artifact is the executable itself, you can leave this unimplemented. - If the downloaded artifact is an archive, this should be overridden to provide a - relative path in the downloaded archive, e.g. `./bin/protoc`. + If the downloaded artifact is an archive, this should be overridden to provide a relative + path in the downloaded archive, e.g. `./bin/protoc`. """ return f"./{self.generate_url(plat).rsplit('/', 1)[-1]}" @@ -354,11 +354,12 @@ class TemplatedExternalTool(ExternalTool, TemplatedExternalToolOptionsMixin): In addition to ExternalTool functionalities, it is needed to set, e.g.: - default_url_template = "https://tool.url/{version}/{platform}-mytool.zip" + default_url_template = " + https://tool.url/{version}/{platform}-mytool.zip" default_url_platform_mapping = { - "macos_x86_64": "osx_intel", - "macos_arm64": "osx_arm", - "linux_x86_64": "linux", + "macos_x86_64": "osx_intel", + "macos_arm64": "osx_arm", + "linux_x86_64": "linux", } The platform mapping dict is optional. diff --git a/src/python/pants/core/util_rules/lockfile_metadata.py b/src/python/pants/core/util_rules/lockfile_metadata.py index 1294b520e9f9..0276d4fd34dc 100644 --- a/src/python/pants/core/util_rules/lockfile_metadata.py +++ b/src/python/pants/core/util_rules/lockfile_metadata.py @@ -75,9 +75,9 @@ class NoLockfileMetadataBlock(InvalidLockfileError): class LockfileMetadata: """Base class for metadata that is attached to a given lockfile. - This class provides the external API for serializing, deserializing, and validating the - contents of individual lockfiles. New versions of metadata implement a concrete subclass and - provide deserialization and validation logic, along with specialist serialization logic. + This class provides the external API for serializing, deserializing, and validating the contents + of individual lockfiles. New versions of metadata implement a concrete subclass and provide + deserialization and validation logic, along with specialist serialization logic. To construct an instance of the most recent concrete subclass, call `LockfileMetadata.new()`. """ diff --git a/src/python/pants/core/util_rules/partitions.py b/src/python/pants/core/util_rules/partitions.py index b5c3ba0a7fa8..8a2426d2b7c3 100644 --- a/src/python/pants/core/util_rules/partitions.py +++ b/src/python/pants/core/util_rules/partitions.py @@ -1,6 +1,5 @@ # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Contains the "base" code for plugin APIs which require partitioning.""" from __future__ import annotations @@ -29,7 +28,7 @@ class PartitionerType(Enum): """The plugin author has a rule to go from `RequestType.PartitionRequest` -> `Partitions`.""" DEFAULT_SINGLE_PARTITION = "default_single_partition" - """Registers a partitioner which returns the inputs as a single partition + """Registers a partitioner which returns the inputs as a single partition. The returned partition will have no metadata. """ diff --git a/src/python/pants/core/util_rules/system_binaries.py b/src/python/pants/core/util_rules/system_binaries.py index 770ae1ab87c0..b0256dd7b9c2 100644 --- a/src/python/pants/core/util_rules/system_binaries.py +++ b/src/python/pants/core/util_rules/system_binaries.py @@ -188,8 +188,8 @@ def from_request( ) -> BinaryNotFoundError: """When no binary is found via `BinaryPaths`, and it is not recoverable. - :param rationale: A short description of why this binary is needed, e.g. - "download the tools Pants needs" or "run Python programs". + :param rationale: A short description of why this binary is needed, e.g. "download the tools + Pants needs" or "run Python programs". :param alternative_solution: A description of what else users can do to fix the issue, beyond installing the program. For example, "Alternatively, you can set the option `--python-bootstrap-search-path` to change the paths searched." diff --git a/src/python/pants/engine/download_file.py b/src/python/pants/engine/download_file.py index 5c707c47baf0..6a379cbc4a6d 100644 --- a/src/python/pants/engine/download_file.py +++ b/src/python/pants/engine/download_file.py @@ -50,7 +50,8 @@ def rules(): """ match_authority: ClassVar[Optional[str]] = None - """The authority to match (e.g. 'pantsbuild.org' or 's3.amazonaws.com') or `None` to match all authorities. + """The authority to match (e.g. 'pantsbuild.org' or 's3.amazonaws.com') or `None` to match all + authorities. The authority is matched using `fnmatch`, see https://docs.python.org/3/library/fnmatch.html for more information. diff --git a/src/python/pants/engine/goal.py b/src/python/pants/engine/goal.py index a8bd026ff481..e17b41b0a1ae 100644 --- a/src/python/pants/engine/goal.py +++ b/src/python/pants/engine/goal.py @@ -90,7 +90,6 @@ class EnvironmentBehavior(Enum): """ LOCAL_ONLY = 2 - f""" Indicates that the goal chooses the environments to use to execute rules within the goal. This requires migration work to be done by the goal author. See @@ -100,7 +99,6 @@ class EnvironmentBehavior(Enum): exit_code: int subsystem_cls: ClassVar[Type[GoalSubsystem]] - f"""Indicates that a Goal has been migrated to compute EnvironmentNames to build targets in. All goals in `pantsbuild/pants` should be migrated before the 2.15.x branch is cut, but end @@ -125,7 +123,8 @@ class Outputting: Allows output to go to a file or to stdout. - Useful for goals whose purpose is to emit output to the end user (as distinct from incidental logging to stderr). + Useful for goals whose purpose is to emit output to the end user (as distinct from incidental + logging to stderr). """ output_file = StrOption( diff --git a/src/python/pants/engine/internals/scheduler.py b/src/python/pants/engine/internals/scheduler.py index 8f3145ee8c30..394d7df20667 100644 --- a/src/python/pants/engine/internals/scheduler.py +++ b/src/python/pants/engine/internals/scheduler.py @@ -415,12 +415,13 @@ def execution_request( """Create and return an ExecutionRequest for the given (product, subject) pairs. :param requests: A sequence of product types to request for subjects. - :param poll: True to wait for _all_ of the given roots to - have changed since their last observed values in this SchedulerSession. + :param poll: True to wait for _all_ of the given roots to have changed since their last + observed values in this SchedulerSession. :param poll_delay: A delay (in seconds) to wait after observing a change, and before - beginning to compute a new value. + beginning to compute a new value. :param timeout: An optional timeout to wait for the request to complete (in seconds). If the - request has not completed before the timeout has elapsed, ExecutionTimeoutError is raised. + request has not completed before the timeout has elapsed, ExecutionTimeoutError is + raised. :returns: An ExecutionRequest for the given products and subjects. """ native_execution_request = PyExecutionRequest( diff --git a/src/python/pants/engine/internals/synthetic_targets.py b/src/python/pants/engine/internals/synthetic_targets.py index 0a773f33c587..40ceb53f809e 100644 --- a/src/python/pants/engine/internals/synthetic_targets.py +++ b/src/python/pants/engine/internals/synthetic_targets.py @@ -122,8 +122,7 @@ class SyntheticTargetsRequest: SINGLE_REQUEST_FOR_ALL_TARGETS: ClassVar[str] = "" path: str = REQUEST_TARGETS_PER_DIRECTORY - """ - The default field value is used to filter which paths to request targets for, and should be + """The default field value is used to filter which paths to request targets for, and should be declared as appropriate by union members subclassing `SyntheticTargetsRequest`. The SINGLE_REQUEST_FOR_ALL_TARGETS will make a single request for all targets at once, while REQUEST_TARGETS_PER_DIRECTORY will request all targets for a particular path at a time. Any diff --git a/src/python/pants/engine/rules.py b/src/python/pants/engine/rules.py index 41f951a7c856..8c1dc3105c59 100644 --- a/src/python/pants/engine/rules.py +++ b/src/python/pants/engine/rules.py @@ -92,9 +92,9 @@ def _make_rule( :param rule_type: The specific decorator used to declare the rule. :param return_type: The return/output type for the Rule. This must be a concrete Python type. :param parameter_types: A sequence of types that matches the number and order of arguments to - the decorated function. + the decorated function. :param cacheable: Whether the results of executing the Rule should be cached as keyed by all of - its inputs. + its inputs. """ is_goal_cls = issubclass(return_type, Goal) diff --git a/src/python/pants/engine/streaming_workunit_handler.py b/src/python/pants/engine/streaming_workunit_handler.py index 947f30fef2c8..fd166cdcd0a9 100644 --- a/src/python/pants/engine/streaming_workunit_handler.py +++ b/src/python/pants/engine/streaming_workunit_handler.py @@ -164,11 +164,11 @@ def __call__( finished: bool, context: StreamingWorkunitContext, ) -> None: - """ - :started_workunits: Workunits that have started but not completed. - :completed_workunits: Workunits that have completed. - :finished: True when the last chunk of workunit data is reported to the callback. - :context: A context providing access to functionality relevant to the run. + """:started_workunits: Workunits that have started but not completed. + + :completed_workunits: Workunits that have completed. :finished: True when the last chunk of + workunit data is reported to the callback. :context: A context providing access to + functionality relevant to the run. """ @property diff --git a/src/python/pants/engine/target.py b/src/python/pants/engine/target.py index c4de1b598f87..68f39bf49f29 100644 --- a/src/python/pants/engine/target.py +++ b/src/python/pants/engine/target.py @@ -790,12 +790,12 @@ class CoarsenedTarget(EngineAwareParameter): def __init__(self, members: Iterable[Target], dependencies: Iterable[CoarsenedTarget]) -> None: """A set of Targets which cyclicly reach one another, and are thus indivisible. - Instances of this class form a structure-shared DAG, and so a hashcode is pre-computed for the - recursive portion. + Instances of this class form a structure-shared DAG, and so a hashcode is pre-computed for + the recursive portion. :param members: The members of the cycle. - :param dependencies: The deduped direct (not transitive) dependencies of all Targets in - the cycle. Dependencies between members of the cycle are excluded. + :param dependencies: The deduped direct (not transitive) dependencies of all Targets in the + cycle. Dependencies between members of the cycle are excluded. """ self.members = FrozenOrderedSet(members) self.dependencies = FrozenOrderedSet(dependencies) diff --git a/src/python/pants/goal/run_tracker.py b/src/python/pants/goal/run_tracker.py index 002150d1eb22..a4c900c38326 100644 --- a/src/python/pants/goal/run_tracker.py +++ b/src/python/pants/goal/run_tracker.py @@ -55,9 +55,7 @@ class RunTracker: ) def __init__(self, args: tuple[str, ...], options: Options): - """ - :API: public - """ + """:API: public.""" self._has_started: bool = False self._has_ended: bool = False diff --git a/src/python/pants/jvm/compile_test.py b/src/python/pants/jvm/compile_test.py index 9645fe255b98..06c1add83aad 100644 --- a/src/python/pants/jvm/compile_test.py +++ b/src/python/pants/jvm/compile_test.py @@ -1,6 +1,5 @@ # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """Tests of multi-language JVM compilation. Tests of individual compilers should generally be written directly against the relevant `@rules`, diff --git a/src/python/pants/jvm/resolve/coursier_fetch.py b/src/python/pants/jvm/resolve/coursier_fetch.py index c37f96113c14..694b172c3529 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch.py +++ b/src/python/pants/jvm/resolve/coursier_fetch.py @@ -569,19 +569,18 @@ async def coursier_fetch_one_coord( ) -> ClasspathEntry: """Run `coursier fetch --intransitive` to fetch a single artifact. - This rule exists to permit efficient subsetting of a "global" classpath - in the form of a lockfile. Callers can determine what subset of dependencies - from the lockfile are needed for a given target, then request those - lockfile entries individually. - - By fetching only one entry at a time, we maximize our cache efficiency. If instead - we fetched the entire subset that the caller wanted, there would be a different cache - key for every possible subset. - - This rule also guarantees exact reproducibility. If all caches have been - removed, `coursier fetch` will re-download the artifact, and this rule will - confirm that what was downloaded matches exactly (by content digest) what - was specified in the lockfile (what Coursier originally downloaded). + This rule exists to permit efficient subsetting of a "global" classpath in the form of a + lockfile. Callers can determine what subset of dependencies from the lockfile are needed for a + given target, then request those lockfile entries individually. + + By fetching only one entry at a time, we maximize our cache efficiency. If instead we fetched + the entire subset that the caller wanted, there would be a different cache key for every + possible subset. + + This rule also guarantees exact reproducibility. If all caches have been removed, `coursier + fetch` will re-download the artifact, and this rule will confirm that what was downloaded + matches exactly (by content digest) what was specified in the lockfile (what Coursier originally + downloaded). """ # Prepare any URL- or JAR-specifying entries for use with Coursier @@ -724,12 +723,10 @@ class ToolClasspathRequest: """A request to set up the classpath for a JVM tool by fetching artifacts and merging the classpath. - :param prefix: if set, should be a relative directory that will - be prepended to every classpath element. This is useful for - keeping all classpath elements isolated under a single directory - in a process invocation, where other inputs on the process's - root directory might interfere with un-prefixed classpath - entries (or vice versa). + :param prefix: if set, should be a relative directory that will be prepended to every classpath + element. This is useful for keeping all classpath elements isolated under a single directory + in a process invocation, where other inputs on the process's root directory might interfere + with un-prefixed classpath entries (or vice versa). """ prefix: str | None = None diff --git a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py index 8167db559524..0f31353541f3 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py +++ b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py @@ -544,11 +544,12 @@ def test_fetch_one_coord_with_bad_length(rule_runner: RuleRunner) -> None: def test_fetch_one_coord_with_mismatched_coord(rule_runner: RuleRunner) -> None: """This test demonstrates that fetch_one_coord is picky about inexact coordinates. - Even though the expected jar was downloaded, the coordinate in the lockfile entry was inexact, meaning - it wasn't an exact string match for the coordinate fetched and reported by Coursier, which is exact. + Even though the expected jar was downloaded, the coordinate in the lockfile entry was inexact, + meaning it wasn't an exact string match for the coordinate fetched and reported by Coursier, + which is exact. - This shouldn't happen in practice, because these lockfile entries are ultimately derived from Coursier - reports which always give exact coordinate strings. + This shouldn't happen in practice, because these lockfile entries are ultimately derived from + Coursier reports which always give exact coordinate strings. """ expected_exception_msg = ( r'Coursier resolved coord.*?"org.hamcrest:hamcrest-core:1.3".*?' diff --git a/src/python/pants/jvm/resolve/lockfile_metadata.py b/src/python/pants/jvm/resolve/lockfile_metadata.py index 4e812f62ade8..57f6d70c65e8 100644 --- a/src/python/pants/jvm/resolve/lockfile_metadata.py +++ b/src/python/pants/jvm/resolve/lockfile_metadata.py @@ -66,8 +66,8 @@ class JVMLockfileMetadataV1(JVMLockfileMetadata): User validity is tested by the set of user requirements strings appearing as a subset of those in the metadata requirements. - Tool validity is tested by the set of user requirements strings being an exact match of those - in the metadata requirements. + Tool validity is tested by the set of user requirements strings being an exact match of those in + the metadata requirements. """ requirements: FrozenOrderedSet[str] diff --git a/src/python/pants/option/config.py b/src/python/pants/option/config.py index 180a2ca911a7..587b8216c244 100644 --- a/src/python/pants/option/config.py +++ b/src/python/pants/option/config.py @@ -286,19 +286,8 @@ class TomlSerializer: The constructor expects a dictionary of option scopes to their corresponding values as represented in Python. For example: - { - "GLOBAL": { - "o1": True, - "o2": "hello", - "o3": [0, 1, 2], - }, - "some-subsystem": { - "dict_option": { - "a": 0, - "b": 0, - }, - }, - } + { "GLOBAL": { "o1": True, "o2": "hello", "o3": [0, 1, 2], }, "some-subsystem": + { "dict_option": { "a": 0, "b": 0, }, }, } """ parsed: Mapping[str, dict[str, int | float | str | bool | list | dict]] diff --git a/src/python/pants/option/custom_types.py b/src/python/pants/option/custom_types.py index 3d92b692be39..bbc3d3666f9b 100644 --- a/src/python/pants/option/custom_types.py +++ b/src/python/pants/option/custom_types.py @@ -45,7 +45,8 @@ def target_option(s: str) -> str: :API: public - TODO(stuhood): Eagerly convert these to Addresses: see https://rbcommons.com/s/twitter/r/2937/ + TODO(stuhood): Eagerly convert these to Addresses: see + https://rbcommons.com/s/twitter/r/2937/ """ return s @@ -82,8 +83,8 @@ def file_option(s: str) -> str: def dict_with_files_option(s): """Same as 'dict', but fingerprints the file contents of any values which are file paths. - For any value which matches the path of a file on disk, the file path is not fingerprinted -- only - its contents. + For any value which matches the path of a file on disk, the file path is not fingerprinted -- + only its contents. :API: public """ @@ -207,8 +208,8 @@ class ListValueComponent: A component consists of values to append and values to filter while constructing the final list. Each component may either replace or modify the preceding component. So that, e.g., a config - file can append to and/or filter the default value list, instead of having to repeat most - of the contents of the default value list. + file can append to and/or filter the default value list, instead of having to repeat most of the + contents of the default value list. """ REPLACE = "REPLACE" @@ -281,10 +282,10 @@ def create(cls, value, member_type=str) -> ListValueComponent: Note that we accept tuple literals, but the internal value is always a list. - :param value: The value to convert. Can be an instance of ListValueComponent, a list, a tuple, - a string representation of a list or tuple (possibly prefixed by + or - - indicating modification instead of replacement), or any allowed member_type. - May also be a comma-separated sequence of modifications. + :param value: The value to convert. Can be an instance of ListValueComponent, a list, a + tuple, a string representation of a list or tuple (possibly prefixed by + or - + indicating modification instead of replacement), or any allowed member_type. May also be + a comma-separated sequence of modifications. """ if isinstance(value, cls): # Ensure idempotency. return value @@ -368,8 +369,8 @@ def __init__(self, action: str, val: dict) -> None: def create(cls, value) -> DictValueComponent: """Interpret value as either a dict or something to extend another dict with. - :param value: The value to convert. Can be an instance of DictValueComponent, a dict, - or a string representation (possibly prefixed by +) of a dict. + :param value: The value to convert. Can be an instance of DictValueComponent, a dict, or a + string representation (possibly prefixed by +) of a dict. """ if isinstance(value, bytes): value = value.decode() diff --git a/src/python/pants/option/option_types.py b/src/python/pants/option/option_types.py index 8e3413c88dea..86805f70c35d 100644 --- a/src/python/pants/option/option_types.py +++ b/src/python/pants/option/option_types.py @@ -219,8 +219,8 @@ class _ListOptionBase( Don't use this class directly, instead use one of the concrete classes below. - The default value will always be set as an empty list, and the Python property always returns - a tuple (for immutability). + The default value will always be set as an empty list, and the Python property always returns a + tuple (for immutability). """ option_type = list diff --git a/src/python/pants/option/option_value_container.py b/src/python/pants/option/option_value_container.py index b081897e6146..13d08c4fecc0 100644 --- a/src/python/pants/option/option_value_container.py +++ b/src/python/pants/option/option_value_container.py @@ -51,13 +51,13 @@ class OptionValueContainer: Implements "value ranking": - Attribute values can be ranked, so that a given attribute's value can only be changed if - the new value has at least as high a rank as the old value. This allows an option value in - an outer scope to override that option's value in an inner scope, when the outer scope's - value comes from a higher ranked source (e.g., the outer value comes from an env var and - the inner one from config). + Attribute values can be ranked, so that a given attribute's value can only be changed if the new + value has at least as high a rank as the old value. This allows an option value in an outer + scope to override that option's value in an inner scope, when the outer scope's value comes from + a higher ranked source (e.g., the outer value comes from an env var and the inner one from + config). - See ranked_value.py for more details. + See ranked_value.py for more details. """ _value_map: dict[Key, RankedValue] diff --git a/src/python/pants/option/options.py b/src/python/pants/option/options.py index db0af826f6d2..5f5c090790c2 100644 --- a/src/python/pants/option/options.py +++ b/src/python/pants/option/options.py @@ -281,11 +281,11 @@ def get_parser(self, scope: str) -> Parser: def _check_and_apply_deprecations(self, scope, values): """Checks whether a ScopeInfo has options specified in a deprecated scope. - There are two related cases here. Either: - 1) The ScopeInfo has an associated deprecated_scope that was replaced with a non-deprecated - scope, meaning that the options temporarily live in two locations. - 2) The entire ScopeInfo is deprecated (as in the case of deprecated SubsystemDependencies), - meaning that the options live in one location. + There are two related cases here. Either: 1) The ScopeInfo has an associated + deprecated_scope that was replaced with a non-deprecated scope, meaning that the + options temporarily live in two locations. 2) The entire ScopeInfo is deprecated (as in + the case of deprecated SubsystemDependencies), meaning that the options live in one + location. In the first case, this method has the sideeffect of merging options values from deprecated scopes into the given values. @@ -342,8 +342,7 @@ def _make_parse_args_request( def for_scope(self, scope: str, check_deprecations: bool = True) -> OptionValueContainer: """Return the option values for the given scope. - Values are attributes of the returned object, e.g., options.foo. - Computed lazily per scope. + Values are attributes of the returned object, e.g., options.foo. Computed lazily per scope. :API: public """ diff --git a/src/python/pants/option/options_bootstrapper.py b/src/python/pants/option/options_bootstrapper.py index 7c1fb66db6f8..26c7c2230be0 100644 --- a/src/python/pants/option/options_bootstrapper.py +++ b/src/python/pants/option/options_bootstrapper.py @@ -53,11 +53,11 @@ def get_config_file_paths(env, args) -> list[str]: """Get the location of the config files. The locations are specified by the --pants-config-files option. However we need to load the - config in order to process the options. This method special-cases --pants-config-files - in order to solve this chicken-and-egg problem. + config in order to process the options. This method special-cases --pants-config-files in + order to solve this chicken-and-egg problem. - Note that, obviously, it's not possible to set the location of config files in a config file. - Doing so will have no effect. + Note that, obviously, it's not possible to set the location of config files in a config + file. Doing so will have no effect. """ # This exactly mirrors the logic applied in Option to all regular options. Note that we'll # also parse --pants-config as a regular option later, but there's no harm in that. In fact, @@ -116,9 +116,9 @@ def create( :param env: An environment dictionary. :param args: An args array. :param allow_pantsrc: True to allow pantsrc files to be used. Unless tests are expecting to - consume pantsrc files, they should pass False in order to avoid reading files from - absolute paths. Production usecases should pass True to allow options values to make the - decision of whether to respect pantsrc files. + consume pantsrc files, they should pass False in order to avoid reading files from + absolute paths. Production usecases should pass True to allow options values to make the + decision of whether to respect pantsrc files. """ with warnings.catch_warnings(record=True): # We can't use pants.engine.fs.FileContent here because it would cause a circular dep. @@ -225,11 +225,11 @@ def env(self) -> dict[str, str]: def bootstrap_options(self) -> Options: """The post-bootstrap options, computed from the env, args, and fully discovered Config. - Re-computing options after Config has been fully expanded allows us to pick up bootstrap values - (such as backends) from a config override file, for example. + Re-computing options after Config has been fully expanded allows us to pick up bootstrap + values (such as backends) from a config override file, for example. - Because this can be computed from the in-memory representation of these values, it is not part - of the object's identity. + Because this can be computed from the in-memory representation of these values, it is not + part of the object's identity. """ return self.parse_bootstrap_options(self.env, self.bootstrap_args, self.config) @@ -272,8 +272,8 @@ def full_options_for_scopes( """Get the full Options instance bootstrapped by this object for the given known scopes. :param known_scope_infos: ScopeInfos for all scopes that may be encountered. - :returns: A bootstrapped Options instance that also carries options for all the supplied known - scopes. + :returns: A bootstrapped Options instance that also carries options for all the supplied + known scopes. """ return self._full_options( FrozenOrderedSet(sorted(known_scope_infos, key=lambda si: si.scope)), diff --git a/src/python/pants/option/options_test.py b/src/python/pants/option/options_test.py index 505c81a98d40..f9e490010bd8 100644 --- a/src/python/pants/option/options_test.py +++ b/src/python/pants/option/options_test.py @@ -230,7 +230,7 @@ def register(opts: Options) -> None: @contextmanager def no_exception(): - """use in tests as placeholder for a pytest.raises, when no exception is expected.""" + """Use in tests as placeholder for a pytest.raises, when no exception is expected.""" yield None diff --git a/src/python/pants/pantsd/service/pants_service.py b/src/python/pants/pantsd/service/pants_service.py index a895f6851a6a..3cc8436e1568 100644 --- a/src/python/pants/pantsd/service/pants_service.py +++ b/src/python/pants/pantsd/service/pants_service.py @@ -114,8 +114,8 @@ def _set_state(self, state, *valid_states): def await_paused(self, timeout=None): """Blocks until the service is in the Paused state, then returns True. - If a timeout is specified, the method may return False to indicate a timeout: with no timeout - it will always (eventually) return True. + If a timeout is specified, the method may return False to indicate a timeout: with no + timeout it will always (eventually) return True. Raises if the service is not currently in the Pausing state. """ diff --git a/src/python/pants/testutil/debug_adapter_util.py b/src/python/pants/testutil/debug_adapter_util.py index 2abd9c9883bd..1ca9fedcd524 100644 --- a/src/python/pants/testutil/debug_adapter_util.py +++ b/src/python/pants/testutil/debug_adapter_util.py @@ -9,8 +9,8 @@ def debugadapter_port_for_testing() -> int: Use this in Pants's (and plugins') own tests to avoid collisions. - Assumes that the env var TEST_EXECUTION_SLOT has been set. If not, all tests - will use the same port, and collisions may occur. + Assumes that the env var TEST_EXECUTION_SLOT has been set. If not, all tests will use the same + port, and collisions may occur. """ execution_slot = os.environ.get("TEST_EXECUTION_SLOT", "0") return 22000 + int(execution_slot) diff --git a/src/python/pants/util/contextutil.py b/src/python/pants/util/contextutil.py index bccbcfb09fe2..a7d3f43ce91d 100644 --- a/src/python/pants/util/contextutil.py +++ b/src/python/pants/util/contextutil.py @@ -27,9 +27,8 @@ class InvalidZipPath(ValueError): def environment_as(**kwargs: str | None) -> Iterator[None]: """Update the environment to the supplied values, for example: - with environment_as(PYTHONPATH='foo:bar:baz', - PYTHON='/usr/bin/python2.7'): - subprocess.Popen(foo).wait() + with environment_as(PYTHONPATH='foo:bar:baz', PYTHON='/usr/bin/python2.7'): + subprocess.Popen(foo).wait() """ new_environment = kwargs old_environment = {} @@ -191,12 +190,12 @@ def overwrite_file_content( ) -> Iterator[None]: """A helper that resets a file after the method runs. - It will read a file, save the content, maybe write temporary_content to it, yield, then - write the original content to the file. + It will read a file, save the content, maybe write temporary_content to it, yield, then write + the original content to the file. :param file_path: Absolute path to the file to be reset after the method runs. - :param temporary_content: Content to write to the file, or a function from current content - to new temporary content. + :param temporary_content: Content to write to the file, or a function from current content to + new temporary content. """ file_path = Path(file_path) original_content = file_path.read_bytes() diff --git a/src/python/pants/util/dirutil.py b/src/python/pants/util/dirutil.py index 9a1d6c2bd82d..966b557c056a 100644 --- a/src/python/pants/util/dirutil.py +++ b/src/python/pants/util/dirutil.py @@ -179,11 +179,9 @@ def read_file(filename: str, binary_mode: bool = False) -> bytes | str: def safe_walk(path: bytes | str, **kwargs: Any) -> Iterator[tuple[str, list[str], list[str]]]: """Just like os.walk, but ensures that the returned values are unicode objects. - This isn't strictly safe, in that it is possible that some paths - will not be decodeable, but that case is rare, and the only - alternative is to somehow avoid all interaction between paths and - unicode objects, which seems especially tough in the presence of - unicode_literals. See e.g. + This isn't strictly safe, in that it is possible that some paths will not be decodeable, but + that case is rare, and the only alternative is to somehow avoid all interaction between paths + and unicode objects, which seems especially tough in the presence of unicode_literals. See e.g. https://mail.python.org/pipermail/python-dev/2008-December/083856.html :API: public @@ -240,8 +238,7 @@ def register_rmtree(directory: str, cleaner: _MkdtempCleanerType = _mkdtemp_atex def safe_rmtree(directory: str | Path) -> None: """Delete a directory if it's present. If it's not present, no-op. - Note that if the directory argument is a symlink, only the symlink will - be deleted. + Note that if the directory argument is a symlink, only the symlink will be deleted. :API: public """ @@ -329,9 +326,9 @@ def absolute_symlink(source_path: str, target_path: str) -> None: """Create a symlink at target pointing to source using the absolute path. :param source_path: Absolute path to source file - :param target_path: Absolute path to intended symlink - :raises ValueError if source_path or link_path are not unique, absolute paths - :raises OSError on failure UNLESS file already exists or no such file/directory + :param target_path: Absolute path to intended symlink :raises ValueError if source_path or + link_path are not unique, absolute paths :raises OSError on failure UNLESS file already + exists or no such file/directory """ if not os.path.isabs(source_path): raise ValueError(f"Path for source : {source_path} must be absolute") @@ -357,9 +354,9 @@ def relative_symlink(source_path: str, link_path: str) -> None: """Create a symlink at link_path pointing to relative source. :param source_path: Absolute path to source file - :param link_path: Absolute path to intended symlink - :raises ValueError if source_path or link_path are not unique, absolute paths - :raises OSError on failure UNLESS file already exists or no such file/directory + :param link_path: Absolute path to intended symlink :raises ValueError if source_path or + link_path are not unique, absolute paths :raises OSError on failure UNLESS file already + exists or no such file/directory """ if not os.path.isabs(source_path): raise ValueError(f"Path for source:{source_path} must be absolute") @@ -388,9 +385,8 @@ def touch(path: str, times: int | tuple[int, int] | None = None): :API: public - :path: The file to touch. - :times Either a tuple of (atime, mtime) or else a single time to use for both. If not - specified both atime and mtime are updated to the current time. + :path: The file to touch. :times Either a tuple of (atime, mtime) or else a single time to use + for both. If not specified both atime and mtime are updated to the current time. """ if isinstance(times, tuple) and len(times) > 2: raise ValueError( diff --git a/src/python/pants/util/filtering.py b/src/python/pants/util/filtering.py index db9a1195a72b..e743ae4bbff9 100644 --- a/src/python/pants/util/filtering.py +++ b/src/python/pants/util/filtering.py @@ -27,18 +27,15 @@ def identity_func(x): def create_filter(predicate_param: str, predicate_factory: Callable[[str], Filter]) -> Filter: """Create a filter function from a string parameter. - :param predicate_param: Create a filter for this param string. Each string is a - comma-separated list of arguments to the predicate_factory. - If the entire comma-separated list is prefixed by a '-' then the - sense of the resulting filter is inverted. + :param predicate_param: Create a filter for this param string. Each string is a comma-separated + list of arguments to the predicate_factory. If the entire comma-separated list is prefixed + by a '-' then the sense of the resulting filter is inverted. :param predicate_factory: A function that takes a parameter and returns a predicate, i.e., a - function that takes a single parameter (of whatever type the filter - operates on) and returns a boolean. + function that takes a single parameter (of whatever type the filter operates on) and returns + a boolean. :return: A filter function of one argument that is the logical OR of the predicates for each of - the comma-separated arguments. If the comma-separated list was prefixed by a '-', - the sense of the filter is inverted. - - :API: public + the comma-separated arguments. If the comma-separated list was prefixed by a '-', the sense + of the filter is inverted. :API: public """ modifier, param = _extract_modifier(predicate_param) predicates = [predicate_factory(p) for p in param.split(",")] diff --git a/src/python/pants/util/ordered_set.py b/src/python/pants/util/ordered_set.py index 3166bb3d274a..eb10568eeac4 100644 --- a/src/python/pants/util/ordered_set.py +++ b/src/python/pants/util/ordered_set.py @@ -1,6 +1,5 @@ # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). - """An OrderedSet is a set that remembers its insertion order, and a FrozenOrderedSet is one that is also immutable. @@ -163,8 +162,8 @@ def update(self, iterable: Iterable[T]) -> None: def discard(self, key: T) -> None: """Remove an element. Do not raise an exception if absent. - The MutableSet mixin uses this to implement the .remove() method, which - *does* raise an error when asked to remove a non-existent item. + The MutableSet mixin uses this to implement the .remove() method, which *does* raise an + error when asked to remove a non-existent item. """ self._items.pop(key, None) diff --git a/src/python/pants/util/osutil.py b/src/python/pants/util/osutil.py index 22328e547e0c..2daf410d620c 100644 --- a/src/python/pants/util/osutil.py +++ b/src/python/pants/util/osutil.py @@ -44,34 +44,26 @@ def _compute_cpu_count() -> int: def get_arch_name(uname_result: posix.uname_result | None = None) -> str: - """ - :API: public - """ + """:API: public.""" if uname_result is None: uname_result = os.uname() return uname_result.machine.lower() def get_os_name(uname_result: posix.uname_result | None = None) -> str: - """ - :API: public - """ + """:API: public.""" if uname_result is None: uname_result = os.uname() return uname_result.sysname.lower() def normalize_arch_name(arch_name: str) -> str: - """ - :API: public - """ + """:API: public.""" return _normalize(arch_name, ARCH_ALIASES, "architecture") def normalize_os_name(os_name: str) -> str: - """ - :API: public - """ + """:API: public.""" return _normalize(os_name, OS_ALIASES, "operating system") diff --git a/src/python/pants/util/strutil.py b/src/python/pants/util/strutil.py index 6d19d5c0ba02..119e8c51cae0 100644 --- a/src/python/pants/util/strutil.py +++ b/src/python/pants/util/strutil.py @@ -147,9 +147,9 @@ class Simplifier: # it's only rarely useful to show a chroot path to a user, hence they're stripped by default strip_chroot_path: bool = True - """remove all instances of the chroot tmpdir path""" + """Remove all instances of the chroot tmpdir path.""" strip_formatting: bool = False - """remove ANSI formatting commands (colors, bold, etc)""" + """Remove ANSI formatting commands (colors, bold, etc)""" def simplify(self, v: bytes | str) -> str: chroot = ( diff --git a/src/python/pants_release/copy_to_s3.py b/src/python/pants_release/copy_to_s3.py index 142cb89d06dc..29af5c5d1bff 100755 --- a/src/python/pants_release/copy_to_s3.py +++ b/src/python/pants_release/copy_to_s3.py @@ -76,15 +76,16 @@ def perform_copy( ) -> None: """Recursively copy the files at src_prefix/src_path to S3. + :param src_prefix: A relpath under the cwd. :param dst_prefix: An S3 URL prefix, of the form + s3://bucket/path_prefix. :param src_prefix: A relpath under the cwd. :param dst_prefix: An S3 URL prefix, of the form s3://bucket/path_prefix. - :param path: The relpath under the src_prefix to copy. - src_prefix/path will be (recursively) copied to dst_prefix/path. - If empty, the entire src_prefix will be copied. + :param path: The relpath under the src_prefix to copy. src_prefix/path will be (recursively) + copied to dst_prefix/path. If empty, the entire src_prefix will be copied. :param region: The AWS region to access (should be the one the bucket is in). :param acl: An optional ACL to set on the copied objects. - :param aws_cli_symlink_path: If specified, symlink the aws cli into this dir. Otherwise, - it will be synlinked into the system standard Path. + :param aws_cli_symlink_path: If specified, symlink the aws cli into this dir. Otherwise, it will + be synlinked into the system standard Path. """ if shutil.which("aws") is None: _install_aws_cli(symlink_path=aws_cli_symlink_path) diff --git a/src/python/pants_release/generate_github_workflows.py b/src/python/pants_release/generate_github_workflows.py index 83c32f0aa66a..2f36bbeb7799 100644 --- a/src/python/pants_release/generate_github_workflows.py +++ b/src/python/pants_release/generate_github_workflows.py @@ -1309,39 +1309,25 @@ class Repo: """ python_version: str = "3.10" - """ - The Python version to install system-wide for user code to use. - """ + """The Python version to install system-wide for user code to use.""" env: dict[str, str] = field(default_factory=dict) - """ - Any extra environment variables to provide to all pants steps - """ + """Any extra environment variables to provide to all pants steps.""" install_go: bool = False - """ - Whether to install Go system-wide - """ + """Whether to install Go system-wide.""" install_thrift: bool = False - """ - Whether to install Thrift system-wide - """ + """Whether to install Thrift system-wide.""" node_version: None | str = None - """ - Whether to install Node/NPM system-wide, and which version if so - """ + """Whether to install Node/NPM system-wide, and which version if so.""" checkout_options: dict[str, Any] = field(default_factory=dict) - """ - Any additional options to provide to actions/checkout - """ + """Any additional options to provide to actions/checkout.""" setup_commands: str = "" - """ - Any additional set-up commands to run before pants (e.g. `sudo apt install ...`) - """ + """Any additional set-up commands to run before pants (e.g. `sudo apt install ...`)""" goals: Sequence[str] = tuple(DefaultGoals) """ diff --git a/tests/python/pants_test/init/test_extension_loader.py b/tests/python/pants_test/init/test_extension_loader.py index 658719f0aac0..d6c8841349c4 100644 --- a/tests/python/pants_test/init/test_extension_loader.py +++ b/tests/python/pants_test/init/test_extension_loader.py @@ -179,11 +179,11 @@ def get_mock_plugin( ): """Make a fake Distribution (optionally with entry points) - Note the entry points do not actually point to code in the returned distribution -- - the distribution does not even have a location and does not contain any code, just metadata. + Note the entry points do not actually point to code in the returned distribution -- the + distribution does not even have a location and does not contain any code, just metadata. - A module is synthesized on the fly and installed into sys.modules under a random name. - If optional entry point callables are provided, those are added as methods to the module and + A module is synthesized on the fly and installed into sys.modules under a random name. If + optional entry point callables are provided, those are added as methods to the module and their name (foo/bar/baz in fake module) is added as the requested entry point to the mocked metadata added to the returned dist. diff --git a/tests/python/pants_test/pantsd/pantsd_integration_test.py b/tests/python/pants_test/pantsd/pantsd_integration_test.py index ba69ad555f18..f8e1bce8923d 100644 --- a/tests/python/pants_test/pantsd/pantsd_integration_test.py +++ b/tests/python/pants_test/pantsd/pantsd_integration_test.py @@ -524,7 +524,8 @@ def _assert_pantsd_keyboardinterrupt_signal( :param signum: The signal to send. :param regexps: Assert that all of these regexps match somewhere in stderr. :param not_regexps: Assert that all of these regexps do not match somewhere in stderr. - :param cleanup_wait_time: passed throught to waiter, dictated how long simulated cleanup will take + :param cleanup_wait_time: passed throught to waiter, dictated how long simulated cleanup + will take """ with self.pantsd_test_context() as (workdir, config, checker): client_handle, waiter_pid, child_pid, _ = launch_waiter( @@ -680,9 +681,11 @@ def test_unhandled_exceptions_only_log_exceptions_once(self): """Tests that the unhandled exceptions triggered by LocalPantsRunner instances don't manifest as a PantsRunFinishedWithFailureException. - That is, that we unset the global Exiter override set by LocalPantsRunner before we try to log the exception. + That is, that we unset the global Exiter override set by LocalPantsRunner before we try to + log the exception. - This is a regression test for the most glaring case of https://github.com/pantsbuild/pants/issues/7597. + This is a regression test for the most glaring case of + https://github.com/pantsbuild/pants/issues/7597. """ with self.pantsd_run_context(success=False) as ctx, temporary_dir(".") as directory: Path(directory, "BUILD").write_text(