rye icon indicating copy to clipboard operation
rye copied to clipboard

Specifying index-url / Private Indexes

Open pshashk opened this issue 1 year ago • 7 comments

Is it possible to specify --index-url when adding a dependency to a project?

pshashk avatar Apr 25 '23 09:04 pshashk

It used to be, it is not in the version on github. Now that I also use this version and not my own one, I want to incorporate that functionality back but I never really liked how that worked.

Because of how pip installs stuff it's very hard to pin dependencies to a specific index which is what I wanted to actually achieve originally. I'm up for suggestions of how this can be accomplished best with the current state of pip.

mitsuhiko avatar Apr 25 '23 09:04 mitsuhiko

The current state of affairs in the pip world is pretty bad :(

  • https://github.com/pypa/pip/issues/8606
  • https://github.com/python-poetry/poetry/issues/6713

mitsuhiko avatar Apr 25 '23 11:04 mitsuhiko

The current state of affairs in the pip world is pretty bad :(

  • https://github.com/pypa/pip/issues/8606
  • https://github.com/python-poetry/poetry/issues/6713

Only pdm solves that properly

ryukinix avatar Apr 26 '23 02:04 ryukinix

Pipenv also solves this properly https://pipenv.pypa.io/en/latest/pipfile/#example-pipfile-lock

There is no PEP for this though.

kabouzeid avatar Apr 26 '23 13:04 kabouzeid

Actually there is a draft pep for this, someone in pip project issue about that shared with me

End users of pip will be given the ability to explicitly define one or more repositories that are valid for a specific project, causing pip to only consider those repositories for that project, and avoiding generating an error altogether

https://peps.python.org/pep-0708/#what-is-changing

🙏

ryukinix avatar Apr 26 '23 21:04 ryukinix

So if I read this correctly it will still consult both of them but error if it finds it in more than one. That's I guess better than nothing but quite unfortunate behavior. I much prefer what pdm does here.

mitsuhiko avatar Apr 26 '23 21:04 mitsuhiko

Apparently in the original proposal there was a "repository file" that would let the end user specify the exact repository to pull a dependency from. This was "handwaved away" so I guess package managers will be expected to decide on how they want to do this themselves.

https://docs.google.com/document/d/184fQkb6NggVQfYmjTDA7p_U3iWDKk6grc2DigT1X3Es/edit

mwarkentin avatar Apr 27 '23 00:04 mwarkentin

Any update for this feature? stucked using private pypi.

futurist avatar May 18 '23 04:05 futurist

@futurist I'm currently considering adding a temporary hack in to unblock basic uses.

mitsuhiko avatar May 18 '23 10:05 mitsuhiko

would be great, especially for pytorch where this is super common.

kabouzeid avatar May 18 '23 14:05 kabouzeid