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

Split __init__.py into some modules (only NOT tightly coupled) #559

Merged
merged 6 commits into from
Jun 8, 2024

Conversation

junkmd
Copy link
Collaborator

@junkmd junkmd commented Jun 8, 2024

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.

Firstly, before tackling more complex elements such as metaclasses like _cominterface_meta and global mappings like com_interface_registry, I will be separating out the loosely coupled implementations like instancemethod and/or BSTR into different modules.

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

@junkmd junkmd added this to the 1.4.5 milestone Jun 8, 2024
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 8, 2024
junkmd added a commit that referenced this pull request Jun 8, 2024
* split `__init__.py` part 1
- add `base.py`
- rename to `___init__.py` from `__init__.py`
temporarily

* add `_tlib_version_checker`

* revert temporary renaming
- from `comtypes\_base.py` to `comtypes\base.py`

* add `_bstr`

* revert temporary renaming
- from `comtypes\_base.py` to `comtypes\base.py`

* add `_py_instance_method`

* revert temporary renaming
- from `comtypes\_base.py` to `comtypes\base.py`

* add `_idl_stuff`

* revert temporary renaming
- from `comtypes\_base.py` to `comtypes\base.py`
@junkmd junkmd force-pushed the split_dunder_init_loosely_coupled branch from 922e1ee to adfa1c7 Compare June 8, 2024 15:05
@junkmd junkmd marked this pull request as ready for review June 8, 2024 15:06
@junkmd junkmd merged commit 55c56cc into enthought:main Jun 8, 2024
49 checks passed
@junkmd junkmd deleted the split_dunder_init_loosely_coupled branch June 8, 2024 15:09
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 8, 2024
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