How to encrypt a module into one file?

My parts compiled into one file are visible from the outside, but inside the hierarchy is broken.

from .packet import Packet 

spills over

  File "libmodule/__init__.py", line 1, in init libmodule.__init__ (libmodule/__init__.c:1060) ... ImportError: No module named 'libmodule.packet' 

Here to take

 Extension("module", [ "module.py", "libmodule/__init__.py", "libmodule/worker.py", "libmodule/decoders.py", "libmodule/constants.py", ]) 

and compile into one file. So far it turns out only in 5 files, but it is not very convenient.

As a result, you need to see the setup () function from module.py, the rest does not matter. That is, from libmodule.packet import Packet not necessary to work outside the library.

An example of the structure that I am trying to achieve https://github.com/eri-hellowords/cython-helloword/tree/v1 - does not work

This is how it works, but I don’t like the structure https://github.com/eri-hellowords/cython-helloword/tree/v2.0

Option to drag all the files into one namespace via .pyx: stackoverflow.com/a/19698914/2101808

  • I want to pack the application in cx_freeze, and its main components assemble in cython. The problem is to collect the component in one library file. - eri
  • The full example will take a lot of space and almost does not reflect the essence of the question. Gather now, add. - eri
  • @jfs added link to sample code. - eri
  • 2 - a minute ago I wrote you a new code from scratch? - eri
  • 1 - I want to collect 5 files in one library, and plus one file that will launch it. - eri

0