Add basic Pixi config in pyproject.toml and developer instructions#3842
Add basic Pixi config in pyproject.toml and developer instructions#3842
pyproject.toml and developer instructions#3842Conversation
llimeht
left a comment
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
As a reminder from our meeting, the developer environment setup is available at https://github.com/SasView/sasview/wiki/DevNotes_DevEnvironmentInstall |
Description
Adds a basic Pixi configuration to the
pyproject.tomland 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:
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)
Installers
Licensing (untick if necessary)