Web Images Videos Maps News Groups Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Python 3000: Standard API for archives?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
samwyse  
View profile  
 More options Jun 4 2007, 10:02 pm
Newsgroups: comp.lang.python
From: samwyse <dejan...@email.com>
Date: Mon, 04 Jun 2007 12:02:03 GMT
Local: Mon, Jun 4 2007 10:02 pm
Subject: Python 3000: Standard API for archives?
I'm a relative newbie to Python, so please bear with me.  There are
currently two standard modules used to access archived data:  zipfile
and tarfile.  The interfaces are completely different.  In particular,
script wanting to analyze different types of archives must duplicate
substantial pieces of logic.  The problem is not limited to method
names; it includes how stat-like information is accessed.

I think it would be a good thing if a standardized interface existed,
similar to PEP 247.  This would make it easier for one script to access
multiple types of archives, such as RAR, 7-Zip, ISO, etc.  In
particular, a single factory class could produce PEP 302 import hooks
for future as well as current archive formats.

I think that an archive module adhering to the standard should adopt a
least-common-denominator approach, initially supporting read-only access
without seek, i.e. tar files on actual tape.  For applications that
require a seek method (such as importers) a standard wrapper class could
transparently cache archive members in temp files; this would fit in
well with Python 3000's rewrite of the I/O interface to support
stackable interfaces.  To this end, we'd need is_seekable and
is_writable attributes for both the module and instances (moduel level
would declare if something is possible, not if it is always true).

Most importantly, all archive modules should provide a standard API for
accessing their individual files via a single archive_content class that
provides a standard 'read' method.  Less importantly but nice to have
would be a way for archives to be auto-magically scanned during walks of
  directories.

Feedback?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google