enthought / comtypes

A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package.
Other
283 stars 96 forks source link

`tools.codegenerator` subdirectory package part 1 #546

Closed junkmd closed 1 month ago

junkmd commented 1 month ago

I have been contributing to the tools.codegenerator module for several years.

The CodeGenerator class was already large when I began my contributions. Since then, I have refactored it by redistributing responsibilities that were once overloaded onto a single class to other classes and functions.

Despite these efforts, the module remains over 1000 lines and is challenging to maintain. The recursive method that generates the codebase from typedesc objects complicates unit testing. While the client's tests confirm the code's executability, they do not assess the readability of line spacing and annotations.

This PR and next ones aim to enhance future refactoring and testability by restructuring tools.codegenerator into a subdirectory package, store with an __init__.py file and appropriately placed modules.