{ "info": { "author": "crohaco", "author_email": "crohaco.net@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Topic :: Software Development" ], "description": "Requirements\n============\n- Python 2.7\n- Python 3.4\n\nInstall\n=======\n\n.. code-block:: sh\n\n $ pip install bak\n\nUsage\n=====\n\nBasic Example\n-------------\n\n**save**\n\n.. code-block:: python\n\n In [1]: !cat test.txt\n test\n\n In [2]: import bak\n In [3]: item = bak.Item('test.txt', 'savedir')\n # item save as archive in the savedir.(default tar bz2)\n # it is same folder with item if savepath is not specified.\n In [4]: item.save()\n In [5]: !ls savedir/\n test.txt.20150321200204.tbz\n\n # item does not save if it has no change.\n In [6]: item.save()\n In [7]: !ls savedir/\n test.txt.20150321200204.tbz\n\n # if you want save item that has no change, specify force option.\n In [8]: item.save(force=True)\n In [9]: !ls savedir/\n test.txt.20150321200204.tbz test.txt.20150321200227.tbz\n\n # confirm backup files as item.archives.\n In [10]: item.archives\n Out[10]: ['test.txt.20150321200227.tbz', 'test.txt.20150321200204.tbz']\n\n\n**restore**\n\n.. code-block:: python\n\n In [11]: !echo 'change!' > test.txt\n In [12]: item.restore()\n In [13]: !cat test.txt\n test\n\n # Normally, item saves it as current-archive the current item in the same folder.\n In [14]: !ls savedir/\n test.txt.20150321200204.tbz test.txt.current.tbz\n\n # item.archives does not contain current-archive.\n In [15]: item.archives\n Out[15]: ['test.txt.20150321200204.tbz']\n\n # item does not restore if it has no change.\n In [16]: item.restore()\n In [17]: !ls savedir/\n test.txt.20150321200204.tbz test.txt.current.tbz\n\n In [18]: !rm savedir/test.txt.current.tbz\n # if specified refuge_current \"false\", current-archive does not save.\n In [19]: item.restore(force=True, refuge_current=False)\n In [20]: !ls savedir/\n\n\nRotation Example\n----------------\nThis is a sample to delete from the oldest archive.\n\n.. code-block:: python\n\n In [1]: import bak\n In [2]: item = bak.Item('test.txt', 'savedir')\n\n # add handler by item.on, specify Signal and Behavior set.\n # FillSignal: archive number reaches value specified, execute behavior.\n # RemoveBehavior: remove specified index(es) of archive(s).\n In [3]: item.on(bak.FillSignal(3), bak.RemoveBehavior(-1))\n Out[3]: \n\n In [4]: item.archives\n Out[4]: []\n\n In [5]: item.save(force=True)\n In [6]: item.archives\n Out[6]: ['test.txt.20150321204308.tbz']\n\n In [7]: item.save(force=True)\n In [8]: item.archives\n Out[8]: ['test.txt.20150321204313.tbz', 'test.txt.20150321204308.tbz']\n\n In [9]: item.save(force=True)\n In [10]: item.archives\n Out[10]: ['test.txt.20150321204319.tbz', 'test.txt.20150321204313.tbz']\n\n\nHistory\n=======\n0.2.x\n-----\n- Added handler function with the following.\n\n - Signal(FillSignal, CronSignal, LastTimeSignal)\n - Behavior(RemoveBehavior only)\n\n- history attribute renamed to archives.\n\n0.1.x\n-----\n- There is no change in the file(or directory), it does not save and restore.\n- Added Exceptions.\n- Added Tests.\n\n0.0.x\n-----\n- First release.\n\n\nTODO\n----\n- make the reference.\n- add FTP Behavior.\n- provide command.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/crohaco/bak", "keywords": "backup", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "bak", "package_url": "https://pypi.org/project/bak/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bak/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/crohaco/bak" }, "release_url": "https://pypi.org/project/bak/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "simple file backup library.", "version": "0.2.0" }, "last_serial": 1944350, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "43d1cb71b58a33f3e71ba373070648af", "sha256": "d8904fed89108557e943d308d4776c37eab61f022a4b628fd5efe6d0679805cc" }, "downloads": -1, "filename": "bak-0.0.0.tar.gz", "has_sig": false, "md5_digest": "43d1cb71b58a33f3e71ba373070648af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3129, "upload_time": "2015-01-30T15:58:45", "url": "https://files.pythonhosted.org/packages/c6/a8/0ea7ed07beae9a74fa394eda80516aaaaba985eec82120d05e6ab0b5129a/bak-0.0.0.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "0e73f1342a5589b4a6584c2dfc7929aa", "sha256": "fa60f7968ae4722dac1f2dd606e8dd21cabe06e8d69d85fedb876085ffa07e7a" }, "downloads": -1, "filename": "bak-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0e73f1342a5589b4a6584c2dfc7929aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3020, "upload_time": "2015-02-01T16:08:34", "url": "https://files.pythonhosted.org/packages/11/9c/c61dfe2b509e0bcf36b2f9cfa5a03b49a73258a6d9c39023bcfbd610a205/bak-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d60ee2b9887b51a38f9e0c10391d0e02", "sha256": "b3680997a04f4767bbb7b552c95216453e424b1c7e38d00ee6acd722f64e2eb3" }, "downloads": -1, "filename": "bak-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d60ee2b9887b51a38f9e0c10391d0e02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3112, "upload_time": "2015-02-08T16:58:33", "url": "https://files.pythonhosted.org/packages/65/c8/ef89b6e919c7d35e5b9cd0039e6dd2e59357be62c1445bc797fd5cd8d384/bak-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "428bafdb3a97e98e922352b622df4cb5", "sha256": "243c11b66d261c9bf1db4a7da4ec925be39835e6bdabfc9d9e9dea763a56e3e9" }, "downloads": -1, "filename": "bak-0.2.0.tar.gz", "has_sig": false, "md5_digest": "428bafdb3a97e98e922352b622df4cb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8794, "upload_time": "2015-03-21T12:14:57", "url": "https://files.pythonhosted.org/packages/a5/65/c433b8e015787deb9df1117cfbc9ede2e7abd581346e0d8b5a1218e581ca/bak-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "428bafdb3a97e98e922352b622df4cb5", "sha256": "243c11b66d261c9bf1db4a7da4ec925be39835e6bdabfc9d9e9dea763a56e3e9" }, "downloads": -1, "filename": "bak-0.2.0.tar.gz", "has_sig": false, "md5_digest": "428bafdb3a97e98e922352b622df4cb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8794, "upload_time": "2015-03-21T12:14:57", "url": "https://files.pythonhosted.org/packages/a5/65/c433b8e015787deb9df1117cfbc9ede2e7abd581346e0d8b5a1218e581ca/bak-0.2.0.tar.gz" } ] }