DEV Community

David Vujic
David Vujic

Posted on

Introducing a new command to the Python Polylith tool

The Python tools for the Polylith Architecture now has a new command called poly test. As of this release, the command is used with a sub-command: poly test diff.

But wait, what's Polylith?

The main use case is to support having one or more Microservices (or apps) in a Monorepo, and share code between the services.

Polylith is an architecture, with tooling support. Polylith is using a components-first architecture. You can think of it as building blocks, very much like LEGO bricks. All code lives in a Monorepo, available for reuse. Python code, the set of LEGO bricks, is separated from the infrastructure and the actual building of your deployable artifacts. Have a look at the docs for more details, or the #polylith tag here in this community.

The poly test command
This new command is adding the possibility to identify bricks and projects that are affected by changes in tests. In its structure, the new command is very much like the existing poly diff command (that will display changed bricks compared to a git tag).

The poly test diff command will show you any affected bricks or projects when the automated tests have been updated. When changing a test that imports a brick, the command will report the brick as affected. The command can also report on the affected project(s), based on the affected brick.

Example usage:

# Poetry
poetry poly test diff

# CLI users, such as uv
uv run poly test diff
Enter fullscreen mode Exit fullscreen mode

Affected bricks:

# Poetry
poetry poly test diff --bricks

# CLI users, such as uv
uv run poly test diff --bricks
Enter fullscreen mode Exit fullscreen mode

Affected projects:

# Poetry
poetry poly test diff --projects

# CLI users, such as uv
uv run poly test diff --projects
Enter fullscreen mode Exit fullscreen mode

Example usage of the new poly test command

References
The Python tools for the Polylith Architecture documentation
The Python tools for the Polylith Architecture at GitHub

Top comments (0)