I have a setup.py like this:
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="myproject",
package_dir={"": "src"},
packages=find_packages("src"),
entry_points={
"console_scripts": [
"my-script = myproject.myscript:entrypoint",
],
},
)
How can I write that entry_points
configuration in pyproject.toml using setuptools?
I'm guessing something like this, going on setuptools' pyproject.toml docs, which says I need to use "INI format" following the docs that references for entry-points but it doesn't seem to give an example, and my guess at how to combine the setuptools syntax with the pyproject.toml syntax is wrong (I get a traceback from pip install -e .
that reports pip._vendor.tomli.TOMLDecodeError: Invalid value
, pointing at the entry-points
line in pyproject.toml):
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[metadata]
name = "myproject"
[tool.setuptools]
package-dir = {"" = "src"}
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.dynamic]
entry-points =
my-script = myproject.myscript:entrypoint
Note I have a stub setup.py alongside that pyproject.toml, like this (which I read I need to support pip install -e .
i.e. "editable installation"):
from setuptools import setup
if __name__ == "__main__":
setup()