-
-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select environment in package
goal
#17220
Select environment in package
goal
#17220
Conversation
# Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
@stuhood Plenty more to come, it just appears as though this is the only goal that has a trivial migration of the form recommended in |
package
goal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, there are a whole bunch of other places that need this if you rg 'Get\(BuiltPackage,
src/python/pants/backend/shell/shell_command.py
src/python/pants/backend/python/util_rules/local_dists.py
src/python/pants/backend/python/goals/run_pex_binary.py
src/python/pants/backend/go/goals/run_binary.py
src/python/pants/backend/python/packaging/pyoxidizer/rules.py
src/python/pants/backend/docker/goals/run_image.py
src/python/pants/backend/docker/util_rules/docker_build_context.py
src/python/pants/jvm/run_deploy_jar.py
src/python/pants/core/target_types.py
src/python/pants/core/goals/package.py
src/python/pants/core/goals/publish.py
src/python/pants/core/goals/test.py
I'm not sure why the test.py
one isn't erroring:
pants/src/python/pants/core/goals/test.py
Lines 748 to 762 in 20ac158
@rule(desc="Build runtime package dependencies for tests", level=LogLevel.DEBUG) | |
async def build_runtime_package_dependencies( | |
request: BuildPackageDependenciesRequest, | |
) -> BuiltPackageDependencies: | |
unparsed_addresses = request.field.to_unparsed_address_inputs() | |
if not unparsed_addresses: | |
return BuiltPackageDependencies() | |
tgts = await Get(Targets, UnparsedAddressInputs, unparsed_addresses) | |
field_sets_per_tgt = await Get( | |
FieldSetsPerTarget, FieldSetsPerTargetRequest(PackageFieldSet, tgts) | |
) | |
packages = await MultiGet( | |
Get(BuiltPackage, PackageFieldSet, field_set) for field_set in field_sets_per_tgt.field_sets | |
) | |
return BuiltPackageDependencies(packages) |
@stuhood I guess it's inheriting the environment from the calling test
rules? Which is wrong, we might need to enter a new subgraph.
@Eric-Arellano AIUI, the point of the changes is to make it so that the rules can make use of environments, but it's not until an I believe in all of the implementation-specific cases above (i.e. I suspect you're right about the case about |
Yeah, it's an error to inherit the environment for every instance returned by ripgrep. For example, with This PR isn't wrong, it's only incomplete. And I now realize the deprecation Stu came up with is a good start, but not sufficient to tackle the problem. It would be best if this PR updated all call sites of @stuhood thoughts on how we could ban ever using |
When it happens at the top-level in a
I took the first approach in #17106 because there are fewer callers than there are callees: I think that that is still the right approach. We could probably add an optional facility to |
Would involve adjusting the definition of pants/src/python/pants/engine/internals/scheduler.py Lines 652 to 664 in 20ac158
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent of the rest of the ease of use changes, this change is correct I think.
There are no PackageFieldSet
s that have an environment field yet though, so it's a bit of a noop.
Yeah, I think that would be useful. I like the modeling of the |
@stuhood I'm moving on with the local-only changes, I can take on the new feature for union once I'm done there. Is there anything that needs to go in a ticket other than what you've described above? |
No... honestly, it might be like a 5 line change, heh. The hardest part will be choosing a name. |
Choosing the name, and dealing with all of the errors that fall out of the rule graph? |
Adds support for extracting
environment
names frompackage
goal targets.#17129.