Split __init__.py into some modules (only NOT tightly coupled) - #559
Merged
Merged
Conversation
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
force-pushed
the
split_dunder_init_loosely_coupled
branch
from
June 8, 2024 15:05
922e1ee to
adfa1c7
Compare
junkmd
marked this pull request as ready for review
June 8, 2024 15:06
junkmd
added a commit
to junkmd/pywinauto
that referenced
this pull request
Jun 8, 2024
after merging
This was referenced Jun 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
__init__.pyof 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__.pyis to "handle the initialization of the package", callingCoInitializeExis indeed initialization, so it is necessary in__init__.py.However, for example, if we define things like the
BSTRin other private modules and import it into__init__.py(such as currentGUIDmodule),__init__.pywill become lightweight.Firstly, before tackling more complex elements such as metaclasses like
_cominterface_metaand global mappings likecom_interface_registry, I will be separating out the loosely coupled implementations likeinstancemethodand/orBSTRinto different modules.In order to keep the change history even if we squash & merge, I will divide it into several PRs.