comtypes

A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package.

https://github.com/enthought/comtypes

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 42 committers (2.4%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary

Keywords from Contributors

unit-testing closember qt
Last synced: 6 months ago · JSON representation

Repository

A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package.

Basic Info
  • Host: GitHub
  • Owner: enthought
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 3.86 MB
Statistics
  • Stars: 324
  • Watchers: 55
  • Forks: 103
  • Open Issues: 97
  • Releases: 31
Created about 12 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Security

README.md

comtypes

Works on Windows only
PyPI version PyPI - Python Version PyPI - Python Requires
PyPI - License PyPI - Downloads
GitHub Repo stars GitHub forks Ruff
Tidelift Subscription Coverage

comtypes is a lightweight pure Python COM package based on the ctypes foreign function interface library.

comtypes allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.

comtypes requires Windows and Python 3.8 or later. - Version <= 1.4.7 does not work with Python 3.13 as reported in GH-618. Version 1.4.8 can work with Python 3.13. - Version 1.4.6 is the last version to support Python 3.7. - Version 1.2.1 is the last version to support Python 2.7 and 3.3–3.6. - comtypes does not work with Python 3.8.1 as reported in GH-202. This bug has been fixed in Python >= 3.8.2. - Certain comtypes functions may not work correctly in Python 3.8 and 3.9 as reported in GH-212. This bug has been fixed in Python >= 3.10.10 and >= 3.11.2.

Installation

comtypes is available on PyPI and can be installed with pip: ```sh

PyPI

pip install comtypes ```

The source code is currently hosted here on GitHub.

Dependencies

comtypes is a pure Python package — it has no additional required dependencies.

Optional functionalities can be enabled by installing: - numpy, in order to process arrays as numpy's ndarray. - mypy or other static type checkers, in order to interpret type hints.

None of these packages, however, are required in order to run comtypes.

Community

The GitHub repository is used for tracking issues, reporting bugs, and contributing to the codebase and documentation.

For Enterprise

Available as part of the Tidelift Subscription.

This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.

Learn more.

Frequently Asked Questions

Q: Why does this package not support platforms other than Windows?

A: The Microsoft Component Object Model (COM) is a technology that is unique to Windows and is not supported on other platforms.

The phrase "COM is a platform-independent" in the MS documentation means that COM maintains compatibility across different versions of Windows, and does NOT imply that it is supported on Linux or Mac.

For as long as COM is not supported outside of Windows, there is no plan to port comtypes to other platforms.

Q: Why does cannot import name 'COMError' from '_ctypes' error occur when using this package on platforms other than Windows?

A: The _ctypes is part of the internal implementation of the ctypes standard library that exists for Python on all platforms. However, COMError and COM-related features are only implemented in Python for Windows.

In cross-platform software development, care must be taken to ensure that codebases that depend on comtypes do not execute in environments other than Windows.

Q: Despite a script that depends on comtypes having run successfully before, a error (ImportError, NameError, or SyntaxError) is raised now, and the same error occurs again and again.

A: Executing py -m comtypes.clear_cache and then running the script again might resolve the problem.

When comtypes.client.GetModule is called (either directly or indirectly), comtypes generates Python module files.
If Python is forced to terminate or crashes in the middle of file generation, the codebase written to the file becomes partial.
When Python tries to import this unexecutable partial codebase module, an error occurs.

Executing py -m comtypes.clear_cache identifies the directories where the "cache module files" are stored and deletes them.
After deleting these partial modules and running the script again, comtypes.client.GetModule is called and executable modules are generated anew.

However, if the script implementation does not use comtypes.client.GetModule or processes generated files, it may not be a solution.

Documentation

The documentation is currently hosted here on ReadTheDocs.

Owner

  • Name: Enthought, Inc.
  • Login: enthought
  • Kind: organization
  • Location: Austin, TX

GitHub Events

Total
  • Create event: 6
  • Release event: 5
  • Issues event: 65
  • Watch event: 33
  • Delete event: 1
  • Issue comment event: 191
  • Push event: 174
  • Pull request review comment event: 44
  • Pull request event: 358
  • Pull request review event: 92
  • Fork event: 9
Last Year
  • Create event: 6
  • Release event: 5
  • Issues event: 65
  • Watch event: 33
  • Delete event: 1
  • Issue comment event: 191
  • Push event: 174
  • Pull request review comment event: 44
  • Pull request event: 358
  • Pull request review event: 92
  • Fork event: 9

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 1,038
  • Total Committers: 42
  • Avg Commits per committer: 24.714
  • Development Distribution Score (DDS): 0.509
Past Year
  • Commits: 246
  • Committers: 12
  • Avg Commits per committer: 20.5
  • Development Distribution Score (DDS): 0.211
Top Committers
Name Email Commits
thomas.heller n****e@n****e 510
Jun Komoda 4****d 280
Christopher L. Farrow c****w@e****m 66
Jason R. Coombs j****o@j****m 48
Vasily Ryabov v****v@g****m 35
moi15moi 8****i 28
newwingbird 6****d 10
Kevin Schlosser k****r 6
laripk l****y@f****m 5
Thomas Geppert g****i 4
Joshua Klein m****n@g****m 3
Ben Rowland b****d@m****m 3
Leonard de Ruijter l****d@b****m 3
Fredrik Orderud f****d@g****m 3
Dustin Wyatt d****t@g****m 2
Fredrik Orderud f****d 2
Merajul Arefin m****n@g****m 2
fusentasticus f****s 2
mark.dickinson m****n@e****m 2
orf t****m@t****s 2
Jan Klusacek j****k@t****m 1
matt wilkie m****w@g****m 1
kyleMR k****e@g****m 1
jonschz 1****z 1
fmtabler 9****r 1
davidschranz d****z@g****m 1
Yuan-Hao Chen y****6@g****m 1
William Schwartz w****z@g****m 1
Umar Butler u****r@u****u 1
Thomas Kellermeier t****r@h****e 1
and 12 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 145
  • Total pull requests: 481
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 10 days
  • Total issue authors: 68
  • Total pull request authors: 18
  • Average comments per issue: 5.21
  • Average comments per pull request: 0.91
  • Merged pull requests: 437
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 37
  • Pull requests: 321
  • Average time to close issues: 27 days
  • Average time to close pull requests: about 23 hours
  • Issue authors: 10
  • Pull request authors: 7
  • Average comments per issue: 1.95
  • Average comments per pull request: 0.42
  • Merged pull requests: 294
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • junkmd (61)
  • moi15moi (6)
  • bennyrowland (5)
  • jonschz (3)
  • jaraco (3)
  • cfarrow (2)
  • nanonyme (2)
  • theobinomy (2)
  • DManowitz (2)
  • parsasaei (2)
  • sindzicat (2)
  • LeonarddeR (2)
  • BasilcM (1)
  • monkeycc (1)
  • deusyss (1)
Pull Request Authors
  • junkmd (506)
  • moi15moi (72)
  • newwingbird (20)
  • geppi (8)
  • jonschz (7)
  • forderud (6)
  • kdschlosser (5)
  • jaraco (4)
  • CristiFati (3)
  • vasily-v-ryabov (2)
  • bennyrowland (2)
  • v01d-gh (2)
  • umarbutler (2)
  • fmtabler (2)
  • cosmastech (2)
Top Labels
Issue Labels
good first issue (25) drop_py2 (17) help wanted (16) shared_info (13) enhancement (13) bug (9) 3rd-party issue (8) npsupport (6) question (6) tests (6) coding style (4) wontfix (3) typing (3) 64-bit (2) duplicate (2) debt (1) ci (1)
Pull Request Labels
typing (123) tests (119) drop_py2 (61) coding style (53) enhancement (27) shared_info (24) bug (10) 64-bit (6) npsupport (3) help wanted (3) ci (2)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 2,869,862 last-month
  • Total docker downloads: 126
  • Total dependent packages: 115
    (may contain duplicates)
  • Total dependent repositories: 4,251
    (may contain duplicates)
  • Total versions: 66
  • Total maintainers: 7
pypi.org: comtypes

Pure Python COM package

  • Versions: 46
  • Dependent Packages: 112
  • Dependent Repositories: 4,158
  • Downloads: 2,869,797 Last month
  • Docker Downloads: 126
Rankings
Dependent repos count: 0.2%
Dependent packages count: 0.2%
Downloads: 0.2%
Average: 2.1%
Docker downloads count: 3.5%
Stargazers count: 4.0%
Forks count: 4.6%
Last synced: 6 months ago
pypi.org: comtypes-fork

Pure Python COM package

  • Versions: 1
  • Dependent Packages: 2
  • Dependent Repositories: 1
  • Downloads: 65 Last month
Rankings
Dependent packages count: 3.2%
Stargazers count: 4.0%
Forks count: 4.6%
Average: 10.9%
Downloads: 21.1%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: comtypes

comtypes is a pure Python COM package based on the ctypes ffi foreign function library.The comtypes package makes it easy to access and implement both custom and dispatch based COM interfaces.While the pywin32 package contains superior client side support for dispatch based COM interfaces,it is not possible to access custom COM interfaces unless they are wrapped in C++-code.

  • Versions: 10
  • Dependent Packages: 1
  • Dependent Repositories: 46
Rankings
Dependent repos count: 5.3%
Forks count: 18.8%
Average: 19.5%
Stargazers count: 24.9%
Dependent packages count: 29.0%
Last synced: 6 months ago
anaconda.org: comtypes

comtypes is a pure Python COM package based on the ctypes ffi foreign function library.The comtypes package makes it easy to access and implement both custom and dispatch based COM interfaces.While the pywin32 package contains superior client side support for dispatch based COM interfaces,it is not possible to access custom COM interfaces unless they are wrapped in C++-code.

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 46
Rankings
Dependent repos count: 25.1%
Forks count: 31.9%
Average: 36.4%
Stargazers count: 37.6%
Dependent packages count: 51.2%
Last synced: 6 months ago