uv workspace reorganization#50
Conversation
|
Also we should probably rename the repo? This will need to be done in a coordinated way to not break brainslosher-instrument deployment |
hannalee2
left a comment
There was a problem hiding this comment.
I love the code separation in mixology for common fluidic control code.
After digging a little bit into uv workspaces, it seems that using brainslosher, brainwasher, and seqflow as workspace members is not suitable. We can simply use mixology as a common source code library via path dependencies.
The uv documentation says: "Workspaces are not suited for cases in which members have conflicting requirements, or desire a separate virtual environment for each member. In this case, path dependencies are often preferable."
A workspace creates one giant virtual environment (.venv) at the root of the repo. This would cause brainslosher to install brainwasher's Raspberry Pi hardware libraries, which could lead to crashes. Also, if brainwasher and brainslosher have different dependencies (such as one needing pydantic v2.11 and the other needing v2.0), resolving these conflicting requirements will not work. This becomes especially problematic as we expand to include more instruments.
We keep the instant code-sharing of mixology. If you update mixology's code, brainslosher and brainwasher will instantly see the changes.
Each instrument should get its own isolated .venv an uv.lock files.
I approve since we can change only few lines in pyproject.toml to use path.
| "pydantic-settings>=2.12.0", | ||
| "email-validator>=2.3.0", | ||
| "pandas>=2.0.3", | ||
| "pyharp>=0.1.0", |
There was a problem hiding this comment.
If a piece of hardware is only ever going to be used by one instrument, I think its driver does not belong in mixology.
For example, if brainwasher uses a very specific Raspberry Pi that brainslosher and seqflow will never use, it would be better to remove those dependencies from mixology and put them directly into brainwasher's pyproject.toml
| pythonpath = ["src", "tests"] | ||
|
|
||
| [tool.uv.sources] | ||
| mixology = { workspace = true } |
There was a problem hiding this comment.
Rather than using workspace, we can define as a path. mixlology = { path = "...."}
| pythonpath = ["src", "tests"] | ||
|
|
||
| [tool.uv.sources] | ||
| mixology = { workspace = true } |
There was a problem hiding this comment.
Rather than using workspace, we can define as a path. mixlology = { path = "...."}
| brainwasher = "brainwasher.scripts.main:main" | ||
| brainslosher = "brainwasher.scripts.brainslosher_main:main" | ||
| [tool.uv.workspace] | ||
| members = ["instruments/*"] |
There was a problem hiding this comment.
After digging some uv workspace usage, maybe we should not use the workspace for sperate instruments.
|
@hannalee2 okay sounds good! I will try and make changes later this week |
| "vicivalve>=0.0.13", | ||
| "rpi-hardware-pwm>=0.3.1", | ||
| "SM16inpind>=1.0.1", | ||
| "SM8mosind>=1.0.1", | ||
| "SM16univin>=1.0.3", | ||
| "smbus2>=0.5.0", | ||
| ] |
There was a problem hiding this comment.
I think optional dependacies woud be better :)
Example)
[project.optional-dependencies]
custom_something = ["vicivalve", "sambus2"... ]
I will add barseq specific drivers under optional dependacies. :)
* Monorepo workspaces -> path dependencies for Mixology * Decouple hardware dependencies from mixology core
Updates
Fixed Issues
Merge Checklist