Skip to content

Client get_projects/list_projects does not retrieve all projects #687

@andrewbapham

Description

@andrewbapham

Versions:

$ pip freeze | grep label
label-studio==1.21.0
label-studio-sdk==2.0.4

When calling get_projects/list_projects, the result will only fetch a maximum of 100 projects, even though the docstrings indicate they should list ALL projects in Label Studio. This also seems to affect manual requests to the /api/projects endpoint when trying to up the page_size.

The following snippet prints out the following output:

from label_studio_sdk import Client
def main():
    projects = LS_CLIENT.list_projects()
    print("get_projects length:", len(projects))

    manual = LS_CLIENT.make_request("GET", "/api/projects", params={'page_size': 500})
    res = manual.json()
    print('manual request length', len(res['results']))
    print('count:', res['count'])
~$ python script.py 
get_projects length: 100
manual request length 100
count: 201

There seemed to have been a similar issue previously with tasks (label-studio #1908) that was solved with #31. Perhaps a paginated request solution is needed for projects as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions