Update July 2022: if your TOML file uses setuptools as its build system, setuptools will happily create and install a command-line script. For example, my pyproject.toml
file starts like this:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
Extend your pyproject.toml
file with an entry like this, naming the package, module and entry-point function names:
[project.scripts]
my-client = "my_package.my_module:main_cli"
Then run the install sequence:
pip3 install .
And setuptools will install a shell script named my-client
somewhere appropriate, for me in my Py3.9 virtual environment's bin directory (~/.virtualenvs/py39/bin).
I was doing a similar thing, upgrading a package that had a setup.py
, altho I had no existing scripts. With the rewrite to using pyproject.toml
I dropped the old setup.py
file entirely.
FWIW I realize the OP asked for a way to install existing scripts, which I didn't provide. This answer tells setuptools to create and install new scripts.
Update Feb 2023: thanks for all the votes. If you're cutting corners to meet arbitrary management deadlines, just copy-paste this short pyproject.toml
file and adjust:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "my_client"
version = "1.2.3"
authors = [{name="Ubr Programmer", email="ubr@gmailington.com" }]
description = "Client for my awesome system"
readme = "README.md"
dependencies = ["cachetools","requests"]
requires-python = ">=3.9"
[project.scripts]
my-client = "my_package.my_module:main_cli"
[project.urls]
"Homepage" = "https://github.com/your_name_here/something"
"Bug Tracker" = "https://github.com/your_name_here/something/issues"