Paketmanagement

Python package manage­ment: A new, promi­sing tool called UV

Share post:

In our role as a data science and AI consul­tancy, we are constantly looking for tools that make our work in our customer projects more efficient. A well-known chall­enge in the Python ecosystem is the package manager pip, especi­ally in large projects with many depen­den­cies. This is exactly where UV from Astral comes into play.

Our situa­tion

Python is the language of choice in our projects. The ecosystem is so mature and you can access libra­ries in diffe­rent programming languages to do certain things optimally.

However, a well-known complex task is the

Managing of depen­den­cies and environ­ments.

As things stand at the moment, we mainly use poetry for Python package manage­ment, which we like quite a lot, not least because of the simple syntax, but still many manual inter­ven­tion options.
Nevert­heless, the correct Python version has to be installed manually and resol­ving the depen­den­cies can take a little longer, especi­ally for large projects. So when we heard about UV, we defini­tely had to try it!

What does UV bring us?

1. Speed!
UV is incre­dibly fast when resol­ving and instal­ling depen­den­cies. This is mainly due to efficient caching if the packages have already been installed on the same machine, but also to the fact that UV is written entirely in Rust and there­fore benefits from the advan­tages of this compiled language.

2. Repro­du­ci­bi­lity!
With multiple develo­pers on a project, diffe­rent platforms and dev, test and prod environ­ments, it can be quite complex to always create the exact same condi­tions. This can lead to bugs, which can be very diffi­cult to identify. UV takes over the complete manage­ment of depen­den­cies and the develo­p­ment environ­ment, ensuring that the same requi­re­ments can be met on every platform.

3. Syntax!
UV has a very similar syntax to Poetry, which we have been using as standard in new projects for around two years. The under­lying pyproject.toml and *.lock files are also already known from Poetry. A very under­stan­dable and largely familiar syntax can be used here to make a quick change.

4. Integra­tion!
UV integrates seamlessly into existing workflows so that develo­pers do not have to adapt their work. Existing requirements.txt files work directly with UV, and familiar commands such as `pip install` can be easily replaced by UV.

In addition, the Astral team has already created a very good tool called Ruff, which we use as a standard. This gives us an additional level of confi­dence and a justi­fied hope that UV will also be further developed in a stable manner.

Conclu­sion

Accor­ding to the manufac­turer Astral, UV brings some promi­sing impro­ve­ments for Python package manage­ment. I have tested UV myself in a toy project and I am already very impressed. The advan­tages described in terms of perfor­mance, seamless integra­tion and indepen­dence from Python are defini­tely no empty promises. There are many more possi­bi­li­ties with UV, for example, the workspaces are very interes­ting for me, as we have many projects based on indepen­dent micro­ser­vices, which we could then manage uniformly.

We are planning to try out UV in our future projects and check carefully whether the promised benefits can also be experi­enced in real projects. We are also monito­ring further develo­p­ments and are looking forward to further ideas from Astral!

Picture of Torben Windler

Torben Windler

Lead AI Engineer

Projektanfrage

Vielen Dank für Ihr Interesse an den Leistungen von m²hycon. Wir freuen uns sehr, von Ihrem Projekt zu erfahren und legen großen Wert darauf, Sie ausführlich zu beraten.

Von Ihnen im Formular eingegebene Daten speichern und verwenden wir ausschließlich zur Bearbeitung Ihrer Anfrage. Ihre Daten werden verschlüsselt übermittelt. Wir verarbeiten Ihre personenbezogenen Daten im Einklang mit unserer Datenschutzerklärung.

Project request

Thank you for your interest in m²hycon’s services. We look forward to hearing about your project and attach great importance to providing you with detailed advice.

We store and use the data you enter in the form exclusively for processing your request. Your data is transmitted in encrypted form. We process your personal data in accordance with our privacy policy.