A Poetry plugin that makes it possible to use relative package includes.
Project description
Poetry Multiproject Plugin
This is a Python Poetry
plugin, adding the build-project
command.
The command will make it possible to use relative package includes. This feature is very useful for monorepos and when sharing code between projects.
Usage
Navigate to the project folder (where the pyproject.toml
file is).
poetry build-project
Installation
This plugin can be installed according to the official Poetry docs.
poetry self add poetry-multiproject-plugin
What does it do?
the poetry build-command
will:
- copy the actual project into a temporary folder.
- collect relative includes - such as
include = "foo/bar", from = "../../shared"
- and copy them into the temprary folder. - generate a new pyproject.toml.
- run the
poetry build
command in the temporary folder. - copy the built
dist
folder (containing the wheel and sdist) into the actual project folder. - remove the temporary folder.
How is it different from the "poetry build" command?
Poetry does not allow package includes outside of the project root.
# Note the structure of the shared folder: namespace/package
packages = [
{ include = "my_namespace/my_package", from = "../../shared" }
{ include = "my_namespace/my_other_package", from = "../../shared" }
]
This plugin will allow relative package includes. You will now be able to share code between projects.
An suggested Monorepo structure, with the shared code extracted into a separate folder structure:
projects/
my_app/
pyproject.toml (including a shared package)
my_service/
pyproject.toml (including other shared packages)
shared/
my_namespace/
my_package/
__init__.py
code.py
my_other_package/
__init__.py
code.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for poetry_multiproject_plugin-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4a8abb5cba0732ecd6de2a9a93e41ac880964cf088d9a988e4be13c240c25f8 |
|
MD5 | 4993627357965e492d87b8d087b1263f |
|
BLAKE2b-256 | 5e080135c7de050c31384498735b878f587530d550c94612f0b76a36dfcf4ca9 |
Hashes for poetry_multiproject_plugin-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c93fcfe4c2a674fe77d1c1dcde3044178d1e8525d229363755caeafcc5d23c2 |
|
MD5 | 9d1e3368527f87aeda17d648542a8f92 |
|
BLAKE2b-256 | 61caad2d14c117ed4dd30d68b32f7b2c676594861b2e60dd71d2a8771ae58275 |