Python Forum
Enhancement for Python’s zipimport
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enhancement for Python’s zipimport
#1
Hello~

There seem to be some little problems with Python's zipimport, so I tried to improve it.
Of course, zipimport is very very awesome. (Thanks to the developer who created it.)
So, I created a package called zimport with some improvements.

● Technology
- importlib, meta_path, path_hooks
- hooking functions (standard open, stat, read, ctypes.WinDLL, ctypes.CDLL, etc ...)
● Main features
- support for dynamic library loading in zip-archive (.pyd, .dll, .so, .dylib)
- support for reading internal files (e.g. environment files) in zip-archive like java's getresource in jar
- more specific compiled .pyc support ( name.cpython-version.pyc and __pycache__ folder)
● Conclusion
- you can manage packages just like Java's jar. (Of course, it is also compatible with pip.)
- Save disk space by replacing a large number of files with one zip-archive per package.
- for example, when installing the torch package, you can replace a huge number of files (about 20,000) with a single zip-archive.

Please try it out and let us know if you encounter any issues or suggestions for improvement.
Thanks to you all and the python community.

zimport project url is as follows:
https://github.com/waveware4ai/zimport
It can also be installed via the pip command.
pip install zimport

:)
Reply
#2
* The transformers package is now supported.
The original goal was to make ComfyUI-based Wan2.1 (https://github.com/kijai/ComfyUI-WanVideoWrapper, https://github.com/Wan-Video/Wan2.1) as Portable version,
and I just finished modifying the transformers-related source code and used zimport to make it work, and it works well.
Thank you for using it. :D
https://github.com/waveware4ai/zimport
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020