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

298 Views Asked by At

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?

0

There are 0 best solutions below