feat(poly deps): view and validate brick interfaces#413
Open
DavidVujic wants to merge 12 commits intomainfrom
Open
feat(poly deps): view and validate brick interfaces#413DavidVujic wants to merge 12 commits intomainfrom
DavidVujic wants to merge 12 commits intomainfrom
Conversation
e025410 to
dad0dfb
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Introducing a new feature: view and validate brick interfaces.
With this pull request, the feature is added to the
poly deps --brickcommand.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:
Output:
With the addition:
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:
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__.pymodule. This feature will treat all imported things, all variables, classes and functions in the__init__.pymodule 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 checkcommand, 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
Checklist: