Closed mgautierfr closed 4 years ago
Naming was discussed and defined for libzim here: https://github.com/openzim/python-libzim/pull/2#issuecomment-612640206
Having a package hierarchy in Cython is basically doing two extensions. That means that is not as in normal python as creating a dir and putting the files.
Taking into account that the CI / CD supports many options (static, dynamic, from source, with cython, without, etc) this modification at this point could break it.
if going from
from libzim import ZimFileReader, ZimCreator
to
from libzim import ZimFileReader
from libzim.writer import ZimCreator
is definitively desired , then creating a new package could be easier for you with the existent code under the branch reader
https://github.com/openzim/python-libzim/tree/reader
Adding another layer of hierarchy to the extension is pretty easy in theory (1-2hr maybe?), but I think it can be done as a separate task:
ext_modules = cythonize([
Extension(
"libzim",
sources=["libzim/**/*.pyx","libzim/**/*.cxx"],
- include_dirs=["libzim"],
+ include_dirs=["libzim/reader", "libzim/writer"],
libraries=["zim"],
...
)
],
compiler_directives={'language_level' : "3"},
)
+ some rejiggering of .gitignore
and Manifest.in
From the user point of view :
zim
module contains things to read a zimzim.writer
module contains things to create a zim.Class names must not include the
Zim
:ZimArticle
->zim.writer.Article
ZimCreator
->zim.writer.Creator
ZimFileReader
->zim.File
,zim.Reader
orzim.FileReader
(I'm not sure what is best)zimFileArticle
->zim.Article