Skip to content

Nested brick support in *poly check* command #414

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.

Activity

  1. DavidVujic commented on Jan 27, 2026

    @DavidVujic
    Owner

    Hi @Paulskit,

    I'm happy to hear that you like Polylith!

    I think this is expected behavior because the added things should be on brick-level and Polylith considers aws as one brick. I would suggest that you either add the entire aws brick, or separate the sub-namespaces s3 and glue into their own bricks. If you want them visually grouped in the folder structure, you could name the bricks with a prefix, such as aws_s3.

  2. DavidVujic commented on Jan 31, 2026

    @DavidVujic
    Owner

    (moving this to the Q&A discussions section)

  3. Repository owner locked and limited conversation to collaborators on Jan 31, 2026
  4. converted this issue into a discussion #415 on Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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