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

Merge drop_py2 #509

Merged
merged 51 commits into from
Feb 4, 2024
Merged

Merge drop_py2 #509

merged 51 commits into from
Feb 4, 2024

Conversation

junkmd
Copy link
Collaborator

@junkmd junkmd commented Feb 4, 2024

For 1.3.0 release

junkmd and others added 30 commits February 3, 2024 04:14
(cherry picked from commit 30f497a)
(cherry picked from commit 80ec49b)
(cherry picked from commit 817b6b7)
(cherry picked from commit 5b0dc8d)
(cherry picked from commit a6fc08b)
(cherry picked from commit 21b6ab6)
(cherry picked from commit 086ec13)
(cherry picked from commit 4e53792)
* Improve COM error message

* Drop Py2 stuff

* Remove dot

* Remove empty line

(cherry picked from commit 18cafb0)
* add `# fmt: ...` for avoiding redundant format

* add GHA setting

* apply automatic formatter

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 22bfc50)
(cherry picked from commit 0664400)
(cherry picked from commit 39d9e00)
(cherry picked from commit 6732c26)
…comtypes/__init__.py`, `comtypes/automation.py` and `comtypes/typeinfo.py` (enthought#454)

* update `comtypes/__init__.py`

* update `comtypes/automation.py`

* update `comtypes/typeinfo.py`

* fix `Array[T]` to quoted literal strings

(cherry picked from commit 7b38a7a)
junkmd and others added 21 commits February 3, 2024 04:17
…comtypes/client/...` (enthought#456)

* change type hints from comment annotations to inline annotations in `comtypes/client/...`

* fix type annotations

(cherry picked from commit 18dc2cc)
* update `codegenerator` type annotations

* lcid

(cherry picked from commit 9e7b900)
)

* update `typedesc` type annotations

* update `typedesc_base` type annotations

(cherry picked from commit 95962e9)
* change from udf `silence_stdout` to stdlib `contextlib.contextmanager`

* remove `sys.version_info` bridges

* remove excessive blank lines

(cherry picked from commit d470b62)
Co-authored-by: jonschz <[email protected]>
(cherry picked from commit 1615af5)
* unit test for generated IEnum (enthought#468)

* change enum_test to a non-empty IEnum

* improved checks and clarity

* apply requested changes

Co-authored-by: jonschz <[email protected]>
(cherry picked from commit e1ee6f0)
…he friendly module (enthought#469)

* add `Library` to generated modules' `__all__`.
because that symbol is public but not included.

* add `typelib_path` to generated modules' `__all__`.
because that symbol is public but not included.

* make `ModuleGenerator` class
that encapsulates `CodeGenerator` instance.

* rename to `generate_wrapper_code`
from `generate_code`

* add `generate_friendly_code`

* add type annotations to `generate_wrapper_code`

* add docstring

* add `get_symbols` methods
to `DeclaredNamespaces` and `ImportedNamespaces`

* update imporing symbols

* add type annotation to return value for `__init__`

* change to using f-string
in `generate_friendly_code`

(cherry picked from commit 532c399)
from `setup.py`

(cherry picked from commit 9724dc0)
* change `_MemberSpec` to `NamedTuple`

* `_ComMemberSpec` is no more `Generic`
for Py<3.11 backward compatibility.

* apply `black` style

(cherry picked from commit 94b81af)
* move clear_comtypes_cache to be a callable module

This commit modifies the clear_comtypes_cache.py script so that it is inside
the main comtypes module (renamed as just clear_cache) so that is can be called
more easily as "py -m comtypes.clear_cache". The main function of the script is
also exported using the "console_scripts" entry point so that the script also
goes into the standard Python "Scripts" folder as before, but now as a .exe
instead of a .py script, which makes it easier to run if systems are set to
open .py files instead of running them.

This version also includes a test case using the 3rd party package pyfakefs.
Currently, this is not desired to avoid the requirement of 3rd party packages
in comtypes, but is included here for potential use if the position changes.
A subsequent commit will modify the tests to use unittest.patch instead, which
is an inferior technical solution but avoids a 3rd party package.

* modify clear_cache tests to not use pyfakefs

This commit updates the test for comtypes.clear_cache to not use any 3rd party
packages, instead relying on mocking the shutil.rmtree function which is used
to do the actual cache deletion.

* change quotes in print string

* style changes based on review by @junkmd

* Apply suggestions from code review

Co-authored-by: Jun Komoda <[email protected]>

---------

Co-authored-by: Ben Rowland <[email protected]>
Co-authored-by: Jun Komoda <[email protected]>
(cherry picked from commit 8954f61)
(cherry picked from commit 6532d32)
from `ImportedNamespaces.getvalue`

(cherry picked from commit da27aaf)
…cted name, `__wrapper_module__` (enthought#493)

* add test

* add the `__wrapper_module__` to friendly modules

By doing so, it is possible to achieve a combination of friendly-modules
functionalities and improved access to the wrapper-modules.

(cherry picked from commit b7d5f1f)
* bugfix in `call_with_inout`

* minor cleanup

* handling the case of no in and no out

* Test case for _fix_inout_args

* additional cleanup and error handling

* code formatting fixed

* fix python 3.7 and 3.8 compatibility

* Temporary addition of real-world test

* code cleanup

* intermediate commit, do not review

* Refactor of unit test, removing portdevice test

* fix global side-effect of other skipped test

* Update comtypes/test/test_outparam.py

Co-authored-by: Jun Komoda <[email protected]>

* work on tests for inout_args and outparam
- cleanup for test_outparam.py
- improvements to test_inout_args.py
- comments on a possible error in _memberspec.py

* removing dead code

* rename variables and add assertions

* pass `MagicMock` instead of `ut.TestCase`

* make tests for each argument passing patterns

* remove duplicated comments

* update test code for readability
- remove name from mock
- move line breaks to between mock preparations and assertions

* split the testcases

* add `Test_Error`

* minor corrections, remove redundancy, migration
- rewrite the permutations test
- missing direction and omitted name redundant
- migrate autogenerated keywords
- TBD: more real life tests

* Add tests covering 24 patterns
- instead of using `if` statements and `permutations`

* update test name

* add real world tests, remove old code

* formatting issue

* Update comtypes/_memberspec.py

dict type annotation

Co-authored-by: Jun Komoda <[email protected]>

* Change missing 'in' or 'out' to be treated as 'in'

* Add real-world test: param without 'in' or 'out'

* add `contextlib.redirect_stdout`
to supress warnings

* apply review feedback

* update comments

* add line breaks to lines longer than 88 characters

* Update comtypes/test/test_inout_args.py

---------

Co-authored-by: jonschz <[email protected]>
Co-authored-by: Jonathan <[email protected]>
Co-authored-by: Jun Komoda <[email protected]>
(cherry picked from commit 876801f)
…es down" from "Table of contents" (enthought#505)

(cherry picked from commit af78614)
@junkmd junkmd added the drop_py2 dev based on supporting only Python3, see #392 label Feb 4, 2024
@junkmd junkmd added this to the 1.3.0 milestone Feb 4, 2024
@junkmd junkmd self-assigned this Feb 4, 2024
@junkmd junkmd merged commit e1d6185 into enthought:main Feb 4, 2024
1 check passed
@junkmd junkmd deleted the merge_drop_py2 branch February 7, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drop_py2 dev based on supporting only Python3, see #392
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants