Install python package bin script with the unbuffered option passed to the python environment

176 Views Asked by At

I have a python script that is part of a package. The script source file some_script.py contains the following hash-bang at the beginning,

#!/usr/bin/env -S python3 -u

but after installation via pip, the script installed to my pythons bin directory is installed with this line

#!/Users/wursth/opt/anaconda3/envs/py3.9/bin/python

whereas I want it installed with the unbufferd option, like this

#!/Users/wursth/opt/anaconda3/envs/py3.9/bin/python -u

The setup.py looks like this,

import setuptools

setuptools.setup(
  name="test-pkg",
  version="0.0.1",
  author="Hans Wurst",
  description="Test pkg",
  packages=["test"],
  scripts=['test/some_script.py'],
  install_requires=['numpy',
                    'dill',
                    'scipy',
                    ],
  python_requires='>=3.5',
  classifiers=['Programming Language :: Python :: 3.8',
               'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
               'Operating System :: OS Independent'],
)

How can I achieve that a script is installed with the -u option passed to the python environment, when a user installs the python package via pip install ?

0

There are 0 best solutions below