{ "info": { "author": "Shengyi Pan", "author_email": "shengyi.pan1@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# IBM Cloud Object Storage Simple File System Library\n\n## Problems with ibm_boto3 library\nThe IBMCloud Cloud Object Service has very awful representation of objects under a bucket.\n\nFor example, if you are using ibm_boto3, you can only list all objects under a bucket so that you will probably end up \nwith a Python List of object keys in that bucket, such as:\n\n```python\n[\n \"source/\",\n \"source/year=2018/\",\n \"source/year=2018/month=08/\",\n \"source/year=2018/month=08/day=28/\",\n \"source/year=2018/month=08/day=28/test1.txt\",\n \"source/year=2018/month=08/day=28/test.txt\",\n \"source/year=2018/month=08/day=29/\",\n \"source/year=2018/month=08/day=29/test.txt\",\n \"source/year=2018/month=08/day=30/\",\n \"source/year=2018/month=08/day=30/test.txt\",\n \"source/year=2018/month=08/day=31/\",\n \"source/year=2018/month=08/day=31/test.txt\",\n \"source/year=2019/month=01/day=01/\",\n \"source/year=2019/month=01/day=01/test.txt\" \n]\n```\n\nThis is really awful when you are trying to get the \"end files\" (i.e. those test.txt files in above example); and it is really difficult to understand the structure of this bucket.\n\n## What this library does?\nThis library adds a presentation layer above boto3, which expresses the flat representation of objects in a bucket (i.e. Python list) as a tree-like data structure. As such, the bucket \ncan be represented as a file system, with the concepts of folders/directories and files. Currently, this library is able to simulate file\nsystem commands such as \"cd\" and \"ls\". This library also provides APIs for getting files in the bucket, see the Usages in next section.\n\nFor the above bucket objects, this library will represent it as\n\n```\ntest-bucket/ \n\u2514\u2500 source/ \n \u2514\u2500 year=2018/ \n \u2514\u2500 month=08/ \n \u2514\u2500 day=28/ \n \u2514\u2500 test1.txt \n \u2514\u2500 test.txt \n \u2514\u2500 day=29/ \n \u2514\u2500 test.txt \n \u2514\u2500 day=30/ \n \u2514\u2500 test.txt \n \u2514\u2500 day=31/ \n \u2514\u2500 test.txt \n \u2514\u2500 year=2019/ \n \u2514\u2500 month=01/ \n \u2514\u2500 day=01/ \n \u2514\u2500 test.txt\n```\n\n## Concepts\n* Boto3 object and Key: in boto3, an object's key is represented as string like \"test-bucket/source/\".\n* Path: a path in this simple FS starts with bucket name, for example a path \"test-bucket/source/\" represents boto3 object \"source/\".\n* Leaves: a leaf is a COSBucketTreeNode object whose boto3 object representation is NOT a common prefix for any other boto3 objects. For example, \"source/year=2018/month=08/day=28/test1.txt\" in above example is a leaf's boto3 object representation.\n\n## Installation\nProject is available at Pypi: https://pypi.org/project/ibm-cos-simple-fs/\n```\npip install ibm-cos-simple-fs\n```\n\n## Usage\n**Note, paths output from this library is ALWAYS appended by bucket name thus in the form of 'bucket_name/path/to/your/stuff.txt'.\nWhen using key names with boto3 library, you should post-process the path to ignore the \"bucket_name/\" part.**\n```\n> from ibm_cos_fs.bucket_tree import COSBucketTree\n\n# Given flat_object_list being the one in Problem statement, building a tree structure using:\n> tree = COSBucketTree(bucket_name='test-bucket', object_list=flat_object_list) # flat_object_list should be a list of strings\n\n# Get all leaves as a list of path strings\n> leaf_paths = tree.get_leaf_paths()\n\n# Print the tree representation of the file system structure\n> tree.print() \n\n# To get all the children nodes of a given boto3 object key, say 'source/year=2018/month=8/'\n> node = tree.get_node_from_key('source/year=2018/month=8/') # This is to simulate 'cd source/year=2018/month=8/' in a file system.\n> node.children # To get the children_node as a {name: TreeNode} map\n# Or\n> node.list_children() # To get a list of children as string. This is to simulate 'ls source/year=2018/month=8/' in a file system.\n\n# This library also provides APIs to get leaves under a node\n# To get all the leaves under a given object key, say 'source/year=2018/month=8/day=29/'\n# Firstly, find the node for this key\n> node = tree.get_node_from_key('source/year=2018/month=8/day=29/') \n> node.is_dir # will show whether or not current node is a directory\n\n# Then, get the leaves nodes from a specific node\n> leaf_nodes = tree.get_leaves(node) # Note, all_leaves = tree.get_leaves() will return all leaves from root\n\n# You can then convert them to string representation (i.e. paths) by\n> [str(l) for l in leaf_nodes] # or [l.path for l in leaf_nodes]\n\n# In addition, you can get leaves as boto3 object keys\n> [l.key for l in leaf_nodes]\n\n# To get the directory that contains all given leaves; this is reverse operation to get_leaves(common_parent_node)\n> common_parent_node = tree.get_common_parent_for_leaves(leaf_nodes)\n```\n\n## Creator\nCopyright \u00a9 2019 Shengyi Pan\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/psyking841/ibm-cos-simple-fs", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ibm-cos-simple-fs", "package_url": "https://pypi.org/project/ibm-cos-simple-fs/", "platform": "", "project_url": "https://pypi.org/project/ibm-cos-simple-fs/", "project_urls": { "Homepage": "https://github.com/psyking841/ibm-cos-simple-fs" }, "release_url": "https://pypi.org/project/ibm-cos-simple-fs/0.0.8/", "requires_dist": null, "requires_python": "", "summary": "A package for representing IBM Cloud Object Storage (COS) bucket like a file system.", "version": "0.0.8" }, "last_serial": 4931399, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "3143cd11b6045dc237fc9df0e2de554a", "sha256": "d1476e58eac7386fe9bd66105d5f166fad8f92b2251f2979fa507eec4729cf8d" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3143cd11b6045dc237fc9df0e2de554a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5558, "upload_time": "2019-03-05T21:35:51", "url": "https://files.pythonhosted.org/packages/a3/c3/6db0490eb1d3d6dbfd9a2c94a11306458d34287bfbd40cfdf0c503365fea/ibm_cos_simple_fs-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "015723d5c6ecf890c372f2cae02cab86", "sha256": "0e7e26f20906f7baa1b0a73412d377bc4b8e94ef8c5e552c5ce29f6c91dd4808" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.2.tar.gz", "has_sig": false, "md5_digest": "015723d5c6ecf890c372f2cae02cab86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4380, "upload_time": "2019-03-05T21:35:52", "url": "https://files.pythonhosted.org/packages/15/38/5879e7fe4b2bf4866c3cf1089c9bd9b6c7a1340d7cfeb11bd83d75c46e87/ibm-cos-simple-fs-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4dbcbbe16b7a69978e8c76f41d168283", "sha256": "257d055f6ef05bf039a04c032e56c9d986100832cb9efd5459601911f367a670" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4dbcbbe16b7a69978e8c76f41d168283", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5598, "upload_time": "2019-03-05T21:50:43", "url": "https://files.pythonhosted.org/packages/54/32/a932b0564568cfa20be90d6be351385e5b65670b024e863e7c1f7ab582a1/ibm_cos_simple_fs-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c1a90b6f5a943d8c5f40ab3bf972e77", "sha256": "cdff7f8a732f4c46f21f6b45d65d67682f39b01b90a4dd40ad39a24783071e07" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9c1a90b6f5a943d8c5f40ab3bf972e77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4422, "upload_time": "2019-03-05T21:50:44", "url": "https://files.pythonhosted.org/packages/4e/7c/fb217292a65b8b3de198b7d429102153507b90aea3026852805d4d19f62d/ibm-cos-simple-fs-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "bdf0aa537e8778f18a053a09ea54ddd1", "sha256": "8ea4f941a6d04ec71b4c40e84b1342365ba86b255ca3c4a0d3ee4b0171f3c35f" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "bdf0aa537e8778f18a053a09ea54ddd1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5648, "upload_time": "2019-03-05T22:00:01", "url": "https://files.pythonhosted.org/packages/37/5e/a9b4e803d3d49493dfda46e3f5f5713b825eb0d784ba3578fc9330c8f85f/ibm_cos_simple_fs-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69920a0a98237957266575b406346a18", "sha256": "17742697dc2d86c6c2794e9a61deed7d1ccbdb648175d3ef7c553a150573f5cc" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.4.tar.gz", "has_sig": false, "md5_digest": "69920a0a98237957266575b406346a18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4488, "upload_time": "2019-03-05T22:00:02", "url": "https://files.pythonhosted.org/packages/eb/49/72089fefdfc22943ca59e4a4ec42c255c989fdc51bef9889481b9d313f4e/ibm-cos-simple-fs-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "62192a3a613b6817efd81c887de62ea1", "sha256": "59a68e3726646fe2cceed8c0c4cd165b592882fb4a0dfd9cfe079831f90f1a47" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "62192a3a613b6817efd81c887de62ea1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6167, "upload_time": "2019-03-06T19:36:38", "url": "https://files.pythonhosted.org/packages/9f/ad/96aed2607589fdc5e6e3c31908d3a93fe55228210319a810e0b399291bea/ibm_cos_simple_fs-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "310176aad4648a7d1748117735b51c6e", "sha256": "7b36718dee497e9cfba99a26df53c13d362d7c8468f784fbe61ea098f1a8821a" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.5.tar.gz", "has_sig": false, "md5_digest": "310176aad4648a7d1748117735b51c6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4988, "upload_time": "2019-03-06T19:36:40", "url": "https://files.pythonhosted.org/packages/7d/d5/326ff10971c9d341fa0c95584b46d45ed389aa1ae5c1b1e1f7dfb180f109/ibm-cos-simple-fs-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "17ade5cc04d494e7c2ce2e959444ed04", "sha256": "5a2cc3b3b470aa74edd2a5aea134a9af8ea30bd5ccc02ab211a50ebd03533ccd" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "17ade5cc04d494e7c2ce2e959444ed04", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6856, "upload_time": "2019-03-07T21:53:20", "url": "https://files.pythonhosted.org/packages/c5/c7/413acd43a4ed177dc11423eb58ea4231abf23209f5090173c44ad764b399/ibm_cos_simple_fs-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fa2bf0419107d2d49f2b6668ae25f48e", "sha256": "788e21a8a5399541f665c879197393167598eb6a5796e78e49de4010459f782b" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.6.tar.gz", "has_sig": false, "md5_digest": "fa2bf0419107d2d49f2b6668ae25f48e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5714, "upload_time": "2019-03-07T21:53:21", "url": "https://files.pythonhosted.org/packages/17/f8/d3764d1ec3551caab7d7afabcf7ead77db7e060d6fac80ac8baa2881f798/ibm-cos-simple-fs-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "4d5718832d19c22a69a5ff50ff211542", "sha256": "79fa90538e1943e389dd6e2a4fad4025975011f3aaa180c871385841a0012750" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "4d5718832d19c22a69a5ff50ff211542", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6987, "upload_time": "2019-03-08T20:14:12", "url": "https://files.pythonhosted.org/packages/25/cb/6a5cb8cce98e21f4ede3dc0a61ede93302fb242c7765d48a795fb706bfb4/ibm_cos_simple_fs-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7afbd0dd3a537aed94680325b4839b10", "sha256": "6f98b8431864776f866e81b9ea227de277999be33baf015ce155fb98be38eee7" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.7.tar.gz", "has_sig": false, "md5_digest": "7afbd0dd3a537aed94680325b4839b10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5825, "upload_time": "2019-03-08T20:14:13", "url": "https://files.pythonhosted.org/packages/67/fc/8fc49f896320b114b28f874abe095a97ddcfae644283b2a6d955c178d3f5/ibm-cos-simple-fs-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "3a0b0ee5e4a3ae5ea4d6c710ee60db85", "sha256": "f9ec2131dcee4840c5df83f72c61d3a808729d0116d3cbfb9205b6a2f7106810" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "3a0b0ee5e4a3ae5ea4d6c710ee60db85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7346, "upload_time": "2019-03-12T18:32:47", "url": "https://files.pythonhosted.org/packages/61/a4/359d08bf622ea699cdf7cb483489700cdb1d0625881a231c18312e8bdb1b/ibm_cos_simple_fs-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e53ed02f0e551e58c5f64dfeb4033c65", "sha256": "dfae23102c52bb177c785284788ac7df4270fe6d8062e0c64efe503c7b37e5e7" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.8.tar.gz", "has_sig": false, "md5_digest": "e53ed02f0e551e58c5f64dfeb4033c65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6141, "upload_time": "2019-03-12T18:32:48", "url": "https://files.pythonhosted.org/packages/f9/72/2e48b14de416e12d494a4bef0cdafdeb98f1056d4e126420efa0fdabfdc1/ibm-cos-simple-fs-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a0b0ee5e4a3ae5ea4d6c710ee60db85", "sha256": "f9ec2131dcee4840c5df83f72c61d3a808729d0116d3cbfb9205b6a2f7106810" }, "downloads": -1, "filename": "ibm_cos_simple_fs-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "3a0b0ee5e4a3ae5ea4d6c710ee60db85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7346, "upload_time": "2019-03-12T18:32:47", "url": "https://files.pythonhosted.org/packages/61/a4/359d08bf622ea699cdf7cb483489700cdb1d0625881a231c18312e8bdb1b/ibm_cos_simple_fs-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e53ed02f0e551e58c5f64dfeb4033c65", "sha256": "dfae23102c52bb177c785284788ac7df4270fe6d8062e0c64efe503c7b37e5e7" }, "downloads": -1, "filename": "ibm-cos-simple-fs-0.0.8.tar.gz", "has_sig": false, "md5_digest": "e53ed02f0e551e58c5f64dfeb4033c65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6141, "upload_time": "2019-03-12T18:32:48", "url": "https://files.pythonhosted.org/packages/f9/72/2e48b14de416e12d494a4bef0cdafdeb98f1056d4e126420efa0fdabfdc1/ibm-cos-simple-fs-0.0.8.tar.gz" } ] }