Saturday, 20 February 2021

Setup.py reinstalling already installed user-written package

I am developing two python packages, pkg_a and pkg_b. pkg_a is a requirement for pkg_b, and so the setup.py for pkg_b looks like this:

from setuptools import setup

inst_reqs = [
    'pkg_a @ git+ssh://git@bitbucket.org/vlad/pkg_a.git',
]

setup(
    name="pkg_b",
    version="0.0.0",
    packages=['pkg_b'],
    install_requires=inst_reqs,
)

Since I am developing both packages simultaneously, pkg_a is already installed in editable mode (pip install -e .).

When pip installing pkg_b, why is the existing installation of pkg_a removed? It looks like pip will systematically cone the specified repo, uninstall the existing pkg_a and reinstall it from the cloned repo:

Successfully built pkg_a
Installing collected packages: pkg_a, pkg_b
  Attempting uninstall: pkg_a
    Found existing installation: pkg_a 0.0.0
    Uninstalling pkg_a-0.0.0:
      Successfully uninstalled pkg_a-0.0.0
  Running setup.py develop for pkg_b
Successfully installed pkg_a-0.0.0 pkg_b

I'm guessing this has to with versioning but I don't know how to fix this. Any tips?



from Setup.py reinstalling already installed user-written package

No comments:

Post a Comment