I'm attempting to following the API example here, but it fails because apparently there is no ProjectReleaseManager
on my project.
>>> gl.api_version
'4'
>>> gl_project = gl.projects.get("atlas/athena")
>>> gl_project.issues.list()
[]
>>> release = gl_project.releases.list()
Traceback (most recent call last):
File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/gitlab/1.4.0-python2.7-x86_64-slc6-gcc62/python_gitlab-1.4.0/lib/python2.7/site-packages/gitlab/base.py", line 582, in __getattr__
return self.__dict__['_updated_attrs'][name]
KeyError: 'releases'
(It's fine that issues returns an empty list - we have them turned off in our project, but I can successfully retrieve merge requests without problem)
Does anyone know why I do not have releases
? Is there something I can do about it? (I'd like to be able to create a release from a script)
Thanks!
Looking at the logs, you're running an extremely old version of python-gitlab (1.4.0), likely installed via your OS package manager.
You'll need to install a later version (support for the releases API was added in 1.9.0), ideally in a virtual environment to keep it isolated. For example, assuming you have python3 installed, you can run this to install the latest version with a virtual environment in your current directory:
python3 -m venv .venv
. .venv/bin/activate
pip install python-gitlab
Note that you'll need to activate the virtual environment when running your scripts - see more at https://docs.python.org/3/library/venv.html.