Skip to content
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

Don't require a local_environment target for each platform #16983

Merged

Conversation

Eric-Arellano
Copy link
Contributor

We now are using subsystems as the default value of env vars & executable search paths. That is, local_environment targets are solely needed if you want to override those option values.

We want it to be ergonomic to add a local_environment target to handle one specific platform, e.g. macOS ARM often being problematic, without you needing to also add boilerplate for the other platforms. There was no good reason we were erroring for other platforms, given the new subsystem approach.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@Eric-Arellano Eric-Arellano added the category:internal CI, fixes for not-yet-released features, etc. label Sep 23, 2022
@Eric-Arellano
Copy link
Contributor Author

@stuhood follow up from our discussion yesterday about fallback_environment. This solely impacts when the value __local__ is used. If you want to fallback to a named environment, then you will need to create that target for those platforms.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I'm lightly negative on this.

While:

  1. a special case for "no environments are defined"
  2. using the global/option values when an environment doesn't override a field

...definitely make sense, it doesn't seem worthwhile from a consistency perspective to allow environments to be partially defined. Maybe your thinking is that it might be hard to define environments which cover all possibilities, and so the more specific (in terms of matching: centos5, etc) you need to be for some local environments, the more likely you are to have ambiguity?

Copy link
Contributor

@chrisjrn chrisjrn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a generally good idea, and I don't have any comments on the implementation.

The use case that @Eric-Arellano highlights — needing to make a very small number of overall changes to support different Mac OS architectures — is something that I'd use immediately if we introduced it into Pants mainline and would simplify my dev environment, but I don't think we want to get to the point where we're introducing well-defined environments for every other platform we support in Pants. I think adopting environments in their entirety would be overkill for most users in this situation. We should let users adopt incrementally here.

The subsystem redesign allows users to adopt as much or as little of the target environments support as they need, and I don't think there's a good reason to arbitrarily stop people from using just a tiny bit of the functionality.

@Eric-Arellano
Copy link
Contributor Author

The subsystem redesign allows users to adopt as much or as little of the target environments support as they need, and I don't think there's a good reason to arbitrarily stop people from using just a tiny bit of the functionality.

it doesn't seem worthwhile from a consistency perspective

Agreed with Chris. "Consistency" here feels like "consistency for the sake of consistency", rather than optimizing for the very common and real case of: your options work for all your developers well, minus M1 devs. I don't think there's a very compelling reason to make handling that more complex than necessary; there's no technical/implementation motivation, it's actually easier to remove this restriction.

@Eric-Arellano
Copy link
Contributor Author

Eric-Arellano commented Sep 26, 2022

I'm lightly negative on this.

@stuhood sounds like the concern is "light". Chris and I both feel strongly this is a good idea - is it okay to merge?

@stuhood
Copy link
Member

stuhood commented Sep 26, 2022

Yea, fine with me.

@Eric-Arellano Eric-Arellano merged commit 9a6dc00 into pantsbuild:main Sep 26, 2022
@Eric-Arellano Eric-Arellano deleted the local-env-fallback-to-options branch September 26, 2022 19:08
Eric-Arellano added a commit that referenced this pull request Sep 28, 2022
There's no need for us to set up local environments, now that local environments are only to _override_ values from the subsystems. (Before, we were going to deprecate the subsystems.)

We may in the future want to add a macos_arm64 environment. That is safe for us to do without adding other local environments thanks to #16983.

See #17043 for an alternative way we could be leveraging environments locally.

[ci skip-rust]
Eric-Arellano added a commit that referenced this pull request Oct 10, 2022
… at all (#17135)

It's now possible to use environments generally, but for the current env target to be set to None, thanks to #16983.

This was resulting in faulty logic that we were treating the `--remote-execution` flag as a global switch for remoting, when really if environment targets are used at all, then we should only use remoting when a `remote_environment` target is active.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants