Open
Description
The cefpython package structure should refactored. Currently all functions are put in the cefpython3 module. Functionality should be spread across many modules:
- cef.browser
- cef.types
- cef.helpers
- cef.utils
- cef.task
- cef.interfaces / cef.handlers
- See pycef API draft for ideas: https://github.com/cztomczak/pycef/blob/master/API.draft
Steps:
- Refactor .pyx files to get rid of the
include "cefpython.pyx"
(and all other include statements). Each pyx file should be a real independent module with its own imports. - Refactor setup.py and move to tools/cython/
- Worth reading:
- How To Create A Hierarchy Of Modules In A Package: https://github.com/cython/cython/wiki/PackageHierarchy
- cythonize(["*.pyx"]): https://github.com/cython/cython/wiki/enhancements-distutils_preprocessing
- another cythonize example: https://github.com/msgpack/msgpack-python/blob/master/setup.py
- For more see Cython wiki
- Use modular structure - get rid of fix_pyx_files.py script. To keep backward compatibility create
__init__.py
with all the imports from sub-modules.
- Worth reading:
Directories:
- src/*.pyx
- utils/_.pyx - move utils.pyx, string_utils.pyx, window_utils__.pyx and others
- handlers/*.pyx - done
- extern/*.pxd - done
- extern/cef/*.pxd - done
- extern/views/*.pxd (CEF views)
This issue is blocking other features that are to be implemented:
- CEF views - new classes should be imported from "cef.views" package (Issue Support for Views framework #252)
- Automatically import enum types with translator.py tool and put them in "cef.types" package (Issue Create translator.py tool to provide full CEF API coverage in an automated way #214)
- There are other features to be implemented and it would be nice to have Cython package with good structure before taking on these tasks, see the Refactor Cython project
This refactoring should improve significantly build times of cefpython. Currently it takes about a minute even with the --fast flag passed to compile.py.
Related issue: #208 (Big changes planned for CEF Python).