mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Discover workspaces without using them in resolution (#3585)
Add minimal support for workspace discovery, only used for determining paths in the bluejay commands. We can now discover the workspace structure, namely that the `pyproject.toml` of a package belongs to a workspace `pyproject.toml` with members and exclusion. The globbing logic is inspired by cargo. We don't resolve `workspace = true` metadata declarations yet.
This commit is contained in:
parent
5205165d42
commit
2ffd453003
43 changed files with 1007 additions and 151 deletions
|
@ -0,0 +1,11 @@
|
|||
from albatross import fly
|
||||
|
||||
try:
|
||||
from bird_feeder import use
|
||||
|
||||
raise RuntimeError("bird-feeder installed")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
||||
fly()
|
||||
print("Success")
|
|
@ -0,0 +1,10 @@
|
|||
from bird_feeder import use
|
||||
|
||||
try:
|
||||
from albatross import fly
|
||||
|
||||
raise RuntimeError("albatross installed")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
||||
print("Success")
|
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "bird-feeder"
|
||||
version = "1.0.0"
|
||||
dependencies = ["anyio>=4.3.0,<5"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import anyio
|
||||
|
||||
|
||||
def use():
|
||||
print("squirrel")
|
8
scripts/workspaces/albatross-in-example/pyproject.toml
Normal file
8
scripts/workspaces/albatross-in-example/pyproject.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "albatross"
|
||||
version = "0.1.0"
|
||||
dependencies = ["tqdm>=4,<5"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,9 @@
|
|||
import tqdm
|
||||
|
||||
|
||||
def fly():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Caw")
|
|
@ -0,0 +1,4 @@
|
|||
from albatross import fly
|
||||
|
||||
fly()
|
||||
print("Success")
|
8
scripts/workspaces/albatross-just-project/pyproject.toml
Normal file
8
scripts/workspaces/albatross-just-project/pyproject.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "albatross"
|
||||
version = "0.1.0"
|
||||
dependencies = ["tqdm>=4,<5"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,2 @@
|
|||
def fly():
|
||||
pass
|
|
@ -0,0 +1,10 @@
|
|||
from bird_feeder import use
|
||||
|
||||
try:
|
||||
from albatross import fly
|
||||
|
||||
raise RuntimeError("albatross installed")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
||||
print("Success")
|
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "bird-feeder"
|
||||
version = "1.0.0"
|
||||
dependencies = ["anyio>=4.3.0,<5"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import anyio
|
||||
|
||||
|
||||
def use():
|
||||
print("squirrel")
|
|
@ -0,0 +1,12 @@
|
|||
[project]
|
||||
name = "albatross"
|
||||
version = "0.1.0"
|
||||
dependencies = ["tqdm>=4,<5"]
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = ["packages/*"]
|
||||
exclude = ["excluded/*"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import tqdm
|
||||
from bird_feeder import use
|
||||
|
||||
print("Caw")
|
||||
use()
|
|
@ -0,0 +1,4 @@
|
|||
from albatross import fly
|
||||
|
||||
fly()
|
||||
print("Success")
|
|
@ -0,0 +1,10 @@
|
|||
from bird_feeder import use
|
||||
|
||||
try:
|
||||
from albatross import fly
|
||||
|
||||
raise RuntimeError("albatross installed")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
||||
print("Success")
|
|
@ -0,0 +1,11 @@
|
|||
[project]
|
||||
name = "bird-feeder"
|
||||
version = "1.0.0"
|
||||
dependencies = ["anyio>=4.3.0,<5", "seeds"]
|
||||
|
||||
[tool.uv.sources]
|
||||
seeds = { workspace = true }
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import anyio
|
||||
|
||||
|
||||
def use():
|
||||
print("squirrel")
|
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "seeds"
|
||||
version = "1.0.0"
|
||||
dependencies = ["boltons==24.0.0"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import boltons
|
||||
|
||||
|
||||
def seeds():
|
||||
print("sunflower")
|
14
scripts/workspaces/albatross-root-workspace/pyproject.toml
Normal file
14
scripts/workspaces/albatross-root-workspace/pyproject.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[project]
|
||||
name = "albatross"
|
||||
version = "0.1.0"
|
||||
dependencies = ["bird-feeder", "tqdm>=4,<5"]
|
||||
|
||||
[tool.uv.sources]
|
||||
bird-feeder = { workspace = true }
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = ["packages/*"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,11 @@
|
|||
import tqdm
|
||||
from bird_feeder import use
|
||||
|
||||
|
||||
def fly():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Caw")
|
||||
use()
|
|
@ -0,0 +1,4 @@
|
|||
from albatross import fly
|
||||
|
||||
fly()
|
||||
print("Success")
|
|
@ -0,0 +1,11 @@
|
|||
[project]
|
||||
name = "albatross"
|
||||
version = "0.1.0"
|
||||
dependencies = ["bird-feeder", "tqdm>=4,<5"]
|
||||
|
||||
[tool.uv.sources]
|
||||
bird-feeder = { workspace = true }
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,11 @@
|
|||
import tqdm
|
||||
from bird_feeder import use
|
||||
|
||||
|
||||
def fly():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Caw")
|
||||
use()
|
|
@ -0,0 +1,10 @@
|
|||
from bird_feeder import use
|
||||
|
||||
try:
|
||||
from albatross import fly
|
||||
|
||||
raise RuntimeError("albatross installed")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
||||
print("Success")
|
|
@ -0,0 +1,11 @@
|
|||
[project]
|
||||
name = "bird-feeder"
|
||||
version = "1.0.0"
|
||||
dependencies = ["anyio>=4.3.0,<5", "seeds"]
|
||||
|
||||
[tool.uv.sources]
|
||||
seeds = { workspace = true }
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import anyio
|
||||
|
||||
|
||||
def use():
|
||||
print("squirrel")
|
|
@ -0,0 +1,8 @@
|
|||
[project]
|
||||
name = "seeds"
|
||||
version = "1.0.0"
|
||||
dependencies = ["boltons==24.0.0"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
|
@ -0,0 +1,5 @@
|
|||
import boltons
|
||||
|
||||
|
||||
def seeds():
|
||||
print("sunflower")
|
|
@ -0,0 +1,2 @@
|
|||
[tool.uv.workspace]
|
||||
members = ["packages/*"]
|
Loading…
Add table
Add a link
Reference in a new issue