[Python] pyproject.toml setuptools: How can I specify optional scripts (and modules)?

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I have a python project with some modules, scripts and optional dependencies:

    [project.optional-dependencies]
    extra = [ "tqdm", "antspyx>=0.4.2", "scikit-image", "mpi4py", "scipy" ]

    [project.scripts]
    reg = "myproject._cmd.reg:main"
    conv = "myproject._cmd.conv:main"

    [tool.setuptools.packages.find]
    where = ["src"]
    include = ["myproject*"]


    Now I would like the scripts to be installed, only for pip install myproject[extra]. By now, these scripts are installed even for pip install myproject

    It would also be nice to be able to split my modules like this. Modules in src/myproject/extra/ should be installed only for pip install myproject[extra]. If pip install myproject is called, only modules in src/myproject/modules/ should be installed.

    So, how can I declare optional modules and optional scripts in pyproject.toml?

    Continue reading...

Compartilhe esta Página