Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carderne committed Aug 27, 2024
1 parent 0be5a52 commit 228820f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align="center">
<img src="https://raw.githubusercontent.com/carderne/una/main/docs/assets/logo.svg" alt="Una logo" width="100" role="img">
<p>Easy monorepos with Python</p>
<p>Easy monorepos with Python and uv</p>
</div>

----
Expand All @@ -20,11 +20,17 @@

</div>

Una is a tool to make Python monorepos with [uv](https://docs.astral.sh/uv/) easier.
It is a CLI tool and a build plugin that does the following things:
Una is a tool to build and productionise Python monorepos with [uv](https://docs.astral.sh/uv/).

1. Enable builds of individual apps or projects within a monorepo.
2. Ensure that internal and external dependencies are correctly specified.
uv has [Workspaces](https://docs.astral.sh/uv/concepts/workspaces/), but no ability to _build_ them.
This means if you have dependencies between packages in your workspace, there's no good way to distribute or productionise the end result.

Una solves this.
No additional configuration is needed: if you have a functional uv Workspace, just add Una.
It consists of the following two things:

1. A CLI to ensure that all imports are correctly specified as dependencies.
2. A build plugin that enables production builds of individual apps within a monorepo by injecting local dependencies and transitive third-party dependencies.

Una doesn't try to replicate a full build system such as [Bazel](https://bazel.build/) or
[Pants](https://www.pantsbuild.org/).
Expand All @@ -33,7 +39,7 @@ It just makes it possible to have a simple monorepo with interdependencies.
Una works much like a Rust workspace, with each package having its own pyproject.toml.
In general, packages should either be libraries (imported but not run) or apps (run but never imported), but Una will not enforce this.

It only works with [uv](https://docs.astral.sh/uv/) and with the [Hatch](https://hatch.pypa.io) build backend.
It only works with the [Hatch](https://hatch.pypa.io) build backend.

## Examples
You can see an example repo here:
Expand Down Expand Up @@ -79,7 +85,7 @@ printer --> greeter --> cowsay-python
You can do this by running the following:
```bash
# this checks all imports and ensures they are added to
# [tool.una.deps] in the appropriate pyproject.toml
# project.dependencies and tool.uv.sources in the each pyproject.toml
uv run una sync
```

Expand All @@ -89,12 +95,12 @@ tail apps/printer/pyproject.toml
```

It added `greeter` as an internal dependency to `printer`.
It didn't add `cowsay-python`, as external dependencies are only resolved at build-time (keep reading).
It didn't add `cowsay-python`, as transitive external dependencies are only resolved at build-time.

Now you can build your app:
```bash
uvx --from build pyproject-build --installer=uv --outdir=dist apps/printer
# this will inject the cowsay-python externel dependency
# this will inject the cowsay-python external dependency
```

And see the result:
Expand Down
24 changes: 17 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align="center">
<img src="assets/logo.svg" width="100">
<p>Easy monorepos with Python</p>
<p>Easy monorepos with Python and uv</p>
</div>

----
Expand All @@ -20,16 +20,26 @@

</div>

Una is a tool to make Python monorepos easier. It is a CLI tool and a build plugin that does the following things:
Una is a tool to build and productionise Python monorepos with [uv](https://docs.astral.sh/uv/).

1. Enable builds of individual apps or projects within a monorepo.
2. Ensure that internal and external dependencies are correctly specified.
uv has [Workspaces](https://docs.astral.sh/uv/concepts/workspaces/), but no ability to _build_ them.
This means if you have dependencies between packages in your workspace, there's no good way to distribute or productionise the end result.

Una doesn't try to replicate a full build system such as [Bazel](https://bazel.build/) or [Pants](https://www.pantsbuild.org/). It just makes it possible to have a simple monorepo with interdependencies.
Una solves this.
No additional configuration is needed: if you have a functional uv Workspace, just add Una.
It consists of the following two things:

Una works much like a Rust workspace, with each package having its own pyproject.toml. In general, packages should either be libraries (imported but not run) or apps (run but never imported), but Una will not enforce this.
1. A CLI to ensure that all imports are correctly specified as dependencies.
2. A build plugin that enables production builds of individual apps within a monorepo by injecting local dependencies and transitive third-party dependencies.

It only works with [uv](https://docs.astral.sh/uv/) and with the [Hatch](https://hatch.pypa.io) build backend.
Una doesn't try to replicate a full build system such as [Bazel](https://bazel.build/) or
[Pants](https://www.pantsbuild.org/).
It just makes it possible to have a simple monorepo with interdependencies.

Una works much like a Rust workspace, with each package having its own pyproject.toml.
In general, packages should either be libraries (imported but not run) or apps (run but never imported), but Una will not enforce this.

It only works with the [Hatch](https://hatch.pypa.io) build backend.

## Examples
You can see an example repo here:
Expand Down
10 changes: 6 additions & 4 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ And start your workspace:
```bash
uv init unarepo # choose another name if you prefer
cd unarepo
git init
uv add --dev una
```

Then setup the Una workspace. This will generate a structure and an example lib and app.
```
uv run una create workspace
rm -rf src
uv sync
```

Expand All @@ -35,7 +37,7 @@ printer --> greeter --> cowsay-python
You can do this by running the following:
```bash
# this checks all imports and ensures they are added to
# [tool.una.deps] in the appropriate pyproject.toml
# project.dependencies and tool.uv.sources in the each pyproject.toml
uv run una sync
```

Expand All @@ -45,12 +47,12 @@ tail apps/printer/pyproject.toml
```

It added `greeter` as an internal dependency to `printer`.
It didn't add `cowsay-python`, as external dependencies are only resolved at build-time (keep reading).
It didn't add `cowsay-python`, as transitive external dependencies are only resolved at build-time.

Now you can build your app:
```bash
uvx --from build pyproject-build --installer uv apps/printer
# this will inject the cowsay-python externel dependency
uvx --from build pyproject-build --installer=uv --outdir=dist apps/printer
# this will inject the cowsay-python external dependency
```

And see the result:
Expand Down

0 comments on commit 228820f

Please sign in to comment.