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

feat: add --clean-env flag to tasks and run command #1395

Merged
merged 23 commits into from
Jun 11, 2024

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented May 15, 2024

Fixes #289 slightly

Adds:

pixi run --clean-env xxx
[tasks]
isolated-task = {cmd = "/usr/bin/env", clean-env = true}

This doesn't work on Windows, as it is just to shitty to get working on windows.
You need to many variables and paths for a working environment for the label "clean" as you need the Program Files directories for the compilers. And other stuff.

And I'm honestly a 120% Done with this PR. And it's breaking into actually being productive.

@ruben-arts ruben-arts marked this pull request as draft May 15, 2024 13:47
@wolfv
Copy link
Member

wolfv commented May 16, 2024

Maybe we should call it "clean-env", or "pristine" instead of isolated, so that we don't confuse the user in case we implement stronger isolation features (aka sandboxing)

@ruben-arts
Copy link
Contributor Author

For some reason pristine sounds really funny to me. I'm fine with changing it. Some other options I could think of:

  • minimal-env
  • stripped-env
  • empty-env
  • all of the above without -env

pixi.toml Outdated Show resolved Hide resolved
@@ -118,6 +118,7 @@ impl<'p> TaskGraph<'p> {
project: &'p Project,
search_envs: &SearchEnvironments<'p, D>,
args: Vec<String>,
isolated: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in terms of responsibility its a bit strange that the task graph needs to be aware of isolation. Cant we default it to false for the custom task?

@tdejager
Copy link
Contributor

For some reason pristine sounds really funny to me. I'm fine with changing it. Some other options I could think of:

* `minimal-env`

* `stripped-env`

* `empty-env`

* all of the above without `-env`

clean-env could be another option? Otherwise I like stripped-env because it's explicit in what is done.

@wolfv
Copy link
Member

wolfv commented May 22, 2024

I think I like clean-env or bare-env. It's pretty explicit about what it does.

@ruben-arts ruben-arts changed the title feat: add isolate flag to tasks and run command feat: add --clean-env flag to tasks and run command May 24, 2024
@ruben-arts ruben-arts marked this pull request as ready for review May 24, 2024 12:17
@ruben-arts ruben-arts marked this pull request as draft May 27, 2024 08:51
@ruben-arts ruben-arts marked this pull request as ready for review June 10, 2024 06:42
@baszalmstra baszalmstra merged commit 530aafc into prefix-dev:main Jun 11, 2024
28 checks passed
jjjermiah pushed a commit to jjjermiah/pixi that referenced this pull request Jun 11, 2024
Fixes prefix-dev#289 slightly

Adds:
```
pixi run --clean-env xxx
```

```toml
[tasks]
isolated-task = {cmd = "/usr/bin/env", clean-env = true}
```

This doesn't work on Windows, as it is just to shitty to get working on
windows.
You need to many variables and paths for a working environment for the
label "clean" as you need the `Program Files` directories for the
compilers. And other stuff.

And I'm honestly a 120% Done with this PR. And it's breaking into
actually being productive.
@matthewfeickert
Copy link
Contributor

Having this additional environment isolation is super nice so thank you very much for adding it into release v0.24.0+! ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support pure/isolated environments
5 participants