Skip to content

Add basic Pixi config in pyproject.toml and developer instructions#3842

Open
backmari wants to merge 3 commits intomainfrom
backmari_pixi_dev_env
Open

Add basic Pixi config in pyproject.toml and developer instructions#3842
backmari wants to merge 3 commits intomainfrom
backmari_pixi_dev_env

Conversation

@backmari
Copy link
Contributor

@backmari backmari commented Jan 20, 2026

Description

Adds a basic Pixi configuration to the pyproject.toml and instructions for setting up your developer environment using Pixi. The reason for adding Pixi as an option is that many institutions are moving from conda to Pixi due to conda licensing changes.

This is related to #3690, but does not resolve the issue. There is more work to do to e.g. move the CI to use Pixi, but that may require some discussion.

TODO (in a separate PR?): Figure out how to build the docs using a Pixi task and have the docs changes reflected in the GUI.

How Has This Been Tested?

I tested that I can create the developer environment, run the GUI, and run the unit tests:

pixi shell
sasview
pixi run test

I have only tested on Linux.

Review Checklist:

[if using the editor, use [x] in place of [ ] to check a box]

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

@backmari backmari requested a review from rozyczko January 20, 2026 19:42
Copy link
Contributor

@llimeht llimeht left a comment

Choose a reason for hiding this comment

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

There are a few conceptual things that need to be figured out collectively - particularly around pinning of dependencies. cf. https://github.com/orgs/SasView/discussions/3831

pyproject.toml Outdated
sasmodels = { path = "../sasmodels", editable = true }

[tool.pixi.tasks]
test = { description = "Run the test suite", cmd = "pytest -s test" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Sometimes safer to run python -m pytest to ensure it picks up the right python from the environment.

The test dependencies should be tied to the test task/environment - we have carefully split the dependencies into different requirements-*.txt files based on how they are needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will look into whether there is a way to create different Pixi environments from different requirements-*.txt files. I haven't used this pattern with Pixi before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding different environments for different tasks, it seems like the best I can do is select which features to include with the editable install:

[tool.pixi.pypi-dependencies]
sasview = { path = ".", editable = true, extras = ["dev", "test"] }
sasdata   = { path = "../sasdata", editable = true, extras = ["test"] }
sasmodels = { path = "../sasmodels", editable = true, extras = ["dev", "test", "docs"] }

By default, Pixi includes all optional dependencies.

If the optional dependencies were part of the project optional-dependencies (rather than hatchling's optional dependencies), then I could create different environments from different features:

[project]
name = "my_project"
dependencies = ["package1"]

[project.optional-dependencies]
test = ["pytest"]
all = ["package2","my_project[test]"]

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"] # if executed on linux

[tool.pixi.environments]
default = {features = [], solve-group = "default"}
test = {features = ["test"], solve-group = "default"}
all = {features = ["all"], solve-group = "default"}

When I try to use [tool.pixi.environments] like this, then I get this error:

Error:   × The feature 'test' is not defined in the manifest

My feeling is that if we wanted to move to Pixi as the package manager, we would need to move the dependencies from requirements.txt files into pyproject.toml.
For now, I think we need to either include all optional dependencies or a fixed subset of features.

@krzywon
Copy link
Contributor

krzywon commented Jan 23, 2026

As a reminder from our meeting, the developer environment setup is available at https://github.com/SasView/sasview/wiki/DevNotes_DevEnvironmentInstall

@krzywon krzywon requested a review from llimeht February 10, 2026 14:54
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