Skip to content

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

Merged
baszalmstra merged 23 commits into
prefix-dev:mainfrom
ruben-arts:feature/isolate_environment
Jun 11, 2024
Merged

baszalmstra merged 23 commits into
prefix-dev:mainfrom
ruben-arts:feature/isolate_environment

Conversation

@ruben-arts

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

Copy link
Copy Markdown
Contributor

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

wolfv commented May 16, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
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

Comment thread pixi.toml Resolved
Comment thread src/task/task_graph.rs Outdated
project: &'p Project,
search_envs: &SearchEnvironments<'p, D>,
args: Vec<String>,
isolated: bool,

Copy link
Copy Markdown
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
Copy Markdown
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

wolfv commented May 22, 2024

Copy link
Copy Markdown
Member

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
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
Copy Markdown
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