Registry / type-stubs / types-reportlab

types-reportlab

JSON →
library4.5.1.20260827pypypi✓ verified 22d ago

types-reportlab provides static type checking annotations for the ReportLab library, enabling IDEs and type checkers (like Mypy or Pyright) to offer better autocompletion, error detection, and code understanding. It is part of the typeshed project, which collects high-quality type stubs for various Python packages. The current version, 4.4.10.20260408, aims to provide accurate annotations for reportlab==4.4.10 and is regularly updated as part of the typeshed release cycle, often reflecting changes in the upstream ReportLab library.

pip install types-reportlab
INSTALL
IMPORT
SIG · TYPES-REPORTLAB
T
types-reportlab
type-stubspythonv4.5.1.20260827
Install
2.3s avg
Import
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.5.1.20260827 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.3s · import 0.000s · 19MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Canvas
from reportlab_stubs.pdfgen.canvas import Canvas
from reportlab.pdfgen.canvas import Canvas

This quickstart demonstrates how to create a basic PDF document using ReportLab's PLATYPUS API, with explicit type hints that `types-reportlab` would validate. Remember that `reportlab` itself must be installed for this code to run.

from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.pagesizes import letter from typing import List def generate_simple_pdf(filename: str, title_text: str, paragraph_content: str) -> None: """Generates a simple PDF document using ReportLab with type hints.""" doc: SimpleDocTemplate = SimpleDocTemplate(filename, pagesize=letter) story: List[Any] = [] # Use Any for flowables for simplicity here styles = getSampleStyleSheet() # Add a title title_style = styles['h1'] title: Paragraph = Paragraph(title_text, title_style) story.append(title) story.append(Spacer(1, 0.2 * inch)) # type: ignore # Add a paragraph body_style = styles['Normal'] paragraph: Paragraph = Paragraph(paragraph_content, body_style) story.append(paragraph) doc.build(story) print(f"PDF '{filename}' generated successfully.") if __name__ == "__main__": from reportlab.lib.units import inch # type: ignore generate_simple_pdf( "hello_typed_report.pdf", "My Typed ReportLab Document", "This is a sample paragraph for a PDF generated using ReportLab, " "with type checking enhanced by types-reportlab stubs." )
Debug
Known issues
gotchaInstalling `types-reportlab` alone does NOT provide runtime functionality. It only provides type annotations. You must install the actual `reportlab` library (and its dependencies like `Pillow` for images) separately for your code to execute.
fix
Ensure `pip install reportlab` (and optionally `pip install Pillow`) is run in your environment alongside `pip install types-reportlab`.
affects: All versions
gotchaType checking failures may occur if the version of `types-reportlab` does not align with your installed `reportlab` version. `types-reportlab` versions are specifically tailored to a corresponding `reportlab` version (e.g., `4.4.10.20260408` targets `reportlab==4.4.10`).
fix
Match the `types-reportlab` stub version as closely as possible to your `reportlab` runtime version. Consider using version specifiers in your `requirements.txt` (e.g., `types-reportlab~=4.4.10`).
affects: All versions
breakingWhile stub packages themselves don't typically 'break' runtime code, updates to `typeshed` stubs can introduce stricter type checking rules or corrections that might cause existing code to fail type checking, even if the runtime behavior of `reportlab` hasn't changed.
fix
Address new type checker errors by adjusting your code to conform to the corrected type hints, or temporarily pin the `types-reportlab` version if immediate changes are not feasible.
affects: All versions (with typeshed updates)
gotchaReportLab's documentation can sometimes be challenging to navigate, with some examples considered outdated or incomplete by community members, leading to difficulties in finding specific patterns or features.
fix
Consult community resources, blog posts, and thoroughly explore the ReportLab API reference and source code for deeper understanding beyond the official user guide. Experimentation with `dir()` and an interactive debugger (`ipdb`) can also be helpful.
affects: All versions
Upgrade
Version history
4.5.1.20260827latest on PyPI · released Aug 27, 2026
Audit
Dependencies
reportlabrequiredProvides the runtime functionality for which these stubs offer type hints. types-reportlab targets reportlab==4.4.10.
PillowoptionalReportLab uses Pillow for image handling.
pythonrequiredRequired Python version.
Agent activity
35 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources
types-reportlab — pip install types-reportlab · libregistry