Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • libvirt-python libvirt-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5
    • Issues 5
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • libvirt
  • libvirt-pythonlibvirt-python
  • Merge requests
  • !9

Draft: Add PEP-484 type annotations to generator and code

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Philipp Hahn requested to merge pmhahn/libvirt-python:typing into master Jul 25, 2020
  • Overview 19
  • Commits 9
  • Pipelines 9
  • Changes 8

As I had to touch almost every line I took the opportunity to also cleanup the code, as this simplified the task: I used mypy and flake8 a lot during development and every warning was distracting me from getting the thing done.

While doing that I also stumbled over lots of smaller problems and even bugs; they are at the start of the queue so feel free to fast-track them by only merging them or cherry-picking them.

This addresses python/typeshed#4310 by adding the type information into the library instead of carrying them as as separate files in a separate project. If you want to use the for previous information, look at my typeshed for libvirt.

This task was already announced once at https://patchew.org/Libvirt/cover.1587993402.git.hahn@univention.de/, which becomes obsolete with the pull-request.

  • there are some TODOs in c3b26fcc
  • maybe also create *.pyi stubs for libvirtmod*.so
  • extend libvirt-api.xml to return more specific Python types like List[int] - see comments
  • verify that my type annotations matches the actual returned data by calling each function from some (manually generated?) unit test file
Edited Jul 27, 2020 by Philipp Hahn
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: typing