Registry / type-stubs / openpyxl-stubs

openpyxl-stubs

JSON →
library0.1.25pypypi✓ verified 23d ago

openpyxl-stubs provides type stubs for the openpyxl library, enabling static type checking with tools like MyPy. The current version is 0.1.25, released in January 2023, and it is currently in an alpha development status. It does not have a defined release cadence, as it is a stub package that augments the `openpyxl` library.

pip install openpyxl-stubs openpyxl
INSTALL
IMPORT
SIG · OPENPYXL-STUBS
O
openpyxl-stubs
type-stubspythonv0.1.25
Install
3.9s avg
Import
320ms
Disk
83MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.25 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.336s · 85.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.304s · 83MB
83MB installed
● package 83MB
Code
Verified usage

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

Workbook
from openpyxl import Workbook
Type stubs are automatically picked up by type checkers when `openpyxl-stubs` is installed. You import directly from `openpyxl`.
Worksheet
from openpyxl.worksheet.worksheet import Worksheet
Type stubs are automatically picked up by type checkers when `openpyxl-stubs` is installed. You import directly from `openpyxl`.

This example demonstrates basic usage of openpyxl with type annotations. When `openpyxl-stubs` is installed, a type checker like MyPy will use its definitions to validate these operations. Note that `wb.active` might require a `# type: ignore` if the type checker has difficulty inferring `Worksheet` due to the dynamic nature of `active` property in some contexts without explicit stubs for that specific assignment, or if the stub is incomplete for that specific case. The actual save operation is commented out for quickstart runnability without file system interaction.

from openpyxl import Workbook from openpyxl.worksheet.worksheet import Worksheet # Create a new workbook with type hints wb: Workbook = Workbook() # Grab the active worksheet with type hints ws: Worksheet = wb.active # type: ignore # Data can be assigned directly to cells ws['A1'] = 42 # Rows can also be appended ws.append([1, 2, 3]) # Python types will automatically be converted (example with a datetime object) import datetime ws['A2'] = datetime.datetime.now() # Save the file # In a real scenario, you'd use a temporary file or a specific path. # For this example, we'll just show the save operation. # wb.save("sample.xlsx") print("Workbook operations with type hints (stubs installed).")
Debug
Known issues
deprecatedThe `openpyxl-stubs` project has not been updated since January 2023 and is marked as '3 - Alpha' development status. It may not provide complete or accurate type coverage for recent versions of `openpyxl`.
fix
For up-to-date and more actively maintained type stubs for `openpyxl`, consider using `types-openpyxl` from the `typeshed` project, which is frequently updated and tracks newer `openpyxl` versions. Install with `pip install types-openpyxl`.
affects: <=0.1.25
gotchaDue to its alpha status and infrequent updates, `openpyxl-stubs` might have missing modules, deprecated modules, or issues in annotations (e.g., missing parameter/return type annotations) compared to the actual `openpyxl` library.
fix
If you encounter type checking errors that seem incorrect or missing types, you may need to add `# type: ignore` comments or consider contributing fixes to the `openpyxl-stubs` repository. Switching to `types-openpyxl` is also recommended for better coverage.
affects: <=0.1.25
gotchaInstallation of `openpyxl-stubs` alone does not provide the `openpyxl` functionality. It only provides type hints. You must install `openpyxl` separately.
fix
Ensure both `openpyxl` and `openpyxl-stubs` are installed: `pip install openpyxl openpyxl-stubs`.
affects: all
Upgrade
Version history
0.1.25latest on PyPI · released Jan 12, 2023
Audit
Dependencies
openpyxlrequiredProvides type stubs for this library.
Agent activity
21 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
openpyxl-stubs — pip install openpyxl-stubs · libregistry