Skip to content

Nested brick support in *poly check* command #414

@Paulskit

Description

@Paulskit

First of all, thank you for the great library! It really simplifies my workflows when building multiple libs from the same monorepo!

Description

When using nested component structures in a Polylith project, the poly check command fails to locate components even though the build process works correctly.

Project Structure

project/
├── components/
│   └── namespace/
│       └── aws/
│           ├── s3/
│           └── glue/
└── bases/
    └── namespace/
        └── cli/

Configuration

pyproject.toml:

[tool.polylith.bricks]
"../../bases/namespace/cli" = "namespace/cli"
"../../components/namespace/aws/s3" = "namespace/aws/s3"

Then I've got

from namespace.aws.s3 import my_s3_func

...
my_3_func()

Everything builds and works as expected, except poly check command, which throws
🤔 Cannot locate aws in cli

I believe the root cause of the behaviour is here:
Image

The code checks for p.name which is s3 and p.parent.name is not a namespace, but a namespace/aws. Thus, the missing brick.

I'm not sure whether described behavior is expected, but it's really handy to organise things this way, so that you can include only a specific brick you're using, not the entire folder.
My expectation was it should work with poly check as well, since it works perfectly during the build and the resulting .whl executes with no issues at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions