If you need to manage multiple configurations containing indexes and trusted hosts for PIP, this project was made for you.
The pipconf is based in pip.conf files in $HOME/.pip folder. But you won't create it with this name. So, you need to create your configuration files following the template config-file-name.conf.
For the first steps, create a new configuration.
$ pipconf new my-config.conf --openThe file will come with a configuration template. All you need to do is just replace with your necessities.
<!-- my-config.conf -->
[global]
index-url = https://pypi.org/simple
# extra-index-url =
# trusted-host =
# timeout = 15
# retries = 5
...<!-- company-config.conf -->
[global]
index-url = http://mycompany.com/artifactory/api/pypi/pypi/simple
extra-index-url = http://mycompany.com/artifactory/api/pypi/pypi-local/simple/
trusted-host = mycompany.comThe package is available at pypi.org. Then, you can install it using pip.
$ pip install pipconf$ pipconf --helpThe expected output should be something like the following content.
Usage: pipconf [OPTIONS] COMMAND [ARGS]...
______ ___________ _____ _____ _ _ ______
| ___ \_ _| ___ \/ __ \ _ | \ | || ___|
| |_/ / | | | |_/ /| / \/ | | | \| || |
| __/ | | | __/ | | | | | | . ` || _|
| | _| |_| | | \__/\ \_/ / |\ || |
\_| \___/\_| \____/\___/\_| \_/\_| v2.0.0
Under BSD-2-Clause License, by @jjpaulo2
Contribute at https://github.com/jjpaulo2/pipconf
╭─ Display informations ───────────────────────────╮
│ current Shows the currently active config file │
│ list Lists all available configs │
│ show Shows a config file content │
╰──────────────────────────────────────────────────╯
╭─ Change configurations ──────────────────────────╮
│ local Select a config file in current workdir │
│ new Creates a new config file │
│ set Select a configuration │
╰──────────────────────────────────────────────────╯
$ pipconf listAvailable configurations at /home/user/.pip:
● company.conf (/home/user/.pip/company.conf)
○ my-config.conf (/home/user/.pip/my-config.conf)
○ project.conf (/home/user/.pip/project-config.conf)
$ pipconf new my-configConfig file my-config.conf created!
You can also pass a --open flag to create and open the file.
$ pipconf new my-config --open$ pipconf currentCurrent configuration is /home/user/.pip/my-conf.conf!
$ pipconf show my-conf╭─────────── /home/user/.pip/test.conf ────────────╮
│ [global] │
│ index-url = https://pypi.org/simple │
│ ... │
╰──────────────────────────────────────────────────╯
If you don't pass any parameter, the command will show the content of the current configation file.
$ pipconf show$ pipconf set my-configConfiguration is now set to my-config.conf!
If in the current workdir exists a file named pip.conf, you can set it as the current configuration.
$ pipconf localConfiguration is now set to /home/user/workspace/project/pip.conf!
Under BSD-2-Clause License, by @jjpaulo2.
