pycomtypelib
A pure-Python, cross-platform decoder for the MSFT COM type library binary
format (.tlb files, and RT_TYPELIB resources embedded in .dll / .ocx /
.exe files). No Windows, no COM, no oleaut32.dll required.
This is a Python port of the type library reading logic in
Wine's dlls/oleaut32/typelib.c
and typelib.h, cross-checked against public documentation of the format
(notably Geoff Chappell's notes on ITypeLib).
Only the MSFT format is supported (the format produced by ICreateTypeLib2
/ MIDL and used by essentially all modern type libraries); the older SLTG
format (ICreateTypeLib, legacy VB5/VB6) is out of scope.
Wine's typelib.c is licensed LGPL-2.1-or-later; this project inherits that
license since its parsing logic is derived from it.
Install
pip install -e .
Library usage
from pycomtypelib import load_typelib_file
tlb = load_typelib_file("stdole2.tlb")
print(tlb.name, tlb.guid, tlb.version)
for ti in tlb.typeinfos:
print(ti.typekind.name, ti.name)
To pull a type library out of a compiled binary (DLL/OCX/EXE) instead of a
standalone .tlb file:
from pycomtypelib import load_typelib_from_pe
tlb = load_typelib_from_pe("MSCOMCTL.OCX")
CLI
pycomtypelib dump stdole2.tlb
pycomtypelib dump MSCOMCTL.OCX --json > mscomctl.json
Cross-library references (e.g. an interface inheriting from IUnknown or
IDispatch, which live in stdole2.tlb) can't be resolved to a full
TypeInfo without also parsing the imported library, so by default they're
shown by name via a small built-in table of well-known COM/OLE Automation
interface GUIDs (pycomtypelib.WELL_KNOWN_INTERFACES). Pass -n /
--no-wellknown-guids to disable that and show the raw GUID and import
library name instead:
pycomtypelib dump -n stdole2.tlb
This only affects display (--json's wellknown_name field, and the IDL-like
text renderer); it never affects decoding itself.
Scope
- Reads the MSFT binary layout: header, segment directory, GUID/name/string
tables, type descriptors, array descriptors, per-
TypeInfofunction/variable/ implemented-type records, imported type libraries, and custom data. - Resolves this into a friendly object model (
TypeLib,TypeInfo,FuncDesc,VarDesc,ParamDesc,TypeDesc, ...) analogous to whatITypeInfoexposes, including resolution ofVT_USERDEFINEDreferences to otherTypeInfoentries (in the same library or in imported libraries). - Read-only: this library decodes type libraries, it does not write/compile them.
Metadata
Release files for pycomtypelib 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycomtypelib-0.1.0.tar.gz | 35.6 kB | Without provenance | Details for pycomtypelib-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycomtypelib-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pycomtypelib-0.1.0-py3-none-any.whl |
Total release size: 71.0 kB
Release files / pycomtypelib-0.1.0.tar.gz
| Download URL | pycomtypelib-0.1.0.tar.gz |
|---|---|
| Size | 35.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cc3ce0680f984b89dca84bbb80f195ff9c75c9ec4eab8920a140ef192aa432c
|
|
BLAKE2b-256 checksum How to use checksums |
3b440bcad64c32191250e8999164abf29f474148bc80db5fe2698aeb269e9c9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / pycomtypelib-0.1.0-py3-none-any.whl
| Download URL | pycomtypelib-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c9ce70df4cc19c68d7df271f5cf051ef46fb3227eb5c37a9bbd5ed38149d9a4
|
|
BLAKE2b-256 checksum How to use checksums |
cf9606c8664ff78847155943d79bd62d08d4edc080d7ee0a57cc05ce4a3060e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for pycomtypelib 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.