This release is a pre-release and may not be stable for production use.
zipaccess
Patches functions [modules]:file+open, and os.path:exists+isfile to enable accessing files inside zip archives using standard file functions.
- Package:
- Project:
- Issues:
- Updates:
- Install via pip:
pip install zipaccess
- Install via easy_install:
easy_install zipaccess
- Sources via git:
git clone https://github.com/iki/zipaccess
- Sources via hg-git:
hg clone git://github.com/iki/zipaccess
Usage
Use as a class. Do not instantiate it:
class AnyZipAccess(zipaccess.ZipAccess):
any_zip = True # custom modifications here
AnyZipAccess.enable()
Or use as a module:
zipaccess.enable()
zipaccess.addzip('data.zip')
Optionally, register zipaccess.ZipAccess as os.zipaccess:
zipaccess.enable(register=True)
so other modules can easily use:
try:
os.zipaccess.enable(locals())
except AttributeError:
pass
Note on Google App Engine (GAE)
On GAE, the __builtin__ module changes are not reflected, even in the local name space.
To use zip access in any GAE module, you need to enable it for that module locals:
try:
import zipaccess
zipaccess.enable(locals())
except ImportError:
pass
Alternatively, only enable zip access locally, if it was already registered:
try:
os.zipaccess.enable(locals())
except AttributeError:
pass
Or enable it for target modules externally:
zipaccess.enable([
'babel.core',
'babel.localedata',
'tipfy.template',
'werkzeug.debug.tbtools',
])
# It imports all the modules though, which may be not what you want.
# If you know, how to hook on module import, let me kindly know.
Note, that os.path.isfile and os.path.exists are patched globally. Even on GAE, they apply for all modules of given instance. If some modules do support zip files, they usually first check if regular file exists, and if not, they split the path and check if the zipfile exists. With zip access enabled, the regular file check will succeed, which is ok as long as consequently used file() or open() functions are patched too.
Example:
The tipfy.debugger.get_loader() function checks if templates are located in a regular directory or in a zip file (lib/dist.zip usually). Then it returns tipfy.template.Loader or tipfy.template.ZipLoader accordingly. With zipaccess enabled, the standard tipfy.template.Loader will be used, and therefore zipaccess.enable('tipfy.template') is needed to make it work.
See https://github.com/moraes/tipfy/blob/master/tipfy/debugger/__init__.py#L26.
Metadata
Release files for zipaccess 0.1rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zipaccess-0.1rc1.zip | 9.6 kB | Without provenance | Details for zipaccess-0.1rc1.zip |
Release files / zipaccess-0.1rc1.zip
| Download URL | zipaccess-0.1rc1.zip |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d88cb5d60fa25b4528f12b53694eac6cdabb5df964e6771397ba0b3df20e7fac
|
|
BLAKE2b-256 checksum How to use checksums |
bf2c28912dea3e313d978987ce8c45bf81b2fb4e1a37cb67646e4ce1cfe8fe83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for zipaccess 0.1rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.