Skip to content

Instantly share code, notes, and snippets.

@patrickhulce
Created February 10, 2025 15:52
Show Gist options
  • Save patrickhulce/0a49d297390af85091d481bc784870c9 to your computer and use it in GitHub Desktop.
Save patrickhulce/0a49d297390af85091d481bc784870c9 to your computer and use it in GitHub Desktop.
Create a uv workspace for bug reproduction.
#!/bin/bash
set -euxo pipefail
cd "$(mktemp -d)"
uv init
sed -i '' '/dependencies =/d' pyproject.toml
sed -i '' '/version =/d' pyproject.toml
echo "version = \"0.0.0.dev0\"" > __version__.py
mkdir example
touch example/__init__.py
cat >> pyproject.toml <<EOF
dynamic = ["version"]
dependencies = [
"example-common",
]
[tool.uv.sources]
example-common = { workspace = true }
[tool.uv.workspace]
members = ["packages/*"]
[tool.hatch.version]
path = "__version__.py"
fallback-version = "0.0.0.dev0"
[tool.hatch.build]
packages = ["example"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
EOF
mkdir -p packages/common/example_common
touch packages/common/example_common/__init__.py
cd packages/common
cat > pyproject.toml <<EOF
[project]
name = "example-common"
dynamic = ["version"]
dependencies = [
"numpy"
]
[tool.hatch.version]
path = "../../__version__.py"
fallback-version = "0.0.0.dev0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
EOF
cd ../../
uv sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment