Pants Build System adds support for Java, Scala and Go
Build System in the upcoming version now available to early adopters trousers adds Java, Scala, and Go to previously supported Python.
Pants aims to be a fast, scalable and easy to use build system. Pants breaks a build into many smaller tasks so that they can run them concurrently and cache their results so that they don’t have to be run again unless absolutely necessary. Pants is compatible with servers that host the Caching and remote execution API also used by Bazel and others. This means that it is also suitable for the division of work between several identically configured hosts.
One of the goals of Pants is to make build files less cluttered and to take the burden off the developer by avoiding unnecessary configurations. Indeed, thanks to a number of standard options, many projects can be customized by simply defining a
pants.toml Configuration file that contains the pants version that you want to pin your project to and that is required Back ends. This tells Pants which source files to look for and creates a suitable one
BUILD File for you. For example, here’s how you can provide a list of backends for a Python project, including linting and mypy support:
[GLOBAL] pants_version = "2.8.0" backend_packages.add = [ "pants.backend.python", "pants.backend.python.lint.docformatter", "pants.backend.python.lint.black", "pants.backend.python.lint.flake8", "pants.backend.python.lint.isort", "pants.backend.python.typecheck.mypy", ]
Each backend can be configured by providing its own options
.toml Section. In addition to creating libraries and executable files, Pants can also be made available via the corresponding backends in Docker and AWS Lambda.
InfoQ spoke to Benjy Weinberger, one of the creators of Pants alongside John Sirois and currently CEO of Tool chain, Main sponsor of the pants.
InfoQ: The build system arena is pretty crowded. Why do you think another build system is needed? What makes Pants unique compared to other solutions?
Weinberger: Over the past 5-10 years, some convergent trends have made code bases and their build workflows increasingly complex. These include: a growing dependency on a large tangle of third-party dependencies, more application frameworks and abstraction layers, new delivery paradigms (containers, cloud functions, microservices) and the emergence of data science as an independent engineering discipline.
Existing tools were not developed with these trends in mind and, given these and other innovations, are often limited in their performance and scalability. The design of existing tools has typically been driven by one of two concerns: A) support for small to medium-sized code bases with a single language / framework, or B) support for the internal needs of a single company. In no event will such a tool be able to meet the needs of most real-world engineering teams today.
Pants v2 was designed with these use cases in mind, and specifically how they are used by engineering teams of different sizes in different industries. Pants represents a significant advancement in ease of use, stability and performance for a wide variety of users whose needs are not met by previous generation build systems.
Another important innovation in Pants is ergonomics: building systems of the previous generation, especially the multilingual ones, usually have a steep learning curve, so that every user has to pick up a new domain of terms and concepts in order to get something done. Pants whenever possible works with the natural idioms of the languages ââand frameworks the user is already familiar with, trying to “get out of the way” as much as possible.
What sets Pants apart from its technical skills is also its very strong open source community ethos: Any person or organization can participate equally in the design and implementation, which helps ensure that the project caters to the needs of a wide variety of users. Community feedback on design and prioritization is actively sought, and the community is also a friendly resource for help with adopting and using Pants.
InfoQ: What are pants? Naturally Competitors from your point of view?
Weinberger: The biggest “competitor” we see in the market is not a particular system, but a motley collection of cobbled together, ad-hoc, DIY scripts. There is great dissatisfaction with these, but few teams have the expertise or experience to improve them on their own. Pants systematizes all of this build work and offers a unified, ergonomic user experience that perfectly suits your use cases and doesn’t distract you from the task at hand, while also offering better performance thanks to caching and parallelism. Since the self-created solutions do not scale well, teams often have to artificially split their code base. This slows down collaborative development as users have to take additional steps to publish code so that it can be used across repository boundaries. Pants allows you to unify your code base and supports fast iteration and nimble development.
In addition, of course, we see Bazel as a natural competitor. It is important to note that Bazel was developed for Google internal use. Their informal slogan is âBuild like Googleâ. But if you’re not Google, you almost certainly don’t want to build like Google! Their use cases are likely to vary widely, and Bazel was not designed for that. For example, Google doesn’t use any third-party dependencies, so Bazel’s support is arbitrary while Pants’s is robust. Pants are also much easier to adopt, use, and adjust. There are several reasons an engineering team should consider choosing Pants over Bazel. summarized in this article.
InfoQ: Pants 2.8 extends the supported languages ââconsiderably. What’s on the pants roadmap for next year?
Weinberger: Since our roadmap is so community-oriented, we are still working on our plans for 2022! We live on user input and now is a good time to deploy it as we plan for the months to come. That said, some likely issues are:
Security: Further enhancing Pants’ ability to protect your builds against supply chain and other attacks. We already have good support in this area, but security is a developing landscape that requires constant vigilance.
More work on scalability and performance to ensure all corporate users have a great build experience.
IDE integrations, especially IntelliJ / PyCharm and VS Code.