New feature: find brick usage that is bypassing the explicit interface 🎉 #437
DavidVujic
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Introducing a new feature: find/validate the interfaces for the bricks in the Polylith workspace.
The feature is added to the
poly depscommand. Any bypassed interface usages will be displayed as information (and not as an fail exit code). Because when it is valid Python, the Polylith tool won't get in your way. This feature is useful for teams that develop code with clear and explicit boundaries, and want to be able to validate those.Now it is possible by using the
poly depscommand, with the option--interface.The core functionality was already in the tool (announced here), but only for individual bricks (when using
poly deps --brick my_brick --interface). With this release, all bricks in the Workspace will be inspected and any bypassing of a brick interface will be printed out in the view.Recap: 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.
Example
In this recording, the message brick exposes functions via the init.py module. But, there's another module in the messages folder. The module is used by a different brick, but it wasn't added as part of the message interface.
This example is using the Polylith CLI with uv, and it (of course) works the same way when using Poetry.
The new feature is available in the CLI v1.45 and in the Poetry plugin v1.51. I hope you will find this new addition useful!
Beta Was this translation helpful? Give feedback.
All reactions