If I have a basic Python script, with it\'s hashbang and what-not in place, so that from the terminal on Linux I can run
/path/to/file/MyScript [args]
you can also use setuptools
(https://pypi.org/project/setuptools/)
def hi():
print("hi")
(suppose the file name is hello.py
)
also add __init__.py
file next to your script (with nothing in it).
add setup.py
script, with the content:
#!/usr/bin/env python3
import setuptools
install_requires = [
'WHATEVER PACKAGES YOU NEED GOES HERE'
]
setuptools.setup(
name="some_utils",
version="1.1",
packages=setuptools.find_packages(),
install_requires=install_requires,
entry_points={
'console_scripts': [
'cool_script = hello:hi',
],
},
include_package_data=True,
)
python setup.py develop
in this foldercool_script
and your script will run.