A Poetry plugin that makes it possible to use relative package includes.
Reason this release was yanked:
The newly released check-project command does not work in this actual version.
Project description
Poetry Multiproject Plugin
This is a Python Poetry
plugin, adding the build-project
and check-project
commands.
The build-project
command will make it possible to use relative package includes.
This feature is very useful for monorepos and when sharing code between projects.
The check-project
command is useful to check that dependencies are added properly in a project.
It uses the MyPy
tool under the hood, and will output any errors from the static type checker.
Usage
Navigate to the project folder (where the pyproject.toml
file is).
Build a project:
poetry build-project
Check the code used in a project:
poetry check-project
Check the code, with a custom MyPy
configuration to override the defaults:
poetry check-project --config-file <PATH-TO-MYPY.INI-CONFIG-FILE>
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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 854d20cc5699aa802db006bfe18fce4a21c9b56a9155838d170e7bb3acdb4b31 |
|
MD5 | ecd768e8e9560bf15528fe02f72d7659 |
|
BLAKE2b-256 | b352d36874b4fb3330680c90d9a1f13db8d9f0e79dea4a4ccd91e8b876e0e999 |
Hashes for poetry_multiproject_plugin-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 608702802fa4cdd09ebbd7e206dac198c12bbf1af74a1a26090119fdfd195204 |
|
MD5 | c1c00bd15ec629616ae47f3df07c7c85 |
|
BLAKE2b-256 | 2d0c70f7011a835f26f02f0175bb56ed52d2ece668b77b1f75d856dc30d9b534 |