Using private packages as dependencies

I have a python package released into Gitlab package registry, and it’s working perfectly fine. Now I want to use this as a dependency of another python package.

While I try to specify just the package name in setup.cfg, I am unable to install the new package as pip could not find the private package. I tried specifying the index URL in dependency_links, but in vain. Specifying the token directly in the same line as dependency works, but that means I can not commit setup.cfg which is not possible.

So, I want some guidance on how to use private package from Gitlab registries in other packages.

Note: More description can be found here.

We configure pip with an “extra index URL” wherever we want to install a package from out GitLab package repo. I recommend doing this via an environment variable, e.g. in your CI file or in a system config file, but you could also do it in a pip.conf file, e.g ./etc/pip.conf.

Our /etc/profile.d/pip.sh looks like this and allows all users of our Linux machines to install any of our packages with a simple pip install ....