I have implemented a code that install requirements using pip install
command without any problem. In order not to install unnecessary packages for the user, it is required to ask them questions (input) and install the packages based on their answers.
Here is my current setup.py file which works perfect but install all packages:
setuptools.setup(
name="backbone",
version="1",
entry_points={
"console_scripts": [
'backbone_cli=backbone.backbone:main'
]
},
author="Mostafa Ghadimi",
author_email="<my_email>",
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=requirements,
include_package_data=True,
url="https://github.com/mostafaghadimi/backbone",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages=setuptools.find_packages(),
python_requires=">=3.6",
license='MIT',
)
As an example, let's imagine that we want to ask the user that whether he/she wants to install numpy
or not. I have tried does_need_numpy = input('Do you want to install numpy? [y]es/[n]o')
but it doesn't work and when I add it to setup.py, face to the following error while I want to install the package (pip install <package_name>
):
File "/tmp/pip-req-build-ldgfq6l6/setup.py", line 11, in <module>
does_need_numpy = input('Do you want to install numpy? [y]es/[n]o')
EOFError: EOF when reading a line
As I have found, there is some functions like cmdclass install that may be the solution.
Can someone help me how to implement the expected functionality?