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

Trying out Pixi for image building #77

Merged
merged 3 commits into from
Aug 13, 2024
Merged

Trying out Pixi for image building #77

merged 3 commits into from
Aug 13, 2024

Conversation

abkfenris
Copy link
Collaborator

@abkfenris abkfenris commented Jul 31, 2024

I'm trying out using Pixi for managing our Conda and Pypi environment in place of Mamba.

pixi-kernel replaces nb-conda-kernels to allow us to support per-project environments.

I'm using features to capture each tutorial, then adding the tutorial feature to the default environment. The [dependencies] table captures our base dependencies, though we might want to refactor them out into features as well ('jupyterlab support', 'cli', 'storage', 'fast xarray',...).

You can test the lab locally with either pixi run lab or docker compose up py.

There is one little oddity I know of right now in the pixi workflow. If you create a new directory ((like a project), pixi init, then following pixi commands don't target that manifest as normal.

$ pixi init
Initialized project in /home/jovyan/test/.
$ pixi add fastapi
 WARN Using manifest /home/jovyan/pixi.toml from `PIXI_PROJECT_MANIFEST` rather than local /home/jovyan/test/pixi.toml

This is because the image has already set a pixi shell (well pixi shell-hook) to force pixi to look for a specific manifest and recorded that in an environment variable. Pixi will warn that it's using a different manifest, but its easy to screw that up.

Running pixi shell --manifest-path ./pixi.toml will set the pixi scope to the current environment.

$ pixi shell --manifest-path ./pixi.toml
 . "/tmp/pixi_env_WOz.sh"
jovyan@e5cb7d16120a:~/test$  . "/tmp/pixi_env_WOz.sh"
(test) jovyan@e5cb7d16120a:~/test$ pixi add fastapi

I'm trying out using Pixi for managing our Conda and Pypi environment in place of Mamba.

pixi-kernel replaces nb-conda-kernels to allow us to support per-project environments. 

I'm using features to capture each tutorial, then adding the tutorial feature to the default environment. The `[dependencies]` table captures our base dependencies, though we might want to refactor them out into features as well ('jupyterlab support', 'cli', 'storage', 'fast xarray',...).

You can test the lab locally with either `pixi run lab` or `docker compose up py`. 

There is one little oddity I know of right now in the pixi workflow. If you create a new directory ((like a project), `pixi init`, then following pixi commands don't target that manifest as normal. 

```
$ pixi init
Initialized project in /home/jovyan/test/.
$ pixi add fastapi
 WARN Using manifest /home/jovyan/pixi.toml from `PIXI_PROJECT_MANIFEST` rather than local /home/jovyan/test/pixi.toml
```

This is because the image has already set a `pixi shell` (well `pixi shell-hook`) to force pixi to look for a specific manifest and recorded that in an environment variable. Pixi will warn that it's using a different manifest, but its easy to screw that up.

Running `pixi shell --manifest-path ./pixi.toml` will set the pixi scope to the current environment.

```
$ pixi shell --manifest-path ./pixi.toml
 . "/tmp/pixi_env_WOz.sh"
jovyan@e5cb7d16120a:~/test$  . "/tmp/pixi_env_WOz.sh"
(test) jovyan@e5cb7d16120a:~/test$ pixi add fastapi
```
@abkfenris
Copy link
Collaborator Author

We might need/want to create our 'base' pixi environment in a different directory, so it doesn't get smushed by Jupyterhub mapping the user folder in place of /home/jovyan.

@abkfenris abkfenris requested a review from ocefpaf July 31, 2024 10:50
@abkfenris
Copy link
Collaborator Author

Added some packages to speed up Xarray based on pydata/xarray#9149

@abkfenris abkfenris marked this pull request as ready for review August 13, 2024 17:56
@abkfenris
Copy link
Collaborator Author

abkfenris commented Aug 13, 2024

Landing this, then making PR for Callum's dependencies and sending to 2i2c so we can test it

@abkfenris abkfenris merged commit df34d4d into main Aug 13, 2024
4 checks passed
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.

1 participant