{ "info": { "author": "Gareth Rushgrove", "author_email": "gareth@morethanseven.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# Python CNAB Library\n\n_Work-in-progress_ library for working with [CNAB](https://cnab.io/) in Python.\n\nThere are probably three main areas of interest for a CNAB client:\n\n1. Handling the `bundle.json` format ([101](https://github.com/deislabs/cnab-spec/blob/master/101-bundle-json.md))\n2. Building invocation images ([102](https://github.com/deislabs/cnab-spec/blob/master/102-invocation-image.md))\n3. Running actions against a CNAB ([103](https://github.com/deislabs/cnab-spec/blob/master/103-bundle-runtime.md))\n\nClaims and Signing are optional but will be worked on once the above are stable.\n\n\n## Installation\n\nThe module is published on [PyPi](https://pypi.org/project/cnab/) and can be installed from there.\n\n```bash\npip install cnab\n```\n\n\n## Parsing `bundle.json`\n\nNothing too fancy here, the `Bundle` class has a `from_dict` static method which\nbuilds a full `Bundle` object.\n\n```python\nimport json\nfrom cnab import Bundle\n\nwith open(\"bundle.json\") as f:\n data = json.load(f)\n\nbundle = Bundle.from_dict(data)\n```\n\nThis could for example be used for validation purposes, or for building user interfaces for `bundle.json` files.\n\n\n## Describing `bundle.json` in Python \n\nYou can also describe the `bundle.json` file in Python. This will correctly validate the\nstructure based on the current specification and would allow for building a custom DSL or other\nuser interface for generating `bundle.json` files.\n\n```python\nfrom cnab import Bundle, InvocationImage\n\nbundle = Bundle(\n name=\"hello\",\n version=\"0.1.0\",\n invocation_images=[\n InvocationImage(\n image_type=\"docker\",\n image=\"technosophos/helloworld:0.1.0\",\n digest=\"sha256:aaaaaaa...\",\n )\n ],\n)\n\nprint(bundle.to_json())\n```\n\n## Running CNABs\n\nThe module supports running actions on a CNAB, using the `docker` driver.\n\n```python\nfrom cnab import CNAB\n\n# The first argument can be a path to a bundle.json file, a dictionary\n# or a full `Bundle` object\napp = CNAB(\"fixtures/helloworld/bundle.json\")\n\n# list available actions\nprint(app.actions)\n\n# list available parameters\nprint(app.parameter)\n\n# run the install action\nprint(app.run(\"install\"))\n\n# run the install action specifying a parameters\nprint(app.run(\"install\", parameters={\"port\": 9090}))\n\n# Many applications will require credentials\napp = CNAB(\"fixtures/hellohelm/bundle.json\")\n\n# list required credentials\nprint(app.credentials)\n\n# Here we pass the value for the required credential\n# in this case by reading the existing configuration from disk\nwith open(\"/home/garethr/.kube/config\") as f:\n print(app.run(\"status\", credentials={\"kubeconfig\": f.read()}))\n```\n\nNote that error handling for this is very work-in-progress.\n\n\n## Working with invocation images\n\n`pycnab` also has a class for working with invocation images.\n\n```python\nfrom cnab import CNABDirectory\n\ndirectory = CNABDirectory(\"fixtures/invocationimage\")\n\n# Check whether the directory is valid\n# Raises `InvalidCNABDirectory` exception if invalid\ndirectory.valid()\n\n# Returns the text of the associated README file if present\ndirectory.readme()\n\n# Returns the text of the associated LICENSE file if present\ndirectory.license()\n```\n\n\n## Thanks\n\nThanks to [QuickType](https://quicktype.io/) for bootstrapping the creation of the Python code for manipulating `bundle.json` based on the current JSON Schema.\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/garethr/pycnab", "keywords": "cnab", "license": "Apache-2.0", "maintainer": "Gareth Rushgrove", "maintainer_email": "gareth@morethanseven.net", "name": "cnab", "package_url": "https://pypi.org/project/cnab/", "platform": "", "project_url": "https://pypi.org/project/cnab/", "project_urls": { "Homepage": "https://github.com/garethr/pycnab", "Repository": "https://github.com/garethr/pycnab" }, "release_url": "https://pypi.org/project/cnab/0.1.7/", "requires_dist": [ "docker (>=3.6,<4.0); extra == \"docker\"", "canonicaljson (>=1.1,<2.0)" ], "requires_python": ">=3.7,<4.0", "summary": "A module for working with Cloud Native Application Bundles in Python", "version": "0.1.7" }, "last_serial": 4831539, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "3f7d48d5b2a877399d4c08fd598d5281", "sha256": "01ca1f33d75fc713446acf7f24088d97a5f6d35501811759514208b1e66b34d0" }, "downloads": -1, "filename": "cnab-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3f7d48d5b2a877399d4c08fd598d5281", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 18806, "upload_time": "2018-12-31T22:52:36", "url": "https://files.pythonhosted.org/packages/1c/98/f0e25e47af12601bafec6dc511d45f9d54e85ef5be9374f9c1a8ed167a1b/cnab-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "006ada1b7f0ec0c9f02f4c887e717a98", "sha256": "54a529ead5ef48eea502ab2784e699c40e8f03b0aaef25d4276e89f6608d4053" }, "downloads": -1, "filename": "cnab-0.1.1.tar.gz", "has_sig": false, "md5_digest": "006ada1b7f0ec0c9f02f4c887e717a98", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 4680, "upload_time": "2018-12-31T22:52:37", "url": "https://files.pythonhosted.org/packages/4e/2d/9a2549a3808037027e66511f5bf828400e5d4ce0a381f06219d01150909e/cnab-0.1.1.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "a9124460cb5998f7ecbd0add1e30a7e2", "sha256": "e7a42a4b7034e77c2fe3157bfdfc3b314be6fdd5c2626daf432ec168de1a7b28" }, "downloads": -1, "filename": "cnab-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "a9124460cb5998f7ecbd0add1e30a7e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 31640, "upload_time": "2019-02-02T16:14:38", "url": "https://files.pythonhosted.org/packages/83/ab/e1d9e2e183e7049acbc8a51475580a73cd650b432f4d646beacda85951b7/cnab-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d439502aa91a726b00cd571a90050076", "sha256": "0580b14ec8cd2bc49362e996f31efb44ff81c678caae475da82d64cee701fbad" }, "downloads": -1, "filename": "cnab-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d439502aa91a726b00cd571a90050076", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 8946, "upload_time": "2019-02-02T16:14:39", "url": "https://files.pythonhosted.org/packages/79/9b/0b054ef836aa122e4ff4eabbe353d4d78570a918f0aae0fab8bdef0b1f05/cnab-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "32b5a1e4e58581c72626952093d5e5d6", "sha256": "d6659fc35940e4e927ac1b386c4bd5503833957418a4e442558dd2e59cc5a2c3" }, "downloads": -1, "filename": "cnab-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "32b5a1e4e58581c72626952093d5e5d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 36756, "upload_time": "2019-02-05T14:26:41", "url": "https://files.pythonhosted.org/packages/49/9f/ef94ec23d1839ee7348cbb7badb8b7d093498f4dac86ec3cede24e92199b/cnab-0.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c33997e4c6882e8830d79bda883be9af", "sha256": "db9b90294ec0db1b8b6dc7654fd75fb37a384acf1ddd6b254329bab3c862f6f7" }, "downloads": -1, "filename": "cnab-0.1.5.tar.gz", "has_sig": false, "md5_digest": "c33997e4c6882e8830d79bda883be9af", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 10138, "upload_time": "2019-02-05T14:26:43", "url": "https://files.pythonhosted.org/packages/12/58/58274198084116732b1eb0440a300906da63625d3c89d6ea016960a68a44/cnab-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "2c7e1eb4c14f91af6881e7ba183cd8cc", "sha256": "99db5c808ca523485b14bea5d7cc25be215b81de77e5cbb65a2b266be984e3f1" }, "downloads": -1, "filename": "cnab-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "2c7e1eb4c14f91af6881e7ba183cd8cc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 37283, "upload_time": "2019-02-10T12:06:28", "url": "https://files.pythonhosted.org/packages/65/db/50e17f29d42900b92b62bf5feb998ffa6f5baa93483e58b4143b59ef85a4/cnab-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbc9cd356f606b0c20f2a7f4eab0845c", "sha256": "22c9734ef758a73b5054824390c34e219c482185703207ff7dd26f42ffb27da7" }, "downloads": -1, "filename": "cnab-0.1.6.tar.gz", "has_sig": false, "md5_digest": "fbc9cd356f606b0c20f2a7f4eab0845c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 10237, "upload_time": "2019-02-10T12:06:30", "url": "https://files.pythonhosted.org/packages/4d/30/13b2f21c6a28d10051cb54e7e1f090b3526da73faef7fa58191329d526c3/cnab-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "221ba69b4e77a6d52a46fbef4917eb0c", "sha256": "59bd1f60905a4e5133d2adc4dac2bd917e4af09a73eb3c260ee64286c6a42c90" }, "downloads": -1, "filename": "cnab-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "221ba69b4e77a6d52a46fbef4917eb0c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 37772, "upload_time": "2019-02-17T13:42:12", "url": "https://files.pythonhosted.org/packages/52/45/1da9b50443e2bfeefe65c03364a58ca19da646bdfbb27d92d17e901dde4e/cnab-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14abfdca5c21bb707eeca9973a1afda9", "sha256": "031a6361eaec6a6c4f6c04d5f43d3d57d97221683a14cb223bf592a9022c71b9" }, "downloads": -1, "filename": "cnab-0.1.7.tar.gz", "has_sig": false, "md5_digest": "14abfdca5c21bb707eeca9973a1afda9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 10329, "upload_time": "2019-02-17T13:42:14", "url": "https://files.pythonhosted.org/packages/31/3b/412323db6748c52fcbbf8f6c58070c367fa25a696bbada77a1e329c688ab/cnab-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "221ba69b4e77a6d52a46fbef4917eb0c", "sha256": "59bd1f60905a4e5133d2adc4dac2bd917e4af09a73eb3c260ee64286c6a42c90" }, "downloads": -1, "filename": "cnab-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "221ba69b4e77a6d52a46fbef4917eb0c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 37772, "upload_time": "2019-02-17T13:42:12", "url": "https://files.pythonhosted.org/packages/52/45/1da9b50443e2bfeefe65c03364a58ca19da646bdfbb27d92d17e901dde4e/cnab-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14abfdca5c21bb707eeca9973a1afda9", "sha256": "031a6361eaec6a6c4f6c04d5f43d3d57d97221683a14cb223bf592a9022c71b9" }, "downloads": -1, "filename": "cnab-0.1.7.tar.gz", "has_sig": false, "md5_digest": "14abfdca5c21bb707eeca9973a1afda9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 10329, "upload_time": "2019-02-17T13:42:14", "url": "https://files.pythonhosted.org/packages/31/3b/412323db6748c52fcbbf8f6c58070c367fa25a696bbada77a1e329c688ab/cnab-0.1.7.tar.gz" } ] }