FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Lack of typing info · Issue #1588 · python-gitlab/python-gitlab · GitHub

Repository navigation

Lack of typing info #1588

Description

Hi, while using the library I've noticed some lack of typing info.

Given the following code in a file called gl.py:

from gitlab import Gitlab
from gitlab.v4.objects import CurrentUser

def get_current_user(gl: Gitlab) -> CurrentUser:
    gl.auth()
    return gl.user

def get_project(gl: Gitlab, name: str) -> str:
    return gl.projects.get(name).path

def get_user(gl: Gitlab, name: str) -> str:
    return gl.users.list(username=name)[0].username

def get_group(gl: Gitlab, name: str) -> str:
    return gl.groups.get(name).path

if __name__ == '__main__':
    gl = Gitlab('https://gitlab.com', private_token='xxx')
    user = get_current_user(gl)
    print(user.username)
    print(get_project(gl, "gitlab-org/gitlab"))
    print(get_user(gl, "dAnjou"))
    print(get_group(gl, "gitlab-org"))

The command mypy --strict gl.py returns a few errors:

gl.py:1: error: Module "gitlab" does not explicitly export attribute "Gitlab"; implicit reexport disabled
gl.py:2: error: Module "gitlab.v4.objects" does not explicitly export attribute "CurrentUser"; implicit reexport disabled
gl.py:11: error: Returning Any from function declared to return "str"
gl.py:15: error: Returning Any from function declared to return "str"
gl.py:19: error: Returning Any from function declared to return "str"
Found 5 errors in 1 file (checked 1 source file)
  • python-gitlab==2.10.1
  • default API version 4 on gitlab.com

Activity

  1. nejch commented on Sep 6, 2021

    Member

    Yes, typing is still a work in progress across the entire library. Only a few modules are covered at the moment. @JohnVillalovos the first two just need a fix in __all__ I assume, but for the rest I guess it'll need to wait until typing is finished, right?

  2. locked as resolved and limited conversation to collaborators on Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL