{ "info": { "author": "Mark Embling", "author_email": "mark@markembling.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Topic :: System :: Archiving :: Backup" ], "description": "========\nStorelet\n========\n\nStorelet is a simple and easy to use framework for writing backup scripts in Python.\n\nIt currently supports the following:\n\n* Compression to a zip file\n* Inclusion of any number of directories\n* Creation of new directories and files\n* Uploading to Amazon S3\n\nRight now, that's all it does as it's all I've needed. I expect to add more as time goes on, but if something is missing or feels wrong, feel free to submit a pull request.\n\nI wrote this because Python is great at - amongst many things - writing small scripts like backup scripts and I think it's just as good as any custom tools or utilities you might find. Storelet just wraps up all the common boilerplate into a tiny little framework to write neat and easy to understand scripts.\n\nRequirements\n------------\n\nRight now, storelet has only been tested on Python 2.7 and will not work on older versions. Python 3.x support is to be added (currently waiting on either support in `boto` to be ready or for the new, currently experimental `boto3` to be production-ready. It also assumes the presence of the `zlib` library.\n\nInstall\n-------\n\n::\n\n $ pip install storelet\n \n\nGetting Started\n---------------\n\nYour backup scripts will be simple Python files. Simply import ``storelet`` and use as follows:\n\n::\n\n import storelet\n\n with storelet.ZipBackup(\"example\") as backup:\n backup.include_directory(\"/home/mark/some/directory\")\n backup.include_directory(\"/some/other/directory\")\n \n backup.save_to_s3(\"my-bucket\", \"\", \"\")\n\nThat's it. All the files in the given directories will be included in a zip file, which will then be uploaded to your S3 bucket and named ``example_20130421163000.zip`` (where the final string of characters is the current date and time in ``YYYYMMDDhhmmss`` form).\n\nIn the above example, all the files and directories found in the two directories will be found in the root of the zip file. You may wish to change this in a couple of ways, as outlined below.\n\nChanging include_directory behaviour\n------------------------------------\n\nPreserve the entire directory heirarchy in your zip file using the ``preserve_paths`` argument:\n\n::\n\n backup.include_directory(\"/home/mark/some/directory\", preserve_paths=True)\n \nPut all the files/directories inside a new directory in the zip file:\n\n::\n\n backup.include_directory(\"/home/mark/some/directory\", name=\"my_special_directory\")\n\nBoth arguments can be provided, in which case the entire heirarchy would be kept but nested inside the newly created directory. In addition, it is fine to use the same value for the ``name`` argument more than once. This will result in both directories' contents existing within a directory by that name.\n\nCreating new directories\n------------------------\n\nSometimes it's desirable to run additional commands (such as database backups for example) as part of a backup, and place these in a newly created directory. Storelet allows this using the following method:\n\n::\n\n from subprocess import call\n import storelet\n \n with storelet.ZipBackup(\"example\") as backup:\n with backup.include_new_dir(\"generated_directory\") as d:\n call([\"touch\", \"%s/touched.file\" % d])\n # any commands or python code can generate files here\n\nIn this basic example, a new directory will exist inside the final zip file called ``generated_directory``, and inside will be an empty file called ``touched.file`` that was created by calling the system's ``touch`` command.\n\nWhen ``with backup.include_new_dir(\"whatever\") as d:`` is called, a new temporary directory is created. The string representation of the resulting variable (``d``), or ``d.path`` contains the location on disk (``e.g. /tmp/whatever``). Commands (or any code you like) can be run which place files into this directory. At the end of the ``with`` block, the contents of that directory are then included in the generated zip file, in a directory with your given name.\n \nSaving the Backup\n-----------------\n\nRight now, the only backup process is uploading to Amazon S3:\n\n::\n \n backup.save_to_s3(\"my-bucket\", \"\", \"\")\n\nIn the future, it is my intention to add more methods of preserving the backups. Right now, this fulfils my requirements.\n\nBackup Types\n------------\n\nRight now, the only type of backup is a zip file, using ``ZipBackup``. In the future, I may add others such as tar files and so on. If you really don't want a zip file, storelet may not be right for you at the moment.\n\nLogging\n-------\n\nStorelet uses the standard `Python logging`_ mechanism, and also offers a convenience method for setting up some reasonable logging defaults.\n\n::\n \n import storelet\n\n storelet.setup_logging()\n\n # Backup stuff here\n\nThis will set up the logger to show all messages from INFO level upwards, and formats the output (which is sent to the standard output) to look like the following:\n\n::\n\n ...\n 2014-01-11 14:12:11,501 [INFO]: Added file /path/to/file1\n 2014-01-11 14:12:11,501 [INFO]: Added file /path/to/file2\n 2014-01-11 14:12:11,501 [INFO]: Added file /path/to/file3\n 2014-01-11 14:12:11,502 [INFO]: Added file /path/to/file4\n 2014-01-11 14:12:11,503 [INFO]: Added file /path/to/subdirectory/file1\n 2014-01-11 14:12:11,503 [INFO]: Added file /path/to/subdirectory/file2\n ...\n\nAny keyword arguments given to this method will be passed on to the logging configuration. Where you provide one which clashes with the default (e.g. if you provide a ``format`` argument), yours will take precedence.\n\n::\n\n # Use your own format instead of the default\n storelet.setup_logging(format=\"At %(asctime)s, this happened: %(message)s\")\n\n # Log to a file instead of the standard output\n storelet.setup_logging(filename=\"mybackups.log\")\n\nOf course, using this method is entirely optional. You may wish to set up logging a different way using any of the standard `Python logging`_ tools.\n\n::\n\n import storelet\n import logging\n\n logging.basicConfig(level=logging.INFO, \n format=\"At %(asctime)s, this happened: %(message)s\")\n\n # Backup stuff here\n\nMost of the normal status messages which are logged are done so at ``INFO`` level. You may wish to get verbose log output by specifying ``DEBUG`` level.\n\n::\n\n import storelet\n import logging\n\n storelet.setup_logging(level=logging.DEBUG)\n\nYou can also get access to the defaults used in storelet's ``setup_logging`` method:\n\n::\n\n storelet.LOGGING_DEFAULTS\n # returns a dict: {'format': '%(asctime)s [%(levelname)s]: %(message)s', 'level': logging.INFO}\n\nWarning\n-------\n\nThis is a very early release and the API is likely to change. Do not consider it stable until it hits 1.0. Don't complain if it eats your face.\n\n\n.. _Python Logging: http://docs.python.org/2/howto/logging.html", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/markembling/storelet", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "storelet", "package_url": "https://pypi.org/project/storelet/", "platform": "", "project_url": "https://pypi.org/project/storelet/", "project_urls": { "Homepage": "http://github.com/markembling/storelet" }, "release_url": "https://pypi.org/project/storelet/0.1.8/", "requires_dist": null, "requires_python": "", "summary": "Simple and easy framework for writing backup scripts", "version": "0.1.8" }, "last_serial": 3403651, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "274bb379fbae60c14efdccc9ee36a8e9", "sha256": "d15676303cd63c0bc46da877802ce5ca05dee99748b636864e4183c188cef6d5" }, "downloads": -1, "filename": "storelet-0.1.1-py2.7.egg", "has_sig": false, "md5_digest": "274bb379fbae60c14efdccc9ee36a8e9", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 5254, "upload_time": "2013-04-22T18:15:25", "url": "https://files.pythonhosted.org/packages/3c/ff/8200ddef1c686a26288b19b43c9357a1dcf083bb58e49d1bc72b02a7d44b/storelet-0.1.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "1e3b183621fce318972f22e2670b4294", "sha256": "2a8228537a41076efcbc42b62de67848d129b6c18c8929857b420bc8a3de1d89" }, "downloads": -1, "filename": "storelet-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1e3b183621fce318972f22e2670b4294", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4606, "upload_time": "2013-04-22T18:15:23", "url": "https://files.pythonhosted.org/packages/d9/63/56a75e6f1dd7e3ba258a23ea87a4e1a861f0693d11ddd23ce36f2a616752/storelet-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "730771e1cfe8bbd2c812ec7d06e3bde7", "sha256": "712fb81a63ad0959825c6319e20a6dcffc3d2ede224a1ed2250afba7e6c0fa28" }, "downloads": -1, "filename": "storelet-0.1.2-py2.7.egg", "has_sig": false, "md5_digest": "730771e1cfe8bbd2c812ec7d06e3bde7", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 5388, "upload_time": "2013-04-23T09:41:55", "url": "https://files.pythonhosted.org/packages/ba/e0/3295311669c4880f0cc1ba0649fdcf1be5640c625943e39f671ee1864918/storelet-0.1.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "412be95651ff5d4110b6150fa778bb6f", "sha256": "8728b384d4b2ff97746a0a976a5555a87ff77fe9a02c2205ab76fd168c571f50" }, "downloads": -1, "filename": "storelet-0.1.2.tar.gz", "has_sig": false, "md5_digest": "412be95651ff5d4110b6150fa778bb6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4714, "upload_time": "2013-04-23T09:41:52", "url": "https://files.pythonhosted.org/packages/f2/3c/7e3559167d1e8a677fb0e30b0a6890970d095e7e1125d188904a42a3f46f/storelet-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "355c4e2096cb4881988cf3266f35c6ea", "sha256": "f4fe3dc452a86aaf1a16effd05053921c1cc501210c9534fe83ab38d732041df" }, "downloads": -1, "filename": "storelet-0.1.3.tar.gz", "has_sig": false, "md5_digest": "355c4e2096cb4881988cf3266f35c6ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4776, "upload_time": "2014-01-01T17:15:14", "url": "https://files.pythonhosted.org/packages/cb/a3/a12fa3ebb4d7520577cc7fb1163b200899d88a6d5021f3b49b2526830c6a/storelet-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "d9ecb6b5f7f8a80c599f0a91725e30d6", "sha256": "cdd1b01590e67172894d9d2f162104fce7272f70bdac8b39da461ba2653c32f2" }, "downloads": -1, "filename": "storelet-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d9ecb6b5f7f8a80c599f0a91725e30d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6336, "upload_time": "2014-01-11T14:51:59", "url": "https://files.pythonhosted.org/packages/36/fc/ee1cb537000fe533e3b5c60af57e93d2e2277be0b389731a752f3ae46476/storelet-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "a8d911f72ad544518cd9bb5e9c94c498", "sha256": "adcb6857e7f69f63663876b895ff1224b96bdb9a72c90cee680ad5c30678438f" }, "downloads": -1, "filename": "storelet-0.1.5.tar.gz", "has_sig": false, "md5_digest": "a8d911f72ad544518cd9bb5e9c94c498", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6481, "upload_time": "2014-01-11T21:45:50", "url": "https://files.pythonhosted.org/packages/05/f1/82da646c66b628e333ff84cdec2b5ee05c7d5a8ee37119b803de593333e0/storelet-0.1.5.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "53c8a558391673280fb39142fa0eaa45", "sha256": "a248520b0baab67e74a58e6548c608dbf4fe86dd815f23d708924385f8adf79c" }, "downloads": -1, "filename": "storelet-0.1.7.tar.gz", "has_sig": false, "md5_digest": "53c8a558391673280fb39142fa0eaa45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6595, "upload_time": "2017-12-09T14:31:35", "url": "https://files.pythonhosted.org/packages/03/e2/e7e2967965c44ae47a373c7254893b5c47b7fe2aa7ae841ec519f26bd521/storelet-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "199d49a264c450bab14a8b337a97d8d0", "sha256": "1da5e49031527c1f13db0ea4358a65649e1ce17de2196bac0a4d5a0ca30ec33a" }, "downloads": -1, "filename": "storelet-0.1.8.tar.gz", "has_sig": false, "md5_digest": "199d49a264c450bab14a8b337a97d8d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6598, "upload_time": "2017-12-09T15:19:33", "url": "https://files.pythonhosted.org/packages/f3/eb/1608d338094a272b25a19104eaebcbe2c272e12150da3901876e6e3ce110/storelet-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "199d49a264c450bab14a8b337a97d8d0", "sha256": "1da5e49031527c1f13db0ea4358a65649e1ce17de2196bac0a4d5a0ca30ec33a" }, "downloads": -1, "filename": "storelet-0.1.8.tar.gz", "has_sig": false, "md5_digest": "199d49a264c450bab14a8b337a97d8d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6598, "upload_time": "2017-12-09T15:19:33", "url": "https://files.pythonhosted.org/packages/f3/eb/1608d338094a272b25a19104eaebcbe2c272e12150da3901876e6e3ce110/storelet-0.1.8.tar.gz" } ] }