title: pip - specify download version based on available library version
body: <p>I'm developing a Python package <code>my_package</code> that depends upon some other package <code>foo_package</code>.</p>
  
  <p>There's a few versions of <code>foo_package</code> that are used in the community, and unfortunately they're not backwards compatible with each other. (Because of changes to the C interface that my code is compiled against).</p>
  
  <p>So I'd like to distribute multiple copies of <code>my_package</code>, corresponding to the different versions of <code>foo_package</code>.</p>
  
  <p>I can distinguish these different copies of <code>my_package</code> from each other using post-release tags. For example I can give <code>my_package</code> the version <code>1.1.4-foo_package1.2</code>, corresponding to version <code>1.1.4</code> of <code>my_package</code> compiled against version <code>1.2</code> of <code>foo_package</code>.</p>
  
  <p>So far so good. The caveat now is that when it comes to installing this with <code>pip</code>, end users have to specify this full version string to be able to get the correct version of <code>my_package</code>. That is, they have to know that the latest release of <code>my_package</code> is <code>1.1.4</code> and that the release of <code>foo_package</code> that they're using is <code>1.2</code> and thus use the command <code>pip install my_package==1.1.4-foo_package1.2</code>.</p>
  
  <p>Obviously this isn't ideal for all sorts of reasons. (End user friendliness, avoiding dependency hell... ) After all, all of this can be determined programmatically!</p>
  
  <p>Is there any sensible way to handle this issue, so that an end user can just run <code>pip install my_package</code> and have the correct copy downloaded automatically?</p>
  
  <p>There is one unsatisfactory answer to a similar question <a href="https://stackoverflow.com/questions/54192273/pip-requirement-based-on-available-os-library-version">here</a>.</p>
  
  <p>FWIW the best solution I've come up with so far is to create another package <code>my_package_installer</code> which as part of its <code>setup.py</code> checks what version of <code>foo_package</code> is installed and then specifies the relevant version of <code>my_package</code> as the <code>install_requires</code> argument to <code>setuptools.setup</code>. But that's completely asinine and seems quite fragile. I can't be the only one with this issue.</p>