Reputation: 5412
I've created a tar.gz of a package that includes a setup.py file. setup.py uses the setup() function provided in distutils.core. I want to prompt the user when they run "pip install .tar.gz". Unfortunately, it looks like pip redirects all stdout and stderr of the "python setup.py install" command through a special log filter, which reads stdout line by line. This means I can't have a prompt such as "Email: ..." since "Email: " will not get printed until after the user has pressed enter. Also, the log filter indents every line of output, which is not ideal.
Upvotes: 1
Views: 1765
Reputation: 110311
Don't do that.
If it is absolutely necessary to have information from the user during the install, ask for an environment variable to be set, and fail if it is not set. Better yet, require a plain text configure file to run your module - and set it with default values during the install
Don't try to make an interactive session needed during the install, because the idea of PIP and easy_install are that they also install the pre-requisites of a package - so they may install a lot of packages in a batch,. The user will just expect pip install to do its job, and an unexpected interactive prompt will ruin automated installs, pre-requiste chains, buildout installs, remote installs, and so on.
Upvotes: 2