Group level PyPI registry API endpoints missing on EE v14.0.5

We are trying to use the group PyPI package registry recently introduced in GitLab v14, but we are unable to get the API to work. Following the endpoints listed in the related documentation yields 404 not found errors when trying to publish (or retrieve) packages from the group PyPI registry. Publishing to and downloading from projects’ registries works just fine, however, and I am able to view the packages published to projects in a group via https://gitlab.example.com/api/v4/group/<group id>/packages.

In other words, the following works:

$ twine upload --repository-url https://gitlab.example.com/api/v4/projects/<project id>/packages/pypi somepackage.tar.gz
$ curl https://gitlab.example.com/api/v4/projects/<project id>/packages/pypi/simple/somepackage
$ curl https://gitlab.example.com/api/v4/group/<group id>/packages

The following yield 404 errors:

$ twine upload --repository-url https://gitlab.example.com/api/v4/groups/<group id>/-/packages/pypi somepackage.tar.gz
$ twine upload --repository-url https://gitlab.example.com/api/v4/groups/<group id>/packages/pypi somepackage.tar.gz
$ curl https://gitlab.example.com/api/v4/groups/<group id>/packages/pypi/simple/somepackage
$ curl https://gitlab.example.com/api/v4/groups/<group id>/-/packages/pypi/simple/somepackage

This was attempted both from a CI job with a CI job token and manually with an Owner account’s personal access token with read/write API permissions with the same results.

Is there something we are missing when trying to use group level PyPI registries? It seems like the API is still on an older version even though GitLab (Ubuntu Omnibus installation) was updated to v14.

$ curl https://gitlab.example.com/api/v4/version
{
  "version": "14.0.5-ee",
  "revision": "b044f06e4dd"
}

Thanks for your help!

2 Likes

I have the same problem in version 13.6.1-ee

Hi, any news on this?

I wasted way too much time on this, but the documentation clearly says:
“You cannot publish PyPI packages to a group, only to a project.”
(PyPI packages in the Package Registry | GitLab)

The following works for me (14.7.2-ee):

Given a group <group_id> containing a project <project_id>, I can publish via:

twine upload --repository-url https://gitlab.example.com/api/v4/projects/<project_id>/packages/pypi dist/*

And access the package via

curl https://gitlab.example.com/api/v4/groups/<group_id>/-/packages/pypi/simple/somepackage
1 Like