This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Log, catalogue, and move python objects via pickling

Project Description

Smuggle

Catalogue python pickles to reduce development and troubleshooting time.

Description

Smuggle organizes copies of python objects chronologically, using the pickle format, so that they can be retrieved in a new python session. This allows new approaches during development and troubleshooting production issues. Since objects can be moved from a prod to dev environment, smuggle becomes exceptionally handy for projects involving complicated cases or non-idempotent processes.

When used correctly, it can also reduce the need for verbosity in logging and certain types of error messages.

Usage

from smuggle import Smuggler

MySmuggler = Smuggler("C:\MyObjectLogFolder")

aList = [1,2,3]
aDict = {'a' : 1, 'b' : 2, 'c' : 3}

MySmuggler.smuggle(MyList=aList,MyDict=aDict,NoteToSelf="This is cool")

print(MySmuggler.passphrases())

Output

There are two forms of output & access; passphrases and payloads.

Passphrase

A passphrase is just auto-generated python code, which looks like this:

import pickle

# NoteToSelf of type 'str' was smuggled at 21:02:06, 2015/02/01
#   'This is cool'
NoteToSelf = pickle.load(open(r"C:\MyObjectLogFolder\NoteToSelf-2015-02-01-21-02-06.smug","rb"))

# MyList of type 'list' was smuggled at 21:02:06, 2015/02/01
#   [1, 2, 3]
MyList = pickle.load(open(r"C:\MyObjectLogFolder\MyList-2015-02-01-21-02-06.smug","rb"))

# MyDict of type 'dict' was smuggled at 21:02:06, 2015/02/01
#   {'a': 1, 'c': 3, 'b': 2}
MyDict = pickle.load(open(r"C:\MyObjectLogFolder\MyDict-2015-02-01-21-02-06.smug","rb"))

This output is just a copy+paste away from functioning in a new python file.

Payload

A payload is a collection of organized pickles accessible via the catalogue functions. There are many plans to expand the catalogue system (eg. SQLite, keyword, time, etc.). The current system is limited to a very simple file naming convention which includes the time and date. Payloads just scan a folder for .smug files. These files, are simply pickle files. No other changes are made to the file format.

>>> MyPayload = Payload("C:\MyObjectLogFolder")
>>> varlist = MyPayload.aslist()
>>> varlist
[{'a': 1, 'c': 3, 'b': 2}, [1, 2, 3], 'This is cool']

Requirements

Python

Works on 2.6, 2.7, 3.3 and 3.4.

Install (OSX, Linux, Posix)

The easiest way to install is with pip:

sudo pip install smuggle

Or manually (assuming all required modules are installed on your system):

sudo python ./setup.py install

Instructions for Windows

  1. Start Menu > Accessories > Command Prompt
  2. Run the following command: pip install smuggle

Contributing

Pull requests are welcome. To test, use nosetests smuggle or py.test.

Release History

Release History

This version
History Node

0.2.0

History Node

0.1rc2

History Node

0.1rc1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
smuggle-0.2.0.zip (10.1 kB) Copy SHA256 Checksum SHA256 Source Mar 2, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting