Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carderne committed Aug 20, 2024
1 parent 4a71b6f commit 7148d24
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 20 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@

</div>

Una is a tool to make Python monorepos with Rye easier. It is a CLI tool and a build plugin that does the following things:
Una is a tool to make Python monorepos easier. It is a CLI tool and a build plugin that does the following things:

1. Enable builds of individual apps or projects within a monorepo.
2. Ensure that internal and external dependencies are correctly specified.

Una is inspired by [python-polylith](https://github.com/DavidVujic/python-polylith) and borrows extensively from that codebase.
But I find the [Polylith](https://polylith.gitbook.io/polylith) architecture to be quite intimidating for many, so wanted to create a lighter touch alternative that doesn't require too much re-thinking.
This project has very limited ambitions and doesn't try to do everything a proper build system such as [Bazel](https://bazel.build/) or [Pants](https://www.pantsbuild.org/) does.
It just tries to make a simple monorepo build just about possible.
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 allows two directory structures or styles:
- `packages`: this is the default style, that is just some extra build help on top of a Rye workspace.
- `modules`: a more novel approach with just a single pyproject.toml, arguably better DevX and doesn't require a Rye workspace.

- **Packages:** The default style, where each lib or app is a package with its own pyproject.toml (much like Rust's workspaces).
- **Modules**: A more novel approach with just a single pyproject.toml, inspired by [python-polylith](https://github.com/DavidVujic/python-polylith).

Within this context, we use the following words frequently:

- `lib`: a module or package that will be imported but not run.
- `app`: a module or package that will be run but never imported.
- `project`: a package with no code but only dependencies (only used in the `modules` style)
- `project`: a package with no code but only dependencies (only used in the Modules style).

Currently it works with the following build backends, but more will follow:

- [Hatch](https://hatch.pypa.io) (used by default and and in all documentation)
- [PDM](https://pdm-project.org/)

All instructions and examples use Rye for local development, but there is nothing inherently Rye-specific about the tool.

## Examples
You can see examples for each of the two styles here:

Expand Down Expand Up @@ -163,5 +163,17 @@ It covers additional things like:
- more detail on the [packages](https://una.rdrn.me/style-packages/) vs [modules](https://una.rdrn.me/style-modules/) styles
- and more!

## Contributing
See the instructions at the [official documentation](https://una.rdrn.me/contributing/).

Very briefly, local development is with Rye:
```bash
rye sync
rye run all # will fmt, lint, typecheck and test
```

Then open a PR.

## License
Una is distributed under the terms of the MIT license.
Significant parts of the code are from the [python-polylith](https://github.com/DavidVujic/python-polylith) project (c) 2022 David Vujic
2 changes: 1 addition & 1 deletion docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rye run build
```

You'll get some `*.whl` files, which you can then deploy with Docker or whatever you prefer.
They are fully self-contained, so you don't need Rye or Una or anything else wherever you want to install them.
They are fully self-contained, so you don't need Hatch/Rye/PDM or Una or anything else wherever you want to install them.
16 changes: 8 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@

</div>

Una is a tool to make Python monorepos with Rye easier. It is a CLI tool and a build plugin that does the following things:
Una is a tool to make Python monorepos easier. It is a CLI tool and a build plugin that does the following things:

1. Enable builds of individual apps or projects within a monorepo.
2. Ensure that internal and external dependencies are correctly specified.

Una is inspired by [python-polylith](https://github.com/DavidVujic/python-polylith) and borrows extensively from that codebase.
But I find the [Polylith](https://polylith.gitbook.io/polylith) architecture to be quite intimidating for many, so wanted to create a lighter touch alternative that doesn't require too much re-thinking.
This project has very limited ambitions and doesn't try to do everything a proper build system such as [Bazel](https://bazel.build/) or [Pants](https://www.pantsbuild.org/) does.
It just tries to make a simple monorepo build just about possible.
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 allows two directory structures or styles:
- `packages`: this is the default style, that is just some extra build help on top of a Rye workspace.
- `modules`: a more novel approach with just a single pyproject.toml, arguably better DevX and doesn't require a Rye workspace.

- **Packages:** The default style, where each lib or app is a package with its own pyproject.toml (much like Rust's workspaces).
- **Modules**: A more novel approach with just a single pyproject.toml, inspired by [python-polylith](https://github.com/DavidVujic/python-polylith).

Within this context, we use the following words frequently:

- `lib`: a module or package that will be imported but not run.
- `app`: a module or package that will be run but never imported.
- `project`: a package with no code but only dependencies (only used in the `modules` style)
- `project`: a package with no code but only dependencies (only used in the Modules style).

Currently it works with the following build backends, but more will follow:

- [Hatch](https://hatch.pypa.io) (used by default and and in all documentation)
- [PDM](https://pdm-project.org/)

All instructions and examples use Rye for local development, but there is nothing inherently Rye-specific about the tool.

## Examples
You can see examples for each of the two styles here:

Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ But you will likely struggle to manage your monorepo without the tool!

So you may as well install it:
```bash
rya add --dev una
rye add --dev una
```

As for the build-time `hatch-una`, it will automatically be installed by build tools when it spots this in your `pyproject.toml` (this will be configured automatically by the CLI):
Expand Down
2 changes: 1 addition & 1 deletion docs/style-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You can see an example of the Modules style here:
- [una-example-modules](https://github.com/carderne/una-example-modules)

This approach is inspired by [Polylith](https://davidvujic.github.io/python-polylith-docs/).
You don't use a Rye workspace (and indeed this approach will work with just Hatch), and there's only a single `pyproject.toml`.
Each app or lib is just a module with no pyproject.toml.

The structure looks like this:
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/style-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can see an example of the Modules style here:
- [una-example-packages](https://github.com/carderne/una-example-packages)

In this setup, we use Rye's built-in workspace support. The structure will look something like this:
In this setup, we use Rye's built-in workspace support (but you could also just create this structure some other way, YMMV). The structure will look something like this:
```bash
.
├── pyproject.toml
Expand Down

0 comments on commit 7148d24

Please sign in to comment.