skillfed

comtypes

Pure Python COM package

comtypes v1.4.16 5.8M downloads/30d#2,039 on PyPI343
Permissive license MIT Active released

What it is and what it does

comtypes is a pure Python wrapper around the Windows Component Object Model (COM), built on top of ctypes. It lets you call COM interfaces from Python code, define custom COM interfaces, and work with dispatch-based COM objects without requiring compiled extensions or external dependencies. The library generates Python modules from COM type libraries, allowing you to interact with Windows applications and system components that expose COM interfaces.

The package is designed for developers who need to automate Windows applications, access system COM services, or integrate Python with legacy Windows software. It has no required runtime dependencies beyond Python itself, though numpy can optionally be installed to handle COM arrays as numpy ndarrays. The library is actively maintained and widely used in the top 5000 PyPI packages by download volume.

Use it for:

  • Automate Microsoft Office applications (Word, Excel, Outlook) from Python scripts.
  • Access Windows system COM services and APIs for system administration or monitoring tasks.
  • Build Python wrappers around proprietary Windows applications that expose COM interfaces.
  • Integrate Python with legacy Windows software that communicates via COM.
  • Generate type-safe Python bindings from COM type libraries for interoperability.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

comtypes is a pure Python library for defining, calling, and implementing COM (Component Object Model) interfaces on Windows using the ctypes foreign function interface.

Yes, if you are on Windows and need to interact with COM interfaces or automate Windows applications. The package is production-stable, actively maintained, has no external dependencies, and carries no known vulnerabilities. The main constraint is that it is Windows-only and requires Python 3.9+; if you are cross-platform or on an older Python version, it will not work for you.

Install

comtypes on PyPI

pip

pip install comtypes

uv

uv add comtypes

poetry

poetry add comtypes

Installing comtypes

Before you install

Installation is straightforward with no runtime dependencies. The package is actively maintained with recent commits and has been in production use since 2014. However, it is Windows-only and requires Python 3.9 or later; users on Python 3.8 or earlier will need an older version.

License in practice

Licensed under MIT (permissive), so you can use, modify, and distribute comtypes freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install comtypes

import comtypes
from comtypes.client import GetObject

# Example: interact with a COM object
obj = GetObject(None, 'ProgID.ClassName')

Windows operating system required; COM is a Windows-specific technology. Python 3.9 or later is required.

Verify before relying

  • Whether the Python 3.15 IntFlag behavior change (GH-894) will require code updates for existing projects using comtypes.
  • Performance characteristics when working with large COM arrays or complex type hierarchies.
  • Compatibility status with the latest Windows versions and COM implementations.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 165 days since the last release
Last repo commit
First released
Downloads 5,779,459/month — #2,039 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: comtypes-1.4.16-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: Microsoft :: WindowsProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

COM interface python windowscomponent object model ctypeswindows COM automation pythondispatch-based COM interfacespython COM client librarywindows interop pure pythonCOM type library wrapper
windows-interopcom-automation

More Python Modules packages