Registry / type-stubs / types-markdown

types-markdown

JSON →
library3.10.2.20260712pypypi✓ verified 26d ago

types-markdown is a type stub package that provides static type annotations for the popular `markdown` library (Python-Markdown). It enables static type checkers like MyPy to validate code that uses the `markdown` library, improving code quality and catching potential errors before runtime. This package is automatically generated and released from the `typeshed` project and follows a versioning scheme tied to the `markdown` runtime library version.

pip install types-markdown
INSTALL
IMPORT
SIG · TYPES-MARKDOWN
T
types-markdown
type-stubspythonv3.10.2.20260712
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.10.2.20260712 · 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.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

markdown-stubs
import markdown_stubs
import markdown-stubs

This quickstart demonstrates how to use the `markdown` library with the `types-markdown` stubs implicitly providing type hints. The `TYPE_CHECKING` block shows how type checkers benefit from the stubs, ensuring correct usage of the `markdown` library's API.

import markdown from typing import TYPE_CHECKING # The actual Markdown library is imported for runtime use # types-markdown provides the type hints for this 'markdown' module markdown_text = """ # Hello, Markdown! This is a **bold** paragraph with an [inline link](https://example.com). - List item 1 - List item 2 """ # Convert Markdown to HTML html_output: str = markdown.markdown(markdown_text) print(html_output) if TYPE_CHECKING: # Example of type checking a function from the markdown library # This part only runs during type checking, not runtime from markdown import Markdown md_parser: Markdown = markdown.Markdown(extensions=['fenced_code']) typed_html: str = md_parser.convert(markdown_text) # The type checker would ensure 'convert' returns a string and 'Markdown' is correctly instantiated
Debug
Known issues
gotchaThe `types-markdown` package contains only type stub files (`.pyi`) and no runtime code. You must install the actual `markdown` library (e.g., `pip install markdown`) to use its functionality. `types-markdown` is solely for static type checking.
fix
Ensure both `markdown` and `types-markdown` are installed in your environment: `pip install markdown types-markdown`.
affects: All versions
breakingStub packages, including `types-markdown`, can introduce 'breaking changes' for type checkers even if the runtime library's API remains stable. This can happen due to stricter or more accurate types being added or corrected in `typeshed`, potentially revealing previously uncaught type errors in your codebase.
fix
Review type checker errors after updating `types-markdown`. If encountering new errors, you may need to adjust your code to satisfy the more accurate type hints or temporarily pin to an older `types-markdown` version while addressing the issues. Typeshed provides versioning recommendations for stubs.
affects: All versions
gotchaThe versioning for `types-markdown` (e.g., `3.10.2.20260211`) indicates compatibility with the runtime `markdown` library. The `3.10.2` portion refers to the target runtime version (`markdown==3.10.2.*`), and the trailing date (`20260211`) is the stub's release date from Typeshed. For critical applications, consider pinning the stub package to a known good version.
fix
When managing dependencies, be explicit about the `types-markdown` version if you need to guarantee consistent type checking behavior, e.g., `types-markdown==3.10.2.20260211`.
affects: All versions
Upgrade
Version history
3.10.2.20260712latest on PyPI · released Jul 12, 2026
Audit
Dependencies
markdownrequiredThis package provides type stubs for the 'markdown' runtime library. The 'markdown' library itself must be installed and used for any runtime functionality.
Agent activity
43 hits · last 30 days
node
40
OpenAI (training)
1
Resources
types-markdown — pip install types-markdown · libregistry