- Notifications
You must be signed in to change notification settings - Fork673
Description
Description of the problem
In the gitlabform app (https://github.com/gitlabform/gitlabform), and probably for many other purposes too, we always want to get all the elements of lists.
Current solution
There seem to be 2 options for that when using this library:
a) remember to useget_all=True
and probably cause with increased resources use on the GitLab instance,
b) remember to useiterator=True
and add extra code to get all the elements of the list,
Both of these require extra code that you need to remember about (because the missing parameter will not cause an error unless you test with lists of > 20 elements) and are inconvenient.
We already had 2 bugs in gitlabform because we forgot to add this code:
- Processing group fails if it has more than 20 members gitlabform/gitlabform#732 , PR:fix: iterates through group members gitlabform/gitlabform#735
- fix: process all schedules and not only the first 20 gitlabform/gitlabform#731
Proposed solution
Let's introduce a global configuration flag to get all the elements of each list by default.
We could name this flagget_all_by_default
and pass it to the constructor (like the "pagination" parameter now).
This could be implemented with iterators to not cause an extra load in the GitLab instance. The execution time or resource use on the client side is less important here as this would probably be used for scripting, batch operations and generally non-interactive purposes.
Specifications
- python-gitlab version: v4.4.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): doesn't matter