i2mint/py2store

KV perspectives for standard libs

Opened this issue · 1 comments

Lots of the standard libs that come for free with python have, or could have, one or several read or read/write k/v perspectives.

We covered zipfile module with ZipReader already (still need to extend to ZipPersister), the csv module, but there's many more...

  • configparser
  • sqlite3
  • wave
  • chunk
  • zlib
  • gzip
  • bs2
  • lzma
  • tarfile
  • plistfile
  • dbm
  • mailbox.Maildir (mailbox.Mailbox already has a kv interface)
  • codecs

And of course, there's subsets of the modules that could use some kv interfaces. For example, consider inspect.Signature which contains some inspect.Parameter elements. Both dict-like.

As always, start as close to wrapped module as possible first, then transform/subclass/layer to create easier interfaces, consistency groups, or useful extensions.

Consider consistency groups of extensions. For example, any SpecificKvFileReader that takes a file as an input could be extended to a 'SpecificKvDirReaderwhose keys are the file paths or names of the directory and whose values areSpecificKvFileReader(file)`. It's a common useful pattern, so should be implemented as such.

linecache: Wrap to create list-like interface to file lines. If lines themselves are structured (such as csv), can go deeper in the list-like interface.