Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Type Stubs for QGIS

Python stubs for the PyQGIS module used in QGIS. Compatible with and tested on Pylance/pyright and MyPy.

Overview

The bulk of the qgis module is a SIP-generated wrapper over a C++ source that is only available at runtime. This means that developers are "flying blind" when writing code that uses the qgis module.

Type stubs are a declaration-only replication of the module interface that can be parsed by IDEs, linters, or static type checkers like Mypy or Pylance to provide the same functionality available for regular Python sources.

Installation

The qgis-stubs package can be installed through pip:

python -m pip install qgis-stubs

Alternatively, you may clone and install the latest version using the repository link:

python -m pip install git+https://github.com/leonhard-s/qgis-stubs.git

Caveats & Limitations

The Python modules used by QGIS are not without issues. Most of these are shared by the runtime implementation but are explicitly listed here to avoid confusion.

  • The qgis.3d namespace is not valid Python syntax as it starts with a number. At runtime, this module is instead available under the qgis._3d name, and the stub files replicate this behaviour.

    This may lead to errors/warnings due to apparent protected access of client code, which must be silenced using # type: ignore and/or # pylint: disable=protected-access comments.

  • Some classes use None as the name of a member, leading to invalid Python syntax such as DataResamplingMethod.None.

    Use of the built-in getattr() function together with custom type annotations can be used to work around this issue:

    None_: DataResamplingMethod = getattr(DataResamplingMethod, 'None')
    

Contributing

This repository contains an automated type stub extraction workflow and fixup scripts, but new releases still require some manual edits depending on the version of QGIS targeted. Support for new QGIS versions is therefore not automatic.

If you encounter any issues such as missing or incorrect type hints or wish for this utility to be updated for a new version of QGIS, please do create an issue.

Metadata

Release files for qgis-stubs 1.0.0.dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qgis-stubs 1.0.0.dev0
File Size Uploaded
qgis_stubs-1.0.0.dev0.tar.gz 772.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qgis-stubs 1.0.0.dev0
File Interpreter ABI Platform
qgis_stubs-1.0.0.dev0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / qgis_stubs-1.0.0.dev0.tar.gz

Download URL qgis_stubs-1.0.0.dev0.tar.gz
Size 772.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4782ed8db4caf73e0d7f96d5f1a68969f5ae48c4282538a1362e46e1eb6d6784
BLAKE2b-256 checksum
How to use checksums
650894b6c48c8ce657dc329a3dd4d63d28a42103bd411e5c0f3a2b04c488500f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / qgis_stubs-1.0.0.dev0-py3-none-any.whl

Download URL qgis_stubs-1.0.0.dev0-py3-none-any.whl
Size 792.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
061f472b327d9a8701e4402f243dadc8619d25e7c1844825dec144a1b9bc090f
BLAKE2b-256 checksum
How to use checksums
d9cb43fd9427b07ce687ddccdd1f0e63bcd0faa72e8b358d08f3eea252efaec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page