Skip to content

Commit 89e4241

Browse files
authored
Remove MultiGet from the codebase (pantsbuild#23057)
Removes the migration goal. Anyone migrating needs to be on 2.31 or earlier. Removes the migration guide, and switches references to it to point to the version in the 2.30 docs in perpetuity. Also gets rid of the "await in loop" custom flake8 check, as it doesn't work with call-by-name, and getting it to would be complex and not worth the effort. This may have been some worthwhile nannying in the early days of the engine but does not seem important now. A followup will remove remaining traces of `Get`. A further followup after that may remove engine code that is no longer needed.
1 parent 78e2689 commit 89e4241

File tree

18 files changed

+51
-1470
lines changed

18 files changed

+51
-1470
lines changed

build-support/flake8/.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ extend-ignore:
2424
[flake8:local-plugins]
2525
extension =
2626
PNT20 = dedent_use_checker:check_for_dedent_imports
27-
PNT30 = await_in_loop:check_for_await_in_loop

build-support/flake8/await_in_loop.py

Lines changed: 0 additions & 139 deletions
This file was deleted.

docs/docs/writing-plugins/common-plugin-tasks/plugin-upgrade-guide.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ How to adjust for changes made to the Plugin API.
99

1010
## 2.30
1111

12-
`Get` and `MultiGet` have been deprecated in favor of calling rules by name. See the [migration guide](../the-rules-api/migrating-gets.mdx) for how to update your plugins to use this idiom.
12+
`Get` and `MultiGet` have been deprecated in favor of calling rules by name. See the [migration guide](https://www.pantsbuild.org/2.30/docs/writing-plugins/the-rules-api/migrating-gets) for how to update your plugins to use this idiom.
1313

1414
## 2.23
1515

docs/docs/writing-plugins/the-rules-api/index.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ Adding logic to your plugin.
1717
- [Union rules (advanced)](./union-rules-advanced.mdx)
1818
- [Logging and dynamic output](./logging-and-dynamic-output.mdx)
1919
- [Testing rules](./testing-plugins.mdx)
20-
- [Tips and debugging](./tips-and-debugging.mdx)
21-
- [Migrating from call-by-type](./migrating-gets.mdx)
20+
- [Tips and debugging](./tips-and-debugging.mdx)

docs/docs/writing-plugins/the-rules-api/migrating-gets.mdx

Lines changed: 0 additions & 81 deletions
This file was deleted.

docs/notes/2.32.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ Thank you to [Klaviyo](https://www.klaviyo.com/) for their Platinum tier support
1212

1313
### Highlights
1414

15+
Support for the deprecated `Get()`/`MultiGet()` in the plugin API has been removed.
16+
1517
### Deprecations
1618

19+
The plugin API's `Get()` and `MultiGet()` constructs, deprecated in 2.30, are now unsupported. If your plugin still relies on them you must [migrate](https://www.pantsbuild.org/2.30/docs/writing-plugins/the-rules-api/migrating-gets) before upgrading to this version.
20+
1721
### General
1822

1923
### Goals

src/python/pants/engine/internals/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ class _DependencyMapping:
804804
async def transitive_dependency_mapping(request: _DependencyMappingRequest) -> _DependencyMapping:
805805
"""This uses iteration, rather than recursion, so that we can tolerate dependency cycles.
806806
807-
Unlike a traditional BFS algorithm, we batch each round of traversals via `MultiGet` for
807+
Unlike a traditional BFS algorithm, we batch each round of traversals via `concurrently` for
808808
improved performance / concurrency.
809809
"""
810810
roots_as_targets = await resolve_unexpanded_targets(Addresses(request.tt_request.roots))

src/python/pants/engine/internals/rule_visitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
AwaitableConstraints,
2525
Effect,
2626
GetParseError,
27-
MultiGet,
27+
concurrently,
2828
)
2929
from pants.util.docutil import doc_url
3030
from pants.util.memo import memoized
@@ -427,7 +427,7 @@ def visit_Assign(self, assign_node: ast.Assign) -> None:
427427
continue
428428
if isinstance(node, ast.Call):
429429
f = self._lookup(node.func)
430-
if f is MultiGet:
430+
if f is concurrently:
431431
value = tuple(get.output_type for get in collected_awaitables)
432432
elif f is not None:
433433
value = _lookup_return_type(f)

src/python/pants/engine/internals/rule_visitor_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from pants.base.exceptions import RuleTypeError
1717
from pants.engine.internals.rule_visitor import collect_awaitables
18-
from pants.engine.internals.selectors import Get, GetParseError, MultiGet
18+
from pants.engine.internals.selectors import Get, GetParseError, concurrently
1919
from pants.engine.rules import implicitly, rule
2020
from pants.util.strutil import softwrap
2121

@@ -129,15 +129,15 @@ async def rule():
129129
@pytest.mark.call_by_type
130130
def test_multiget_homogeneous() -> None:
131131
async def rule():
132-
await MultiGet(Get(STR, INT(x)) for x in range(5))
132+
await concurrently(Get(STR, INT(x)) for x in range(5))
133133

134134
assert_awaitables(rule, [(str, int)])
135135

136136

137137
@pytest.mark.call_by_type
138138
def test_multiget_heterogeneous() -> None:
139139
async def rule():
140-
await MultiGet(Get(STR, INT, 42), Get(INT, STR("bob")))
140+
await concurrently(Get(STR, INT, 42), Get(INT, STR("bob")))
141141

142142
assert_awaitables(rule, [(str, int), (int, str)])
143143

@@ -392,7 +392,7 @@ async def rule(request: Request):
392392
s = request.arg2
393393
Get(bool, s)
394394
# 3, 4
395-
a, b = await MultiGet(
395+
a, b = await concurrently(
396396
Get(list, str),
397397
Get(tuple, str),
398398
)
@@ -403,7 +403,7 @@ async def rule(request: Request):
403403
# 7 -- this is huge!
404404
c = Request.create_get()
405405
# 8 -- the `c` is already accounted for, make sure it's not duplicated.
406-
await MultiGet([c, Get(str, dict)])
406+
await concurrently([c, Get(str, dict)])
407407
# 9
408408
Get(float, request._helped())
409409

0 commit comments

Comments
 (0)