pythonsetup.pypyproject.toml

Specifying command line scripts in pyproject.toml


I'm trying to add a pyproject.toml to a project that's been using setup.py in order to enable support by pipx. I'd like to specify the command line scripts the project includes in pyproject.toml, but all the guides I can find give instructions for use with poetry, which I am not using.

I also don't want to specify entry points to modules - I already have working command line scripts and just want to specify those.

Is there a proper place in pyproject.toml to specify command line scripts?

Not sure it matters, but the package in question is cutlet.


Solution

  • Is there a proper place in pyproject.toml to specify command line scripts?

    PEP566 (Metadata 2.1) only defines Core metadata specifications. Thus, the answer depends on your build system (Note: PEP518 defines build system concept).

    If you use the existing build tools such as setuptools, poetry, and flit, you only can consider adding such options in pyproject.toml if that tool supports command line scripts (console_scripts) in pyproject.toml. Surely, if you have your own build tool, you need to implement a parser to parse the command line scripts in pyproject.toml.

    Lastly, you can check below list to know which major build system supports command line scripts (console_scripts) in pyproject.toml (2020/Oct):