Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.470.375 Times

zipimportx 0.3.1

Company: Ryan Kelly
Date Added: July 27, 2013  |  Visits: 329

zipimportx

Report Broken Link
Printer Friendly Version


Product Homepage
Download (40 downloads)



This package aims to speed up imports from zipfiles for frozen python apps (and other scenarios where the zipfile is assumed not to change) by taking several shortcuts that aren't available to the standard zipimport module.<br /><br />It exports a single useful name, "zipimporter", which is a drop-in replacement for the standard zipimporter class. To replace the builtin zipimport mechanism with zipimportx, do the following::<br /><br /> import zipimportx<br /> zipimportx.zipimporter.install()<br /><br />With no additional work you may already find a small speedup when importing from a zipfile. Since zipimportx assumes that the zipfile will not change or go missing, it does fewer stat() calls and integrity checks than the standard zipimport implementation.<br /><br /><br />To further speed up the loading of a zipfile, you can pre-compute the zipimport "directory information" dictionary and store it in a separate index file. This will reduce the time spent parsing information out of the zipfile. Create an index file like this::<br /><br /> from zipimportx import zipimporter<br /> zipimporter("mylib.zip").write_index()<br /><br />This will create the file "mylib.zip.idx" containing the pre-parsed zipfile directory information. Specifically, it will contain a marshalled dictionary object with the same structure as those in zipimport._zip_directory_cache.<br /><br />In my tests, use of these indexes speeds up the initial loading of a zipfile by about a factor of 3 on Linux, and a factor of 5 on Windows.<br /><br /><br />To further speed up the loading of a collection of modules, you can "preload" the actual module data by including it directly in the index. This allows the data for several modules to be loaded in a single sequential read rather than requiring a separate read for each module. Preload module data like this::<br /><br /> from zipimportx import zipimporter<br /> zipimporter("mylib.zip").write_index(preload=["mymod*","mypkg*"])<br /><br />Each entry in the "preload" list is a filename pattern. Files from the zipfile that match any of these patterns will be preloaded when the zipfile is first accessed for import. You may want to remove them from the actual zipfile in order to save space.<br /><br /><br />Finally, it's possible to convert a zipfile into inline python code and include that code directly in your frozen application. This can simulate the effect of having that zipfile on sys.path, while avoiding any fie IO during the import process. To get the necessary sourcecode, do the following::<br /><br /> from zipimportx import zipimporter<br /> code = zipimporter("mylib.zip").get_inline_code()<br /><br /><br />Finally, it's worth re-iterating the big assumption made by this module: the zipfile must never change or go missing. If the data in the index does not reflect the actual contents of the zipfile, imports will break in unspecified and probably disasterous ways.<br /><br />Note also that this package uses nothing but builtin modules. To bootstrap zipfile imports for a frozen application, you can inline this module's code directly into your application's startup script. Simply do something like this in your build process::<br /><br /> import zipimportx<br /> import inspect<br /><br /> SCRIPT = '''<br /> %s<br /> zipimporter.install()<br /> import myapp<br /> myapp.main()<br /> ''' % (inspect.getsource(zipimportx),)<br /><br /> freeze_this_script_somehow(SCRIPT)<br /> zipimportx.zipimporter("path/to/frozen/library.zip").write_index()

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Actual Builtin Change Directly Frozen Import Imports Index It039s Loading Missing Module Modules Speed Standard Zipfile Zipimport Zipimporter Zipimportx
Users rating: 0/10

License: Freeware Size: 10.24 KB
USER REVIEWS
More Reviews or Write Review


ZIPIMPORTX RELATED
Libraries  -  HTML::Widgets::Index 0.6
HTML::Widgets::Index is a Perl module for creating web indexes and menus. This module renders the index of a document tree using the data stored in a MySQL database generated by anxova. It has a flexible set of render options that gives the...
65.54 KB  
Libraries  -  SVN::Log::Index 0.51
SVN::Log::Index is a Perl module that can index and search over Subversion commit logs. SYNOPSIS my $index = SVN::Log::Index->new({ index_path => /path/to/index }); if($creating) { # Create from scratch if necessary $index->create({...
13.31 KB  
Libraries  -  Contentment::Index 0.011_032
Contentment::Index is a Perl module that provides categorization and indexing features. SYNOPSIS # Get a list of the available indexes my @indexes = Contentment::Index->indexes; for my $index (@indexes) { # Get a list of avilable terms...
112.64 KB  
File Utilities  -  Python Metadata Importer 1.0
Allows Spotlight to import and index Python script source code. Various metadata are imported from the source code including function and class names, version, author and description.
1.1 MB  
Programming  -  signedimp 0.3.1
This module implements an import hook for verifying Python modules before they are loaded, by means of cryptographically-signed hashes. It is compatible with PEP 302 and designed to complement the code-signing functionality of your host OS (e.g....
40.96 KB  
Modules  -  SSL Users 6.x-1.0
Allows user or bot to add new or update existent data for specified tasks in theirs files and then process it via cron by Node import module. It may help if you want to automatize data import. Module works in several modes: * Imports only new...
10 KB  
Utilities  -  Index Your Files - Home! 2.04
Search Files for Windows - Index Files - Advanced Features. General Characteristics Easy & Fast Search Engine - Easy & Fast Index Engine Index & Search in Background Share Index - Import & Export Index Full Information Search and Index Compress l...
603 KB  
File Security  -  Certificate Import 1.2
Certificate Import imports digital Certificates via Drag & Drop into your Keychain and supports Certificates in popular Apache-Format (.der Files).
 
Modules  -  Migrate Extras 7.x-2.2
Migrate Extras is a package of files that integrate the Migrate Module with many of the non-core modules available for drupal, allowing you to import content from other modules, older versions of drupal, or a non-drupal CMS.Hear Awesome Lullabot...
20.48 KB  
Modules  -  x7Host's Videox7 UGC Plugin 2.5.3.4
This plugin is a fork of Kaltura's original "All In One Video Pack" plugin, enhanced in many ways and designed from the bottom up to be easily integrated with the self-hosted Kaltura Community Edition.This is not just another video embed tool - it...
983.04 KB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB