Skip to main content

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:

  1. copy the actual project into a temporary folder.
  2. collect relative includes - such as include = "foo/bar", from = "../../shared" - and copy them into the temprary folder.
  3. generate a new pyproject.toml.
  4. run the poetry build command in the temporary folder.
  5. copy the built dist folder (containing the wheel and sdist) into the actual project folder.
  6. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_multiproject_plugin-1.0.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_multiproject_plugin-1.0.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file poetry_multiproject_plugin-1.0.3.tar.gz.

File metadata

File hashes

Hashes for poetry_multiproject_plugin-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d5c8fb5637e8c415995e2059fc60248edd5b542c3bef62aa267979b1cbd80573
MD5 8bb10f2ea2a87268032165ef0d9689be
BLAKE2b-256 f7f3fd0987f014a30ca1e97df8f00886444f09a9c89280c45d0a27a5dc28da9d

See more details on using hashes here.

File details

Details for the file poetry_multiproject_plugin-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_multiproject_plugin-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc09bcd68eaa8767684205b35ddc865e96f0dd0e2df17b3d8832963ce31dd7bd
MD5 1f7f01a6edf3a99c0c6836e557619112
BLAKE2b-256 742091d373a7071a41c92c9191d6bed64cc540001539d353d58ab43d8ce0ce46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page