How to develop a PIP python package that installs a command script without setup.py

I have a Python package that uses setup.py, and twine, to install the Python project, and a command script that goes along with it, using setup.py's scripts=[] parameter. This works without problems as an sdist (source distribution). Then I read the direction of Python packaging to is move away from sdist and setup.py and use "wheel", bdist_wheel. However, I could not make wheel install the command script to the user's PATH.

So, I tried a Python tool called "poetry" that manages the builds and generates wheel files. It has a way to install command scripts, but to run them, that is, for the end user who installs my package, they would have to execute "poetry run {script}". That won't do. The command needs to run without having the user enter "poetry run" and just the command.

Question: is there a way with Python wheels to install command scripts into the user's PATH?

here is the setup.py content. I would like to do what this does without a Python wheel and no need for setup.py

setuptools.setup(
    name="watiba", # Replace with your own username
    version=new_version,
    author="Ray Walker",
    author_email="raythonic@gmail.com",
    license="MIT",
    description="Python syntactical sugar for embedded shell commands",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/Raythonic/watiba",
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.8',
    scripts=["bin/watiba-c"],
    data_files=["version.conf"]
)


Read more here: https://stackoverflow.com/questions/65839337/how-to-develop-a-pip-python-package-that-installs-a-command-script-without-setup

Content Attribution

This content was originally published by Ray Walker at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: