CLI ignores end points that don't define managed RESTObject #3112
Description
Activity
igorp-collabora commented
on Jan 30, 2025 ContributorAuthorMore actionsThe current parsing is incredible complicated and converts class names to string and then uses
getattron thegitlab.v4.objects. This means it is impossible to have a RESTManager not usingf"{_obj_cls.__name__}Manager"name.My plan is to rework how the CLI discovers end points to eliminate the conversions to strings. By iterating over
gitlab.v4.objectmodule it is possible findRESTManagersubclasses. This assumes that there are no danglingRESTObjectswithout managers but I think such classes would fail because CLI doesgetattr(gitlab.v4.objects, f"{self.cls.__name__}Manager").To implement the
@cli.register_custom_actionI would make this decorator keep a set of all functions passed to it. The CLI parser would useinspect.getmembers()on theRESTManagerclasses and check if any of the member functions are part of custom cli action set. This eliminates the need forcls_names=argument.igorp-collabora commented
on Jan 31, 2025 ContributorAuthorMore actions@nejch I experimented more with a discovery rewrite and there is another big issue I encountered. The RESTManager class and the RESTObject can have conflicting custom actions.
For example,
GeoNodeManagerandGeoNodeboth have astatusaction. This creates a few conflicts on the required arguments as calling it from the manager does not require any id but calling it from object does. Also return types are different. The manager returns list of dictionaries but object returns a single dict.Not sure how to handle this. The current behaviour is to mash everything together which might make certain API point unaccessible.
igorp-collabora commented
on Jan 31, 2025 ContributorAuthorMore actionsAfter contemplating I think I will make it only register one action per action name per manager. This eliminates any conflict but will make the manager methods shadow the object methods.
Sorry for the delay @igorp-collabora, will have to read up on this a bit as I haven't touched the CLI in a while 😅
This issue was marked stale because it has been open 60 days with no activity. Please remove the stale label or comment on this issue. Otherwise, it will be closed in 15 days.
As an open-source project, we rely on community contributions to address many of the reported issues. Without a proposed fix or active work towards a solution it is our policy to close inactive issues. This is documented in CONTRIBUTING.rst
How to keep this issue open: * If you are still experiencing this issue and are willing to investigate a fix, please comment and let us know. * If you (or someone else) can propose a pull request with a solution, that would be fantastic. * Any significant update or active discussion indicating progress will also prevent closure.
We value your input. If you can help provide a fix, we'd be happy to keep this issue open and support your efforts.This issue was closed because it has been marked stale for 15 days
with no activity.This open-source project relies on community contributions, and
while we value all feedback, we have a limited capacity to address
every issue without a clear path forward.Currently, this issue hasn't received a proposed fix, and there
hasn't been recent active discussion indicating someone is planning
to work on it. To maintain a manageable backlog and focus our
efforts, we will be closing this issue for now.This doesn't mean the issue isn't valid or important. If you or
anyone else in the community is willing to investigate and propose
a solution (e.g., by submitting a pull request), please do.We believe that those who feel a bug is important enough to fix
should ideally be part of the solution. Your contributions are
highly welcome.Thank you for your understanding and potential future
contributions.This is documented in CONTRIBUTING.rst
https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst- locked as resolved and limited conversation to collaborators
on Jul 13, 2026
Description of the problem, including code/CLI snippet
Certain end points like SideKiq are skipped by CLI parser because they don't manage any objects. This is because only RESTManager classes that defined the
_obj_clsattribute are parsed for the endpoints.I described this behaviour here: #3083 (comment)
Expected Behavior
All endpoints with managers are accessible.
Actual Behavior
Missing endpoints:
group-registry-repository:/groups/{group_id}/registry/repositoriesproject-audit:/projects/{project_id}/audit_eventsproject-iteration:/projects/{project_id}/iterationssidekiq: Noneuser-identity-provider:/users/{user_id}/identitiesThis list is made by taking a diff between current main branch
python -m gitlab --helpand my quick experiment of adding all RESTManagers to the CLI parser.