[Python] Proper way of building a package with tox

Discussão em 'Python' iniciado por Stack, Abril 1, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using tox and wonder what is the intended way to build my package for distribution. I see that tox is building the package as part of the normal execution. It even provides a dedicated pkgenv section, but does not explain much how to use it.

    There seem to be two options on how to build a package:

    1. Explicitly, using a testenv:

    [testenv:build]
    commands = python3 -m build

    1. Implicitly, relying on the package being created in .tox/.pkg/dist during the test process

    Option (1) seems odd, given that there's a pkgenv available which would not be used in that case, but Option (2) cannot be called directly and is only created as a side effect of calling any of the targets.

    Does anyone which one it is? And what is the purpose of pkgenv? Can one use it like:

    [pkgenv:build]
    commands = python3 -m build

    Continue reading...

Compartilhe esta Página