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.dev1

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.dev1
File Size Uploaded
qgis_stubs-1.0.0.dev1.tar.gz 774.4 kB Details

Built distribution (wheel)

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

Total release size: 1.6 MB

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

Download URL qgis_stubs-1.0.0.dev1.tar.gz
Size 774.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d1c36641dfc1b58b5ec1fe8f8945118dd1bc5f24482c94ff035366678ad67030
BLAKE2b-256 checksum
How to use checksums
4f94de1c1d06bdd4340ccf4d3e007880b4556056f00508edfbcbcbf9bcbf2aa7
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 Oct 4, 2026.

Transparency log

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

Download URL qgis_stubs-1.0.0.dev1-py3-none-any.whl
Size 802.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8945ca5b7d3a06c93054f78121b4ed00aa3627dc17d978c35af921ef6f2a85c
BLAKE2b-256 checksum
How to use checksums
a9bbfa28d2732daac85860f4618b18ce6daf829d2acbd26707da35d81ff2e74f
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 Oct 4, 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