Skip to content

Pixi is cool, apptainer is cool, let's make them both work together !

License

Notifications You must be signed in to change notification settings

RaphaelRibes/pixitainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixitainer

Version Pixi Badge License Forge banner This banner placeholder was generated by Gemini 3 Banana Pro using already made asset like the pixi, apptainer and singularity logo

Why ...

pixi ?

Pixi is a fast, easy and fun to use tool that allows you to manage multiple dependencies in multiple environment very easily. It has a great support either by its developers or community on discord.

using containers ?

Singularity/Apptainer is very used in bioinformatics, it's at the hearth of analyzes pipelines, but it's a headache to put in place. In another hand, pixi is fast, easy to use, but it's not a container and so harder to keep intact for a long period of time. The idea behind pixitainer is to put a pixi environment into an Apptainer container, so you can freeze your fast pace working environment into a container easily !

Apptainer ?

Apptainer is more the "public library" version of the software, while Singularity is more like a "corporate bookstore." Because Apptainer is hosted by the Linux Foundation, it is designed specifically for the scientific community to ensure that your research code remains free, accessible and without being tied to a private company’s profit goals.

How ?

The best thing to do will be to add this way as a pixi extension, so we just have to type pixi containerize, some option and tada !

TODO:

  • Receipe that works.
  • Pixi package that I can add as an extension.
  • Adding options to the extension.
    • Build options
      • Output image path (-o, --output)
      • Working directory (-p, --path)
      • Enable seamless execution (-s, --seamless)
      • Specific environment selection (-e, --env)
      • Verbose mode (-v, --verbose)
      • Quiet mode (-q, --quiet)
      • Specify base image (--base-image)
      • Specify pixi version (--pixi-version)
      • Add extra files/folders (--add-file)
      • Export the .def file (--keep-def)
      • No installation of environment in the container (--no-install)
  • Support of container solutions
    • Apptainer
    • Singularity
    • Docker

    Note that by default pixitainer is made with Apptainer in mind so it will be an option to install other container solutions.

  • Testings.
  • Publish
  • Go back to step 3 until WW3, messiah or death of the internet

How to install

  1. Install pixi
curl -fsSL https://pixi.sh/install.sh | sh

User

Install pixitainer globaly on pixi:

pixi global install -c https://prefix.dev/raphaelribes -c https://prefix.dev/conda-forge pixitainer

Developer

  1. Clone this repo
git clone https://github.com/RaphaelRibes/pixitainer.git
cd pixitainer
  1. Build the pixitainer extension
pixi run build_all
  1. Install the pixitainer extension
pixi global install pixitainer --channel $(pwd -P)/output --channel conda-forge

How to use

You actually have two ways of using pixitainer:

  1. Manually
  2. Seamlessly

We put ourselves in an environment with one task defined like

[tasks]
make_dir = 'mkdir testdir'

Manually

You can also build the container manually with apptainer

pixi containerize

Then you can use pixi in your image

apptainer run -f pixitainer.sif pixi run --as-is -m /opt/conf/pixi.toml make_dir

We add --as-is to make sure it sticks to the pixi.lock file and it only uses the installed binaries and doesn't try to install others.

WARNING: -m /opt/conf/pixi.toml is mandatory or pixi will use the default one in your current working directory.

Seamlessly

Just use the pixitainer extension command after installing it with the seamless option (-s, --seamless).

pixi containerize -s

You can then turn your task like pixi is not even here

apptainer run -f pixitainer.sif make_dir

WARNING: the seamless mode makes that every commands run through the image are ran like so

pixi run --as-is -m /opt/conf/pixi.toml "$@"

Meaning that you only have access to pixi run and nothing else.

Known problems

Pathing is... strange?

When launching a command in the pixi shell, the cwd of tasks will be changed into the one of the pixi workplace (PIXI_PROJECT_ROOT).

Let's create a task

[tasks]
make_dir = 'mkdir testdir'

If you run this task, it's going to create $PIXI_PROJECT_ROOT/testdir (/opt/conf/testdir) and not $INIT_CWD/testdir ($(pwd)/testdir). What you want is to run pixi in the INIT_CWD so take the time to change your ./something to $INIT_CWD/something.

Read-only file system (os error 30)

This is related to the previous problem: pixi is using PIXI_PROJECT_ROOT as the cwd. It's going to try to write in /opt/conf wich is not allowed because the sif image is in read only. To fix it, replace your mkdir test byt mkdir $INIT_CWD/test.

However, sometimes pixi may write something in its cache so don't hesitate to use --writable-tmpfs.

About

Pixi is cool, apptainer is cool, let's make them both work together !

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages