openlang

Using one source checkout for multiple editable package builds in separate venvs

I'd like to make changes to a dependency used by one of my projects. This dependency (kivy (https://kivy.org/)) offers several optional dependencies and compiles some native modules using cython, with my project needing a particular selection (in fact none), while kivy's own tests need [dev,full].

The projects need different configurations, so sharing a venv between them won't work, but each still needs kivy installed in editable mode so that I can easily test a change in both projects.

As an aside, I think the same constraints apply when gradually testing several python versions, using separate editable-mode venvs for for that purpose.

Does anyone know how to make this arrangement work?

The conversation continues 2

Follow the reasoning
  1. Permalink

    An environment manager that lets you specify dependencies separately for each environment should do it. With tox (https://tox.wiki/), something along these lines could work:

    pyproject.toml:

    dependencies = [
        "kivy",
        ...
    ]
    
    dependency-groups = [
        "widgetdev" = "kivy[dev,full]",
    ]

    tox.ini:

    [tox]
    envlist =
        py314
        py314-widget
    
    [testenv]
    dependency_groups =
        widget: widgetdev
    ...

    Check the tox documentation for the details needed to finish your configuration. pixi (https://pixi.prefix.dev/) can also define differently featured environments. Other tools probably support this too.

  2. Permalink

    Ah, so adapt my project's settings to accept a compatible kivy configuration, instead of trying to run both configurations together. That sounds like a sensible approach, I'll look more closely at what uv can do here since that's the tool I'm usng at the moment, though tox certainly seems to have some useful features. Thanks!

Other sides of the same question

  1. Reducing docker-compose console noise

    Several of my containers produce hundreds upon hundreds of output lines when docker-compose up starts all the services in my…

    Replies 3Latest activity bash
  2. Could D produce Python extension modules rather than using C?

    Apparently D can link against C. I want to write a Python extension module using D. Is there a reason this approach could nev…

    Replies 2Latest activity d
  3. Micro plugins declared through Nix?🤔

    With python we can write this: Python.withPackages (q: with q; [ fastapi ]) Is an equivalent mechanism available for the Micr…

    Replies 3Latest activity nix