-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Workspace support #3404
Comments
In our monorepo at work we have a fairly flexible layout, with more nesting / categorisation of projects. The rules we have for package discovery is that a) name in pyproject.toml must match folder name (limiting how much we have to read pyproject.toml files to do anything), b) a package cannot have another package inside it (limiting how much directory walking we need to do). |
cc @potiuk regarding if this would work in Airflow |
Generally yes. There are of course some details - particularly about optionality of those providers.
a) power user (or CI) needs to install "albatross" package and all "providers" together and be able to hack on them together. b) provider contributor (or CI) should be able to install one (or few, or all) of the "providers" separately in editable mode - but wiith the "albatross" package installed from PyPi, or URL rather than from sources. this should allow for example to run the tests for main version of "provider_a" against past released version of "albatross" (or specifig tag / branch of "albatross") c) albatross contributor should be able to install in editable mode just "albatross" and do not care about all other "providers"
I guess that will make things quite a bit difficult - because that means that when you do smth like thatin proivder_a:
It should import foo from provider b.
|
Add workspace support when using `-r <path>/pyproject.toml` or `-e <path>` in the pip interface. It is limited to all-editable static-metadata workspaces, and tests only include a single main workspace, ignoring path dependencies in another workspace. This can be considered the MVP for workspace support: You can create a workspace, you can install from it, but some options and conveniences are still missing. I'll file follow-up tickets (support in lockfiles, support path deps in other workspace, #3625) There is also support in `uv run`, but we need #3700 first to properly support using different current projects in the bluejay interface, currently the resolution and therefore the lockfile depends on the current project. I'd do this change first (it's big enough already), then #3700, and then add workspace support properly to bluejay. Fixes #3404
Workspaces are a feature aimed at supporting multiple packages in the same repository. It makes large projects easier to manage by splitting them into smaller packages with independent dependencies. They handle editable installs and publishing automatically.
They are a commonly supported feature in other ecosystems, see the Review of large projects on github and Review of packaging tools. Our implementation will be modeled after cargo and rye.
Usage
There a two main usage patterns: A root package and helpers, and the flat workspace.
Root package and helpers:
Flat workspace
Structure
A workspace consists of a workspace root and members in the workspace.
The workspace root is a directory with a
pyproject.toml
, all members need to be below that directory. The workspace root defines members and exclusions. All packages below it must either be a member or excluded. The workspace root can be a package itself or it is a virtual manifest.Each member is a directory with a
pyproject.toml
that contains a[project]
section. Each member is a python package, with a name, a version and dependencies. Workspace members can depend on other workspace members. You can consider the workspace another package source or index, similar to--find-links
.Workspace discovery
Currently in the
uv pip
interface, you have to explicitly provide the input files to use for dependencies. In the post-pip interface, uv will be based around workspaces with packages. For that, we need to find the relevantpyproject.toml
files.pyproject.toml
. This is the current package.pyproject.toml
contains atool.uv.workspace
section, it’s also the workspace root.pyproject.toml
tool.uv.workspace
section:members
, it’s the workspace root.excludes
, the package pyproject.toml is implicitly the workspace root, don’t go any further up.pyproject.toml
is implicitly the workspace root (like cargo)tool.uv.workspace
, ignore, our package in the data or test files of some other package.members
and collect all other workspace member packagespyproject.toml
Features beyond MVP
cargo run -p
.The text was updated successfully, but these errors were encountered: