0

I'm setting up a local PyPI repository on self-managed GitLab for wheels that cannot be made public. Pip is configured to look for wheels there. If not found, GitLab forwards request to global PyPI.

This can lead to distribution name conflicts, so I'd like to specify in pyproject.toml which dependency come from which PyPI. I think it's possible with Poetry, but I cannot find anything suitable in Setuptools documentation.

Do Setuptools support multiple PyPI indices?

sinoroc
  • 18,409
  • 2
  • 39
  • 70
badbishop
  • 1,281
  • 2
  • 18
  • 38
  • 1
    Sounds a bit cumbersome. Why not take the standard approach of just setting up an extra index in pip, then it will first search on pypi and then fallback to the gitlab registry if it can't find it there? – DeepSpace Nov 09 '22 at 11:59
  • 1
    setuptools is more of a build back-end. What you are asking for seems to me like it would be the responsibility of the installer (pip, etc.). Poetry is more of a development tool which has installer features and build back-end features and build front-end features. – sinoroc Nov 09 '22 at 11:59
  • 1
    If you upload packages that are on pypi to the gitlab registry as well and want to use the gitlab registry by default, simply set it to be the default index and the pypi index as the extra index. There is no need to define an index per individual package – DeepSpace Nov 09 '22 at 12:01
  • @DeepSpace I _do not intend_ to upload the same package to two indices. But if I've got a packege `foo` in local PyPI, and someone in the future decides to publish another package called `foo` in global PyPI, there will be a conflict. – badbishop Nov 10 '22 at 11:09
  • @DeepSpace setting `extra-index-url` in `pip.conf` is not a solution, since pip does not prioritize one index over another to my knowledge. So, setting `index-url` pointing to local PyPI is the only way to do it. So that local PyPI is the first priority, and global PyPI is a fall-back proxied by GitLab. – badbishop Nov 10 '22 at 11:15

0 Answers0