New Post and edited offlinepip

This commit is contained in:
Brandon Rozek 2020-04-10 12:07:50 -04:00
parent 57b6850666
commit c01a9d6910
2 changed files with 44 additions and 0 deletions

View file

@ -79,3 +79,5 @@ Or they can just install the packages they want
pip install --no-index -f /path/to/wheels/wheels package_name
```
If you don't want to add flags to every command, check out my post on using [configuration files with pip](https://brandonrozek.com/blog/pipconf/).

42
content/blog/pipconf.md Normal file
View file

@ -0,0 +1,42 @@
---
title: "Pip Config"
date: 2020-04-10T11:56:19-04:00
draft: false
tags: ["python"]
---
If you find yourself added flags to every pip command, consider adding those flag's to a pip configuration file.
In order of importance, the configuration files will be located
- Inside the virtualenv `/path/to/virtualenv/pip.conf`
- In the user folder `~/.config/pip/pip.conf`
- Site-wide `/etc/pip.conf`
It is structured as an INI file where the blocks are the commands (`global` indicates all commands)
For an example, we can set the timeout for all commands to 60 seconds, but the timeout for the freeze command to only 10 seconds.
```ini
[global]
timeout = 60
[freeze]
timeout = 10
```
Boolean flags are set by assigning a value of `true` or `yes` to them
```ini
[install]
ignore-installed = true
```
For operating in an offline environment,
```ini
[global]
no-index = true
find-links = /path/to/wheels
```