Skip to content

feat(poly deps): view and validate brick interfaces#413

Open
DavidVujic wants to merge 12 commits intomainfrom
brick-interfaces
Open

feat(poly deps): view and validate brick interfaces#413
DavidVujic wants to merge 12 commits intomainfrom
brick-interfaces

Conversation

@DavidVujic
Copy link
Owner

@DavidVujic DavidVujic commented Jan 2, 2026

Description

Introducing a new feature: view and validate brick interfaces.

With this pull request, the feature is added to the poly deps --brick command.

Using a new option, --interface, will display the public interface of a specific brick. Also, it will highlight if there are any usages that bypasses the public interface. It is reported as information, and will not exit with a failed code.

Example usage:

poly deps --brick my_brick --interface

Output:

used by   👈   my_brick   👉   uses           
────────────────────────────────────────────── 
the_other_brick                                      
another_brick                                           

With the addition:

my_brick exposes: 
function_one
function_two       

In case there are usages outside of the interface boundary:
a sub-module (in this example "hello_world") that isn't part of the public interface was used:

ℹ Found in the_other_brick: hello_world is not part of the public interface of my_brick. 

Motivation and Context

What's a brick interface?

The way the Polylith tool identifies a brick interface is by analyzing the contents of the __init__.py module. This feature will treat all imported things, all variables, classes and functions in the __init__.py module as part of the interface (unless marked as "private" using _). In addition, it will also check the contents of the __all__ variable if existing in the module.

This feature will make it possible to inspect how a brick is used across the Polylith workspace. With the notifications about usage outside of the interface boundaries, you will be able to identify any unexpected usages.

Future plans

Adding the interface validations as part of the poly check command, or introduce a new command. This is currently ongoing work.

How Has This Been Tested?

✅ CI
✅ Unit test
✅ local run of command, running against the Polylith repo itself

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

@DavidVujic DavidVujic changed the title Brick interfaces feat: view and validate brick interfaces Feb 6, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

@DavidVujic DavidVujic marked this pull request as ready for review February 6, 2026 10:14
@DavidVujic DavidVujic changed the title feat: view and validate brick interfaces feat(poly deps): view and validate brick interfaces Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant