0

I do not find any way to make an executable script via pyproject.toml. All I found is to use old setup.cfg file. The official documentation says nothing about that.

Suppose you simply create a function as a official documention does:

def add_one(number):
    return number + 1

and you want to have this (save it as src/example_package_YOUR_USERNAME_HERE/myscript.py following the example in the documentation)

from example_package_YOUR_USERNAME_HERE import example
example.add_one(2)

as executable. How to do that?

somenxavier
  • 1,206
  • 3
  • 20
  • 43
  • 1
    This depends on which tool you use for the install. If you use setuptools, you can find an example here: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html For other tools you have to look at their respective documentation – cuzi Feb 11 '23 at 21:14
  • @cruzi What do you mean? In the official documentation, threre is no comment about that – somenxavier Feb 11 '23 at 21:16
  • 2
    The "official specification" does not include this feature. It is up to the build/install tool to offer it. For example setuptools and poetry support it, probably others as well. But the entries in pyproject.toml will look different for setuptools and poetry, so it depends on which tool you use. – cuzi Feb 11 '23 at 21:20

0 Answers0