#12750·uv

Define commands to run right after package install (via uv pip install)

Author: MiamrionCreated Apr 8, 2025Updated Sep 16, 2026
Labelsenhancementwish

Summary

Hello there,

First of all thank you so much for the amazing work you've been doing with uv and for the amount of delivered updates. It's great !

We're a small animation studio which has recently adopted the use of uv as package manager mostly to handle our own custom Python libraries. We store them on our own server, and generate virtual envs containing said libraries in order to execute software while having access to our packages.

In the domain, there's a quite popular package manager, Rez, which offers the possibility to define one or several commands in the setup.py (they're still using this convention) of the packages. These commands are then automatically executed by Rez when said package is being installed into a virtual environment.

This can be particularly practical, for example if you wish to add your packages to your PYTHONPATH automatically at install.

So again the idea of this feature request would be : implement, via the package.pyproject.toml, a place to define commands which would be executed by uv at uv pip install package

We did not go with Rez, as uv seemed way faster and matched PEP conventions in a more graceful way ;) But some of the features offered by Rez could be really interesting if implemented in uv

Here is a link to the REZ page about the commands : https://rez.readthedocs.io/en/3.2.1/basic_concepts.html#package-commands

Thanks a lot in advance

Example

Let's imagine a package myLibrary In the pyproject.toml of myLibrary, I would have something as such :

[project] name = "myLibrary" version = "0.1.0" dependencies = [ "PySide2", "customLibrary >=0.1.0", "anotherCustomLibrary >=0.1.0", ] requires-python = ">=3.10" authors = [ {name = "Zorro", email = "[email protected]"}, ] maintainers = [ {name = "Zorro", email = "[email protected]"}, ] description = "An amazing custom library made in house at MagicStudio" [uv.commands] sys.path.append(".") # automatically execute this part at install. Here, append package root to sys path

When using uv pip install myLibrary in a uv venv, uv would automatically execute the uv.commands part of the pyproject.toml file.