openzim / python-libzim

Libzim binding for Python: read/write ZIM files in Python
https://pypi.org/project/libzim/
GNU General Public License v3.0
62 stars 20 forks source link

Writing part must be in a submodule `writer` #17

Closed mgautierfr closed 4 years ago

mgautierfr commented 4 years ago

From the user point of view :

Class names must not include the Zim :

jdcaballerov commented 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

pirate commented 4 years ago

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