semvec/pypi-packages huggingface dataset:
poetry-polylith-plugin 1.48.4
A Poetry plugin that adds tooling support for the Polylith Architecture
License: MIT
Requires Python: <4.0,>=3.8

# Poetry Polylith Plugin

This is a Python `Poetry` plugin, adding CLI support for the Polylith Architecture.

## Documentation
Have a look at the [documentation](https://davidvujic.github.io/python-polylith-docs/).
You will find installation, setup, usage guides and more.

## Quick start

With the `Poetry` version 1.2 or later installed, you can add plugins.


Make sure that you have `Poetry` 1.2 or later installed.

Add the [Multiproject](https://github.com/DavidVujic/poetry-multiproject-plugin) plugin, that will enable the very important __workspace__ support (i.e. relative package includes) to Poetry.
``` shell
poetry self add poetry-multiproject-plugin
```

Add the Polylith plugin:
``` shell
poetry self add poetry-polylith-plugin
```

Create a directory for your code, initialize it with __git__ and create a basic __Poetry__ setup:

``` shell
git init

poetry init
```

Next: create a Polylith workspace, with a basic Polylith folder structure.

``` shell
poetry poly create workspace --name my_namespace --theme loose
```

Time to start coding. Add components, bases and projects:

``` shell
poetry poly create component --name my_component

poetry poly create base --name my_example_endpoint

poetry poly create project --name my_example_project
```

For details, have a look at the [documentation](https://davidvujic.github.io/python-polylith-docs/).
There, you will find guides for setup, migration, packaging, available commands, code examples and more.
pdm-polylith-bricks 1.3.7
a PDM build hook for Polylith
License: MIT
Requires Python: <4.0,>=3.9

# PDM Build Hook for Polylith

A plugin for [PDM](https://pdm-project.org) and the Polylith Architecture.

This build hook will look for Polylith `bricks` in `pyproject.toml` and __optionally__ re-write the imports made in the source code.

## Installation
``` toml
[build-system]
requires = ["pdm-backend", "pdm-polylith-bricks"]
build-backend = "pdm.backend"
```

The main usage of the build hook is to identify the included Polylith bricks from the `pyproject.toml`,
and hand them over to the PDM build process. Bricks are added to a project with relative paths,
from the `bases` and `components` folders in a Polylith Workspace.
The hook will copy the bricks into the temporary `.pdm-build` folder that is created by the `pdm build` command.
This will make the built `wheel` and `sdist` include proper paths to the source code.

Polylith Bricks are defined in the `tool.polylith.bricks` section of the `pyproject.toml`:

``` toml
[tool.polylith.bricks]
"../../bases/my_namespace/my_base" = "my_namespace/my_base"
"../../components/my_namespace/my_component" = "my_namespace/my_component
```

### Polylith documentation
[the Python tools for the Polylith Architecture](https://davidvujic.github.io/python-polylith-docs)

The build hook also add support for building Python libraries by re-writing source code with a custom top namespace.

## Why re-write code?
Building libraries is supported in [the Python tools for the Polylith Architecture](https://davidvujic.github.io/python-polylith-docs),
but you will need to consider that code will share the same top namespace with any other library built from the same monorepo.

This can be a problem when more than one of your libraries are installed into the same virtual environment.
Python libraries by default are installed in a "flat" folder structure, two libraries with the same top namespace will collide.

_A Solution_: add a custom top namespace during packaging of the library with PDM and this build hook.

### How is this done?
The code in this repo uses __AST__ (Abstract Syntax Tree) parsing to modify source code.
The Python built-in `ast` module is used to parse and un-parse Python code.


## What's the output from this plugin?

Without any custom namespace in the configuration: no changes in the code. Building and packaging as-is.

### With a Top Namespace configuration

``` toml
[tool.polylith.build]
top-namespace = "my_custom_namespace"
```

```shell
my_custom_namespace/
    my_namespace/
        /my_package
           __init__.py
           my_module.py
```

Before:
```python
from my_namespace.my_package import my_function
```

After:
```python
from my_custom_namespace.my_namespace.my_package import my_function
```

## Polylith Documentation
[the Python tools for the Polylith Architecture](https://davidvujic.github.io/python-polylith-docs)
pdm-polylith-workspace 1.3.7
a PDM build hook for a Polylith workspace
License: MIT
Requires Python: <4.0,>=3.9

# PDM Build Hook for a Polylith workspace

A plugin for [PDM](https://pdm-project.org) and the Polylith Architecture.

This build hook is making the virtual environment aware of a Polylith Workspace.

When running `pdm install` it will add an additional pth file to the virtual environment,
including paths to the `bases` and `components` folders.

## Usage
PDM has already a configuration option called `project-dir`, that is meant for defining a custom
path to the Python source code. But it only allows one directory.

The code in a Polylith workspace is organized into two folders (bases, components),
and that is the reason for using this hook.


## Installation
``` toml
[build-system]
requires = ["pdm-backend", "pdm-polylith-workspace"]
build-backend = "pdm.backend"

```

This is only needed in the Polylith workspace `pyproject.toml`, and not in the individual projects.

## Polylith documentation
[the Python tools for the Polylith Architecture](https://davidvujic.github.io/python-polylith-docs)