2

I am trying to create a python package that depends on another package hosted in a private repo. The setup.py looks like this:

setup( name="parasol", version="2.18.1", ... install_requires=[ ... "pyGSO @ git+https://dev.azure.com/.../pyGSO@Main", ], ) 

This works fine. Unfortunately, I now need to install it in an environment which has no access to the private repo. To work around that I am installing pyGSO manually in a separate build step, and then running this. But of course, as soon as it gets to the pyGSO requirement here it fails since it has no access to check the repo. What can I do?

Ideas I had, if anyone knows how to implement them:

  • Add a minimum version indicator to the requirement, so that if I manually install a newer version it won't try to access the unavailable repo
  • Somehow have it skip this dependency if it already is installed
2
  • Does this answer help you? You can change your dependency to the file you have available locally. Commented Nov 16, 2021 at 21:17
  • Unfortunately not. All other users will still need to have the repo link in the install_requires for them to install it normally, so I can't replace it with a local link. If I could, I would just omit pyGSO from the install_requires since I am already manually installing the dependency :) Commented Nov 16, 2021 at 21:28

1 Answer 1

1

You can tell setup.py to not add the dependency with an environment variable:

import os NO_PYGSO = os.getenv("PARASOL_NO_PYGSO") dependencies = [...] if NO_PYGSO is None: dependencies.append("pyGSO @ git+https://dev.azure.com/.../pyGSO@Main") setup( name="parasol", version="2.18.1", ... install_requires=dependencies, ) 

Then before installing in your environment without access to the repo, you do export PARASOL_NO_PYGSO=true (or equivalent for your shell, in case it's not bash).

Sign up to request clarification or add additional context in comments.

2 Comments

That's a great solution! I wish there was some way that I could tell pip directly to ignore this, but if that's not an option then this is a great workaround.
Nice, happy that this works for you. Please mark the answer as accepted, if it solved the problem.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.