Monorepos and performance: Pants Build maintainer Benjy Weinberger's conversation with SemaphoreCI

There are many benefits of using a monorepo. Among them, cleaner code, enhanced communication, and easier collaboration. The codebase can scale. The big catch is performance. If the experience of performance deteriorates for developers or deployers, that deservedly gets firm pushback. The processes and systems we use with monorepos are crucial for fulfilling the promise of monorepo benefits.

In this new April 2021 conversation with SemaphoreCI, long-time Pants Build maintainer Benjy Weinberger discusses some of the key ways Pants ensures snappy performance throughout the stages of developing, building, and deploying from a monorepo.

Ergonomic design priorities

We’ve put a lot of energy into making it much, much, much easier to adopt this kind of system than it’s ever been, and that continues to be an active area of work for us because we will not rest until it is really, really easy.

Dependency inference

The first and probably most important one is dependency inference. So unlike other tools, we do not require you to explicitly enumerate your dependencies in those build metadata files if we can infer them from your import statements. Occasionally, there’s a dependency you can’t infer. Sometimes you load code by name at runtime or you depend on assets that are not imported. There are cases like that, and in those cases you have to potentially manually add those dependencies. But 99% of the time you don’t.

And also, that logic is itself pluggable, the dependency inference logic.

Sensible defaults

When you declare this directory contains a Python library, or a bunch of Python tests, or whatever, Pants knows that tests are typically called `test_something`, or `something_test`, or `test.py`, or `conftest.py` for configuration. So it knows that, and it knows that everything else that ends in `.py` or `.pyi` is a library or so on.

Eliminate BUILD file clutter with tailor

Tailor helps you make your ‘pants’. Tailor basically generates build files by looking at what files you have. And it’s idempotent, so you can just keep running it as you go and it will add new build metadata as it goes.

You can listen to, or read, the whole episode at https://semaphoreci.com/blog/monorepo-building-at-scale.


Pants documentation

How does Pants work?

An intro to the Pants engine's core concepts.

Dependencies and dependency inference.

Learn more about Pants

What is monorepo? (And should you use it?)

How the Pants build systems leverages Python 3 features.

Show Comments