Building different versions of a package for different editable venvs from a single checkout

There is a dependency of a project of mine, on which I’d like to hack. That dependency (kivy) declares a few optional dependencies, and builds a few native modules with cython; my project requires a given set of them (actually an empty set), and running kivy’s unit tests requires [dev,full].

The two projects cannot use a shared venv because of the different required configurations, and they both want kivy as editable to be able to easily test a change in the 2 projects.

Incidentally, this seems to be the same set of constraints that would be needed to incrementally run tests on a range of of python versions using several venvs in editable mode.

Any ideas how to get such a setup to work?

You’ll need some kind of environment manager where you declare different dependencies per environment. Using tox, you might do:

pyproject.toml:

dependencies = [
  "kivy",
  ...
]

dependency-groups = [
  "kivydev" = "kivy[dev,full]",
]

tox.ini:

[tox]
envlist =
  py314
  py314-kivy

[testenv]
dependency_groups =
  kivy: kivydev
...

You’ll need to read tox’s documentation to figure out your full config. pixi also has capabilities for defining environments with different features. I’m sure others do as well.

Ah, you mean tuning my project configuration to be able to use a kivy config compatible, rather than attempting to use the two different configs at once. Sounds like a good idea, I’ll dig what uv has to offer since I’m using hat one for now, but tox definitely seems to have interesting features. Thanks!