Skip to content

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

Merged
junkmd merged 6 commits into
enthought:mainfrom
junkmd:split_dunder_init_loosely_coupled
Jun 8, 2024
Merged

junkmd merged 6 commits into
enthought:mainfrom
junkmd:split_dunder_init_loosely_coupled

Conversation

@junkmd

@junkmd junkmd commented Jun 8, 2024

Copy link
Copy Markdown
Collaborator

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
@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