I package my Python application with PIP, providing a setup.py. During installation, I want to ask the user for several values (user name, other configuration values), these values are then saved inside the application configfile stored inside the user directory.
Is there a special PIP/distutils-way to ask for these configuration values during setup?
Or should I just use input
to ask the user, like this:
#!/usr/bin/env python
from distutils.core import setup
cfg['name'] = input("Please your username:")
cfg.save()
setup(name='appname',
version='1.0',
description='App Description',
author='Author',
author_email='[email protected]',
packages=['mypackage'],
)
Or should I leave out asking for these values, and instead let the user configure the application on the first start?
I know that all of these ways are possible, but are there any conventions or best practices for that? Or do you know of a popular Python project doing similar stuff which is a good example?
setup.py provides you very primitive interface to install python packages. You can use a config file or create some GUI installer for your application.
Another way is to build OS depended packages (deb, rpm, msi for Windows) for your application.