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

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

Serving Software Downloads in 976 Categories, Downloaded 31.061.908 Times

zipimportx 0.3.1

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


Report Broken Link
Printer Friendly Version

Product Homepage
Download (17 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("").write_index()<br /><br />This will create the file "" 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("").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("").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/").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
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  
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
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  
Modules  -  Po-Re-Importer 6.x-1.2
With the module you can re-import all translation files of the modules, or only a translation file of module per language. And if you change a translation file or with a module update comes a new/updated translation file(s) the module will see...
20.48 KB  
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  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by, it is used to describe information about an application such as the name and...
327.68 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  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB