{ "info": { "author": "Body Labs", "author_email": "alex@bodylabs.com, paul.melnikow@bodylabs.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "metabaiji-pod\n=============\n\n|pip install| |version| |python versions| |build status| |last commit|\n|open pull requests|\n\nThis is an active fork of\n`baiji-pod `__, Body Labs\u2019 asset\ncache for S3 using `baiji `__.\n\nThe fork\u2019s goals are modest:\n\n- Keep the library working in current versions of Python and other\n tools.\n- Make bug fixes.\n- Provide API stability and backward compatibility with the upstream\n version.\n- Respond to community contributions.\n\nIt\u2019s used by related forks such as\n`lace `__.\n\nInstallation\n------------\n\nInstall the fork:\n\n.. code:: sh\n\n pip install metabaiji-pod\n\nAnd import it just like the upstream library:\n\n.. code:: py\n\n from baiji.pod import AssetCache\n from baiji.pod import Config\n from baiji.pod import VersionedCache\n\nOverview\n--------\n\nVersioned-tracked assets and a low-level asset cache for Amazon S3,\nusing `baiji `__.\n\nFeatures\n--------\n\n- Versioned cache for version-tracked assets\n\n - Creates a new file each time it changes\n - Using a checked-in manifest, each revision of the code is pinned\n to a given version of the file\n - Convenient CLI for pushing updates\n\n- Low-level asset cache, for any S3 path\n\n - Assets are stored locally, and revalidated after a timeout\n\n- Prefill tool populates the caches with a list of needed assets\n- Supports Python 2.7\n- Supports OS X, Linux, and Windows\n\n - A few dev features only work on OS X\n\n- Tested and production-hardened\n\nThe versioned cache\n~~~~~~~~~~~~~~~~~~~\n\nThe versioned cache provides access to a repository of files. The\nchanges to those files are tracked and identified with to a semver-like\nversion number.\n\nTo use the versioned cache, you need a copy of a manifest file, which\nlists all the versioned paths and the latest version of each one. When\nyou request a file from the cache, it consults this manifest file to\ndetermine the correct version. The versioned cache delegates loading to\nthe underlying asset cache.\n\nThe versioned cache was designed for compute assets: chunks of data\nwhich are used in code. When the manifest is checked in with the code,\nit pins the version of each asset. If the asset is subsequently updated,\nthat revision of the code will continue to get the version it\u2019s\nexpecting.\n\nThe bucket containing the versioned assets is intended to be immutable.\nNothing there should ever be changed or deleted. Only new versions\nadded.\n\nThe manifest looks like this:\n\n.. code:: json\n\n {\n \"/foo/bar.csv\": \"1.2.5\",\n \"/foo/bar.json\": \"0.1.6\"\n }\n\nTo load a versioned asset:\n\n::\n\n import json\n from baiji.pod import AssetCache\n from baiji.pod import Config\n from baiji.pod import VersionedCache\n\n config = Config()\n # Improve performance by assuming the bucket is immutable.\n config.IMMUTABLE_BUCKETS = ['my-versioned-assets']\n\n vc = VersionedCache(\n cache=AssetCache(config),\n manifest_path='versioned_assets.json',\n bucket='my-versioned-assets')\n\n with open(vc('/foo/bar.json'), 'r') as f:\n data = json.load(f)\n\nOr, with\n```baiji-serialization`` `__:\n\n::\n\n from baiji.serialization import json\n data = json.load(vc('s3://example-bucket/example.json'))\n\nTo add a new versioned path, or update an existing one, use the ``vc``\ncommand-line tool:\n\n::\n\n vc add /foo/bar.csv ~/Desktop/bar.csv\n vc update --major /foo/bar.csv ~/Desktop/new_bar.csv\n vc update --minor /foo/bar.csv ~/Desktop/new_bar.csv\n vc update --patch /foo/bar.csv ~/Desktop/new_bar.csv\n\nA VersionedCache object is specific to a manifest file and a bucket.\n\nThough the version number uses semver-like semantics, the cache ignores\nversion semantics. The manifest pins an exact version number.\n\nThe asset cache\n~~~~~~~~~~~~~~~\n\nThe asset cache works at a lower level of abstraction. It holds local\ncopies of arbitrary S3 assets. Calling the ``cache()`` function with an\nS3 path ensures that the file is available locally, and then returns a\nvalid, local path.\n\nOn a cache miss, the file is downloaded to the cache and then its local\npath is returned. Subsequent calls will return the same local path.\nAfter a timeout, which defaults to one day, the validity of the local\nfile is checked by comparing a local MD5 hash with the remote etag. This\ncheck is repeated once per day.\n\nTo gain a performance boost, you can configure immutable buckets, whose\ncontents are never revalidated after download. The versioned cache uses\nthis feature.\n\n::\n\n import json\n from baiji.pod import AssetCache\n\n cache = AssetCache.create_default()\n\n with open(cache('s3://example-bucket/example.json'), 'r') as f:\n data = json.load(f)\n\nOr, with\n```baiji-serialization`` `__:\n\n::\n\n from baiji.serialization import json\n data = json.load(cache('s3://example-bucket/example.json'))\n\nIt is safe to call ``cache`` multiple times: ``cache(cache('path'))``\nwill behave correctly.\n\nTips\n----\n\nWhen you\u2019re developing, you often want to try out variations on a file\nbefore committing to a particular one. Rather than incrementing the\npatch level over and over, you can set ``manifest.json`` to include an\nabsolute path:\n\n::\n\n \"/foo/bar.csv\": \"/Users/me/Desktop/foo.obj\",\n\nThis can be either a local or an s3 path; use local if you\u2019re iterating\nby yourself, and s3 to iterate with other developers or in CI.\n\nDevelopment\n-----------\n\n.. code:: sh\n\n pip install -r requirements_dev.txt\n rake unittest\n rake lint\n\nTODO\n----\n\n- Add vc config to config\n\n - Explain or clean up the weird default_bucket config logic in\n prefill_runner. e.g.\u00a0This logic is so that we can have a\n customized script in core that doesn\u2019t require these arguments.\n\n- Use config without subclassing. Pass overries to init\n- Configure using an importable config path instead of injecting. Or,\n possibly, allow ~/.aws/baiji_config to change defaults.\n- Rework baiji.pod.util.reachability and perhaps\n baiji.util.reachability as well.\n- Restore CDN publish functionality in core\n- Avoid using actual versioned assets. Perhaps write some (smaller!)\n files to a test bucket and use those?\n- Remove suffixes support in vc.uri, used only for CDNPublisher\n- Move yaml.dump and json.\\* to baiji. Possibly do a\n ``try: from baiji.serialization.json import load, dump; except ImportError: def load(...``\n Or at least have a comment to the effect of \u201cdon\u2019t use this, use\n baiji.serialization.json\u201d\n- Use consistent argparse pattern in the runners.\n- I think it would be better if the CacheFile didn\u2019t need to know about\n the AssetCache, to avoid this bi-directional dependency. It\u2019s only\n required in the constructor, but that could live on the AssetCache,\n e.g. create_cache_file(path, bucket=None).\n\nContribute\n----------\n\n- Issue Tracker: https://github.com/metabolize/baiji-pod/issues\n- Source Code: https://github.com/metabolize/baiji-pod\n\nPull requests welcome!\n\nSupport\n-------\n\nIf you are having issues, please let us know.\n\nAcknowledgements\n----------------\n\nbaiji-pod was developed at Body Labs, primarily by `Alex\nWeiss `__ and `Paul\nMelnikow `__.\n\nLicense\n-------\n\nThe project is licensed under the Apache license, version 2.0.\n\n.. |pip install| image:: https://img.shields.io/badge/pip%20install-metabaiji--pod-f441b8.svg?style=flat-square\n :target: https://pypi.org/project/metabaiji-pod/\n.. |version| image:: https://img.shields.io/pypi/v/metabaiji-pod.svg?style=flat-square\n :target: https://pypi.org/project/metabaiji-pod/\n.. |python versions| image:: https://img.shields.io/pypi/pyversions/metabaiji-pod.svg?style=flat-square\n :target: https://pypi.org/project/metabaiji-pod/\n.. |build status| image:: https://img.shields.io/circleci/project/github/metabolize/baiji-pod/master.svg?style=flat-square\n :target: https://circleci.com/gh/metabolize/baiji-pod\n.. |last commit| image:: https://img.shields.io/github/last-commit/metabolize/baiji-pod.svg?style=flat-square\n :target: https://github.com/metabolize/baiji-pod/commits/master\n.. |open pull requests| image:: https://img.shields.io/github/issues-pr/metabolize/baiji-pod.svg?style=flat-square\n :target: https://github.com/metabolize/baiji-pod/pulls", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/metabolize/baiji-pod", "keywords": "", "license": "Apache", "maintainer": "", "maintainer_email": "", "name": "metabaiji-pod", "package_url": "https://pypi.org/project/metabaiji-pod/", "platform": "", "project_url": "https://pypi.org/project/metabaiji-pod/", "project_urls": { "Homepage": "https://github.com/metabolize/baiji-pod" }, "release_url": "https://pypi.org/project/metabaiji-pod/1.1.1/", "requires_dist": null, "requires_python": "", "summary": "Active fork of baiji-pod, Body Labs' asset cache for S3 using baiji", "version": "1.1.1" }, "last_serial": 5744048, "releases": { "1.0.7.post1": [ { "comment_text": "", "digests": { "md5": "929282b125d737cd6ff0fc3fabf04482", "sha256": "0bd9151c8fabb34efaa8261fbc6223c201a06c599264ef977e966b928a4316e2" }, "downloads": -1, "filename": "metabaiji-pod-1.0.7.post1.tar.gz", "has_sig": false, "md5_digest": "929282b125d737cd6ff0fc3fabf04482", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24481, "upload_time": "2018-09-09T01:47:25", "url": "https://files.pythonhosted.org/packages/56/93/76d6ae5b04dc65be16d0c832ea837744c4850747cc8f05a58cee2463ef76/metabaiji-pod-1.0.7.post1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "8704aa3b8a7f88955b326c5555cb0800", "sha256": "23f94a1e1c958f93c484b7881bd77df1dbaa5edb9d61290d4dbafa4cb1c39664" }, "downloads": -1, "filename": "metabaiji-pod-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8704aa3b8a7f88955b326c5555cb0800", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24548, "upload_time": "2019-08-28T17:14:04", "url": "https://files.pythonhosted.org/packages/fc/9f/3f584cf5df480d99bed691d5caba1f4e25d4866906ee95ba534d0cc1ef11/metabaiji-pod-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "7f7faf83b736033ef68fe96750b12c79", "sha256": "5758345d5e817c71db26e2e394b2e3b8f10feb457c9b0cf69cba9d478109bb7a" }, "downloads": -1, "filename": "metabaiji-pod-1.1.1.tar.gz", "has_sig": false, "md5_digest": "7f7faf83b736033ef68fe96750b12c79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24549, "upload_time": "2019-08-28T17:19:49", "url": "https://files.pythonhosted.org/packages/09/b9/378eb55b06b7fdcff5e91fdc2f973382d39587cae63412975f12480a6e55/metabaiji-pod-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f7faf83b736033ef68fe96750b12c79", "sha256": "5758345d5e817c71db26e2e394b2e3b8f10feb457c9b0cf69cba9d478109bb7a" }, "downloads": -1, "filename": "metabaiji-pod-1.1.1.tar.gz", "has_sig": false, "md5_digest": "7f7faf83b736033ef68fe96750b12c79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24549, "upload_time": "2019-08-28T17:19:49", "url": "https://files.pythonhosted.org/packages/09/b9/378eb55b06b7fdcff5e91fdc2f973382d39587cae63412975f12480a6e55/metabaiji-pod-1.1.1.tar.gz" } ] }