Inside a pipeline, how to install Python package that has a dependency without any PyPI

One of my company’s teams doesn’t want to use GitLab’s package repository. Instead, they install Python packages directly from Git (see example below).

(test) me@machine:~$ pip install ourpackage@git+
Collecting ourpackage@ git+
  Cloning (to revision main) to /tmp/pip-install-pdutqfvy/ourpackage_d3dbe93f0469494daac950f94b133ce6
  Running command git clone --filter=blob:none --quiet /tmp/pip-install-pdutqfvy/ourpackage_d3dbe93f0469494daac950f94b133ce6
  Resolved to commit a2b578ccedf4cc81942152d29714ebedf0cc4604
  Preparing metadata ( ... done
Collecting ourpackagedependency
  Downloading ourpackagedependency-1.0.0-py2.py3-none-any.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.5/100.5 KB 5.5 MB/s eta 0:00:00
Using legacy ' install' for ourpackage, since package 'wheel' is not installed.
Installing collected packages: ourpackagedependency, ourpackage
  Running install for ourpackage ... done
Successfully installed ourpackage-1.0 ourpackagedependency-2.0.2

We have another package, let’s call it anotherpackage, that has ourpackage as a dependency. Here’s a simplified setup.cfg for anotherpackage.

name = anotherpackage

include_package_data = True
install_requires =
    ourpackage @ git+
package_dir =
    = src
packages = find_namespace:
zip_safe = False

exclude =
where = src

You can do pip install . in the root dir of anotherpackage, and it works. The user gets a prompt for their GitLab credentials, and that’s okay for local development work. You can use git config credential.helper store to avoid the prompt.

However, none of this works in a GitLab pipeline that builds anotherpackage. I tried many different things, but no luck so far. Does anyone know how to make this work without using GitLab’s package repository?

How about going completely git with the dependency and include it as a git submodule?

As soon as you set

# all submodules need to be downloaded

In the yml you are good to go then.

1 Like