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

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.dev2
File Size Uploaded Provenance Actions
qgis_stubs-1.0.0.dev2.tar.gz 774.7 kB With provenance Details for qgis_stubs-1.0.0.dev2.tar.gz

Built distribution (wheel)

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

Total release size: 1.6 MB

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

Download URL qgis_stubs-1.0.0.dev2.tar.gz
Size 774.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8f19513e1d6f12ca2b0ee0f9a7724dc33ca58e4cfa34814f6f453d6687a8f97e
BLAKE2b-256 checksum
How to use checksums
695eb8f0b5dd86930db1b72bf7de6c893156b396292ad613f47c7000f6885bc7
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 10, 2026.

Transparency log

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

Download URL qgis_stubs-1.0.0.dev2-py3-none-any.whl
Size 802.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce4422d43fbe3bda04b1632318491bc59f8d44084b759ffd04ea13dfcd431d3c
BLAKE2b-256 checksum
How to use checksums
19b26c7a799a185f31cbefbecc03b64d577b11818d170ee557f833cb458bfff4
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 10, 2026.

Transparency log

Security for qgis-stubs 1.0.0.dev2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qgis_stubs-1.0.0.dev2.tar.gz

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 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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