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: pixi global reinstall flag #2274

Closed

Conversation

nichmor
Copy link
Contributor

@nichmor nichmor commented Oct 14, 2024

No description provided.

Hofer-Julian and others added 30 commits August 19, 2024 09:26
This adds functionality and tests to parse the `pixi-global.toml` as
described in the
[proposal](https://pixi.sh/dev/design_proposals/pixi_global_manifest/)
Main features:
- minimal implementation of `pixi global sync`
- it creates environments if they are on the manifest but not on the
systsem
- it deletes environments if they are not in the manifest
- It adds binaries that are exposed in the manifest
- It removes binares that are not exposed in the manifest
- it doesn´t check yet whether environments already exist to avoid
double work
- it doesn´t import from existing environments on the system yet

Side features:
- Add `sort_channels_by_priority` function
- Heavily refactor structs in `common.rs`
- Add many tests

How to test:

Create `~/.pixi/manifests/pixi-global.toml` with:

```toml
# The name of the environment is `python`
[envs.python]
channels = ["conda-forge"]
# optional, defaults to your current OS
# platform = "osx-64"
# It will expose python, python3 and python3.11, but not pip
[envs.python.dependencies]
python = "3.11.*"
pip = "*"

[envs.python.exposed]
python = "python"
python3 = "python3"
"python3.11" = "python3.11"

# The name of the environment is `python3-10`
[envs.python3-10]
channels = ["https://fast.prefix.dev/conda-forge"]
# It will expose python3.10
[envs.python3-10.dependencies]
python = "3.10.*"

[envs.python3-10.exposed]
"python3.10" = "python"
```

---------

Co-authored-by: nichmor <[email protected]>
As soon as we implement it, this marker should throw an error
It now informs you if `pixi global sync` did nothing
Some missing things:

- [x] : public doc strings
- [x] : tests
- [x] : better errors
- [x] : running pixi global sync at the end

it is also should be merged after
prefix-dev#1975 lands first

---------

Co-authored-by: Hofer-Julian <[email protected]>
Co-authored-by: Julian Hofer <[email protected]>
Cleaning up the creation of the manifest from existing environments.
Improving error.
…2140)

This is going to help to get the meta data easier in more scenarios

---------

Co-authored-by: Hofer-Julian <[email protected]>
Co-authored-by: Julian Hofer <[email protected]>
ruben-arts and others added 29 commits October 3, 2024 19:15
- Use long form CLI commands. They are preferable in scripts and docs.
- Require parameter `packages`
- Use `HasSpecs` trait
- Fail if environment doesn't exist
- Use `environment_prefix` in more places
- Take ownership of `env_name` in `environment_prefix`
- Use stderr for messages as described in https://clig.dev/#the-basics
- Adapt mapping docs
- Dropped `global` namespace in integration test naming for consistency
- Extended integration tests
It used to accept not giving any positional parameters
Now the migration script will result in:

```toml
[envs.package2]
channels = ["file:///C:/Users/Ruben/development/pixi/tests/integration/test_data/global_update_channel_1/output"]
dependencies = { package2 = "*" }
exposed = { package2 = "package2" }

[envs.pixi-pack]
channels = ["conda-forge"]
dependencies = { pixi-pack= "*" }
exposed = { pixi-pack= "pixi-pack" }
```` 
Instead of 
```toml
[envs.package2]
channels = ["file:///C:/Users/Ruben/development/pixi/tests/integration/test_data/global_update_channel_1/output"]
dependencies = { package2 = "*" }
exposed = { package2 = "package2" }

[envs.pixi-pack]
channels = ["https://conda.anaconda.orge/conda-forge/"]
dependencies = { pixi-pack= "*" }
exposed = { pixi-pack= "pixi-pack" }
````

This PR also fixes the migration from multi channel environments, as it
was not checking all channels used in the initial install.

Before:
```toml
[envs.lsd]
channels = ["https://prefix.dev/rust-forge"]
dependencies = { lsd = "*" }
exposed = { lsd = "lsd" }
```

after this PR:
```toml
[envs.lsd]
channels = [
    "https://prefix.dev/rust-forge",
    "conda-forge",
]
dependencies = { lsd = "*" }
exposed = { lsd = "lsd" }
```

---------

Co-authored-by: Julian Hofer <[email protected]>
…nc (prefix-dev#2246)

This fixes the situation where we removed environments that were removed
from the manifest on `pixi global uninstall` but it should only
uninstall the requested environments.
Adds a subcommand to pixi global:
```
pixi global edit
```

This will open the manifest file in the editor defined in `EDITOR` path
variable or defaults to `nano` or `notepad` depending on the machine.

This code is stolen from `pixi config edit`

---------

Co-authored-by: Julian Hofer <[email protected]>
…fix-dev#2169)

Not proud of this but it's a start. I rather spend more time on
improving the code then documenting my way around it.

---------

Co-authored-by: Julian Hofer <[email protected]>
Co-authored-by: Hofer-Julian <[email protected]>
Users will get an error message when they attempt to use `pixi global
upgrade` or `pixi global upgrade-all`

---------

Co-authored-by: Ruben Arts <[email protected]>
Normalize input in `EnvironmentName::from_str`
Only error on non-unique exposed names when the already existing exposed
name is in a different environment
)

Fixes on windows:
```
pixi global edit code
```


Aligns `edit` cli:
```
pixi config edit -g code
```
Extend them and make them more consistent
@nichmor nichmor closed this Oct 14, 2024
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.

3 participants