1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to port tox legacy ini to toml

Discussão em 'Python' iniciado por Stack, Novembro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I have a project with Tox configuration for testing, with different versions of Python and Django. With the move from Tox 3 to Tox 4, I included the configuration as a legacy ini in my pyproject.toml , but I want to modernize it.


    [tool.tox]
    legacy_tox_ini = """
    [tox]
    envlist = py39-django42, py{310,311,312}-django{42,50,51,52}, py313-django{51,52,main}
    isolated_build = True
    skipsdist = True

    [testenv]
    deps =
    flake8

    django42: Django>=4.2,<4.3
    django50: Django>=5.0,<5.1
    django51: Django>=5.1,<5.2
    django52: Django>=5.2,<5.3
    djangomain: git+https://github.com/django/django.git@main#egg=django
    psycopg2-binary
    dj-database-url>=2.3.0,<3.0

    # ...
    """


    Is there a sensible way to reproduce this with native TOML, supposedly the preferred format now? All I could find required giving up all the shorthands -- e.g. if an envlist like this can still be defined at all, it seems to require also that each of the combinations of Python and Django be explicitly given its own TOML table.

    Is there a way to do this without massive duplication?

    Continue reading...

Compartilhe esta Página