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

[RFC] Subpackages for pykeyvi #233

Open
hendrikmuhs opened this issue Apr 20, 2017 · 2 comments
Open

[RFC] Subpackages for pykeyvi #233

hendrikmuhs opened this issue Apr 20, 2017 · 2 comments

Comments

@hendrikmuhs
Copy link
Contributor

hendrikmuhs commented Apr 20, 2017

For a new feature I like to discuss modularization. I like to put the new feature into a subpackage ('pykeyvi.index'). Playing a bit with cython it unfortunately turns out, cython does not support it easily:

https://github.com/cython/cython/wiki/FAQ#how-to-compile-cython-with-subpackages

There is a recommendation on the wiki:

https://github.com/cython/cython/wiki/PackageHierarchy

which would build a 'so' for every subpackage, which would mean a lot of wasted space and higher memory usage.

RFC: Move the cython extension into a hidden namespace ('pykeyvi._core') keeping the flat structure, create a python module structure and import accordingly, this would keep a single so file but still provide subpackages:

 - pykeyvi
  - __init__.py
  - index
   - __init__.py

pykeyvi/init.py:

from pykeyvi._core import JsonDictionaryCompiler, ...

pykeyvi/index/init.py:

from pykeyvi._core import IndexReader, IndexWriter

In the longer run this also solves 2 problems:

  • cleanup existing structure
  • create python code extensions (like the keyvicli library)
@hendrikmuhs
Copy link
Contributor Author

@narekgharibyan

@narekgharibyan
Copy link
Contributor

@hendrikmuhs sounds good!
Have you tried to implement it already, to see how it works with packaging ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants