Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate function and interface definitions from __init__.py to _base.py #566

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

junkmd
Copy link
Collaborator

@junkmd junkmd commented Jun 10, 2024

I move the interfaces and functions defined in __init__.py that are defined after post-CoInitialize to _base.py.

The reason is same as #559,

The __init__.py of this package is very large. I think this is a barrier for newcomers to the community trying to understand this package.

Considering that the responsibility of __init__.py is to "handle the initialization of the package", calling CoInitializeEx is indeed initialization, so it is necessary in __init__.py.

However, for example, if we define things like the BSTR in other private modules and import it into __init__.py (such as current GUID module), __init__.py will become lightweight.

They contains basic functions for comtypes, and fundamental stuffs for COM which are also described in the documentation published by MS.

_base.py will be a temporary storage for now, and may be further subdivided in the future.
But for the time being, they will be moved to this private module.

The following will be done in the same way as #559.

In order to keep the change history even if we squash & merge, I will divide it into several PRs.

@junkmd junkmd marked this pull request as draft June 10, 2024 13:19
@junkmd junkmd force-pushed the separate_com_api_from_dunder_init branch from 6472197 to 2cc5ed2 Compare June 10, 2024 13:21
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 10, 2024
junkmd added a commit that referenced this pull request Jun 10, 2024
* split `__init__.py` part 1
- add `_base.py`
- rename to `___init__.py` from `__init__.py` temporarily
@junkmd junkmd force-pushed the separate_com_api_from_dunder_init branch from 2cc5ed2 to ebc8a2e Compare June 10, 2024 15:03
junkmd added a commit that referenced this pull request Jun 10, 2024
* remove duplicated stuffs
- remove from `comtypes\_base.py`

* revert temporary renaming
- rename from `comtypes\___init__.py` to `comtypes\__init__.py`
junkmd added 2 commits June 10, 2024 15:10
for projects that depend on this package
@junkmd junkmd force-pushed the separate_com_api_from_dunder_init branch from ebc8a2e to 8870053 Compare June 10, 2024 15:11
@junkmd junkmd marked this pull request as ready for review June 10, 2024 15:24
@junkmd junkmd added this to the 1.4.5 milestone Jun 10, 2024
@junkmd junkmd merged commit cc6edaf into enthought:main Jun 10, 2024
49 checks passed
@junkmd junkmd deleted the separate_com_api_from_dunder_init branch June 10, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant