Skip to content

Build package from dynamically created directory via custom build.py #8312

@rragundez

Description

@rragundez
  • Poetry version: 1.5.1

  • Python version: 3.10

  • OS version and name: macOS 13.5

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I have a custom build section by using the following config in my pyproject.toml

generate-setup-file = false
script = "build.py"

The build.py script dynamically creates my package in a dynamically created directory, let's say my_real_package/ (does not exist at the moment of executing poetry build). In my pyproject.toml I have

[tool.poetry]
packages = [{include = "my_real_package"}]

Then when executing poetry build I am shown the error .../my_real_package does not contain any element at the start, because the my_real_package is created during the build and is not present at the start.

I tested and if I change packages = [{include = "package"}] (this directory exists as a package), run the build so that my_real_package is created and then change back packages = [{include = "my_real_package"}] and run again poetry build, it works.
So this tells me that updating to a warning the error for special cases (like when there is a custom build script) .../my_real_package does not contain any element will make everything work with a single poetry build command where I keep packages = [{include = "my_real_package"}] and my_real_package is dynamically created by my build.py script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/build-systemRelated to PEP 517 packaging (see poetry-core)kind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions