-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I work almost entirely in an offline environment where we have our own private Pypi server setup. Whenever I attempt to setup a new Python environment I run into an issue that some packages won't install correctly with pip
, at least not the first time. If I manually pip install fastdiff
I can then pip install pytest-runner
and things work. There are other packages but this is the first one that I could nail down as being the cause of my woes.
I found that if edit /setuptools/command/easy_install.py
FROM:
...
if not self.editable:
self.check_site_dir()
self.index_url = self.index_url or "https://pypi.org/simple/"
self.shadow_path = self.all_site_dirs[:]
for path_item in self.install_dir, normalize_path(self.script_dir):
if path_item not in self.shadow_path:
self.shadow_path.insert(0, path_item)
...
TO:
...
if not self.editable:
self.check_site_dir()
self.index_url = self.index_url or "http://my-private.pypi/simple/"
self.shadow_path = self.all_site_dirs[:]
for path_item in self.install_dir, normalize_path(self.script_dir):
if path_item not in self.shadow_path:
self.shadow_path.insert(0, path_item)
...
I can do pip install fastdiff
and the package will install correctly without the need to pip install pytest-runner
.
This is a huge problem when trying to script out the build of an environment either in a Docker image or in a CI script things will just fail for no clear reason. This is due to my pyproject.toml
requiring not fastdiff
but rather snapshottest
. Trying to track down every one of the problem packages in a build is very time consuming and having to then include a pip install X
before doing poetry install
or pip install -r requirments.txt
is a giant pain.
So I purpose we maybe replace the hard coding of https://pypi.org/simple/
to an environment variable that maybe has a default of https://pypi.org/simple/
that way if you operate in an offline environment you can set the environment variable to your offline pypi repo and not have this headache.