{ "info": { "author": "architect.io", "author_email": "packages@architect.io", "bugtrack_url": null, "classifiers": [], "description": "Architect Python SDK\n=====================\nThis is the Python SDK used for brokering connections to microservice dependencies via Architect's deployment platform. If you're unfamiliar with the platform or our deploy tools, please check out Architect.io and our [CLI](https://github.com/architect-team/architect-cli) to get started.\n\n# SDK Documentation\n\n## Connecting to dependencies\n\n```python\nimport architect.sdk as architect\n\nmy_dependency = architect.service('my_dependency_name')\n\n# Client used to connect to service\nclient = my_dependency.client\n\n# Dynamically imported models used for message formatting\n# Used by protocols supporting code-gen like gRPC\ndefs = my_dependency.defs\n```\n\n### REST\nThe Architect SDK uses the popular REST client, [Requests](https://2.python-requests.org/en/master/), to broker communication to downstream REST microservices. The client that is provided is a requests [session](https://2.python-requests.org/en/master/user/advanced/#session-objects) that is enriched with the proper service location meaning only URIs and HTTP actions need be provided:\n\n```python\nres = my_dependency.client.get('/resource')\nres = my_dependency.client.post('/resource', { data })\nres = my_dependency.client.put('/resource/:resource_id', { data })\nres = my_dependency.client.delete('/resource/:resource_id')\n```\n\n### gRPC\nArchitect handles the code-gen for gRPC services for you. Every time you run `$ architect install ...`, you'll find relevant gRPC stubs generated and placed inside an `architect_services` folder in your service's root directory. This SDK handles the import of generated model objects for parsing input/output messages as well as the import and enrichment of client code for making calls to dependencies.\n\n```protobuf\n// service.proto\nsyntax = \"proto3\";\n\npackage example_service;\n\nmessage PayRequest {\n int32 amount = 1;\n}\n\nmessage PayResponse {\n int32 output = 1;\n}\n\nservice Example {\n rpc Pay (PayRequest) returns (PayResponse) {}\n}\n```\n\n```python\n# Model definitions will match message names in the .proto file for the service\npay_req = my_dependency.defs.PayRequest(amount=10)\n\n# Client will automatically have methods matching the service definition from \n# the dependency's .proto file. Response handling matches gRPC documentation.\npay_res = my_dependency.client.Pay(pay_req)\noutput = pay_res.output\n```\n\n## Connecting to data stores\nSince there are so many DB clients available, we don't want to choose a default for developers. Instead, the Architect SDK provides easy mechanics to parse credentials provided by the platform:\n\n```python\nimport psycopg2\nimport architect.sdk as architect\n\n# Key used to cite the datastore must match the key used in your \n# architect service config\ndb_config = architect.datastore('primary_db')\nconnection = psycopg2.connect(dbname=db_config.name, \n user=db_config.username,\n password=db_config.password, \n host=db_config.host,\n port=db_config.port)\n```\n\n## Events and messaging\nThe Architect platform also supports pub/sub based communication between services. The primary use-case for this flow would be to allow services to broadcast events for other services to subscribe to without needing to know who the subscribers are.\n\nNOTE: As of v0.2.x of the SDK, the only method for publishing/subscribing to events using Architect is via REST (mirroring the function of traditional webhooks). We're actively working on means of supporting queuing systems like RabbitMQ, AWS SQS, and more.\n\n### Subscribing\n\n```javascript\n// architect.json\n{\n \"subscriptions\": {\n \"\": {\n \"\": {\n \"uri\": \"/event/callback\",\n \"headers\": {\n \"x-custom-header\": \"example\"\n }\n }\n }\n }\n}\n```\n\nThe URI used for registration must match a URI on your service:\n\n```python\nfrom flask import Flask, request\nimport architect.sdk as architect\n\napp = Flask(__name__)\n\n@app.route(\"/event/callback\")\ndef callback():\n # Custom event handling here\n\nif __name__ == '__main__':\n app.run(host=os.environ['HOST'], port=os.environ['PORT'])\n```\n\n### Publishing\n_NOTE: simple publication methods coming soon. For now, you can iterate through\nsubscribers to submit events._\n\n```js\n// architect.json\n{\n \"notifications\": [\"\"]\n}\n```\n\n```python\nfrom requests import Request, Session\nimport architect.sdk as architect\n\n# Iterate through notification subscribers to POST payload\nfor sub in architect.notification('').subscriptions:\n r = requests.post('{}:{}{}'.format(sub.host, sub.port, sub.uri), data = {})\n```\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/architect-team/python-sdk", "keywords": "", "license": "GPL-3.0", "maintainer": "", "maintainer_email": "", "name": "architect.sdk", "package_url": "https://pypi.org/project/architect.sdk/", "platform": "", "project_url": "https://pypi.org/project/architect.sdk/", "project_urls": { "Homepage": "https://github.com/architect-team/python-sdk" }, "release_url": "https://pypi.org/project/architect.sdk/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Architect Python SDK", "version": "0.2.1" }, "last_serial": 5666518, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cab564eddf72bf7286cb6bc2c0caf2f6", "sha256": "b88f00728ddfba52a7740a70b7d59e32ae49cba00e53ac1410d31bd4a2461493" }, "downloads": -1, "filename": "architect.sdk-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cab564eddf72bf7286cb6bc2c0caf2f6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14447, "upload_time": "2019-07-23T21:16:40", "url": "https://files.pythonhosted.org/packages/d9/bf/4f78776a594fe935d952d38468634bdfa0b12c1e22c95c1ecd8d364198fb/architect.sdk-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2cc1452f6bd5943e692e80223ab6759b", "sha256": "a7148beecdd59b9f60ba7cfb75cf21b03fd31798c16ad367012a5d180e2fb556" }, "downloads": -1, "filename": "architect.sdk-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2cc1452f6bd5943e692e80223ab6759b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1794, "upload_time": "2019-07-23T21:16:42", "url": "https://files.pythonhosted.org/packages/d1/83/15905e54f5e8b5ca8cbe496caf50abe09c1defc24e7bbd5060a52b3978ac/architect.sdk-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "285ab2513cd4e5de834f8c9c1e81797b", "sha256": "41036e6b86bee83df4fea8416fb0a5f98350459429d847c6da48290f59985a86" }, "downloads": -1, "filename": "architect.sdk-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "285ab2513cd4e5de834f8c9c1e81797b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14563, "upload_time": "2019-07-24T04:01:14", "url": "https://files.pythonhosted.org/packages/40/ee/6750f6d037970487fbe943f411d97b66cef49ee592c0ae0bbdd7360e0f5b/architect.sdk-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c253451a064211a639b45eec1a6351eb", "sha256": "aeeb29f678a9ec4dfef5f9384fd8955e58afd8e265cd9234fd7abc0a091dddb2" }, "downloads": -1, "filename": "architect.sdk-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c253451a064211a639b45eec1a6351eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1859, "upload_time": "2019-07-24T04:01:15", "url": "https://files.pythonhosted.org/packages/d2/02/06dbca4e240cea2c20f9d92a1a806f449aa33bf16fc8b790e6057ed6457b/architect.sdk-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7f6598e6a6e865e073d05be41dc0c221", "sha256": "468a6bd7c16df88d361b358cfc803d3ee8536ca69ae64f092335b8d11015aa49" }, "downloads": -1, "filename": "architect.sdk-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7f6598e6a6e865e073d05be41dc0c221", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14672, "upload_time": "2019-07-24T19:10:03", "url": "https://files.pythonhosted.org/packages/1f/85/3b56be6f3168316479d5b718429091c7f865bdb87132c3a41851c433cdad/architect.sdk-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0765f23704607269844237f49a45845e", "sha256": "bb23fe100db1d419c82d35858043009bad1431b08e1c34040c9c88d6f4c501d8" }, "downloads": -1, "filename": "architect.sdk-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0765f23704607269844237f49a45845e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1972, "upload_time": "2019-07-24T19:10:05", "url": "https://files.pythonhosted.org/packages/ff/1b/99a34be8cbf49572ece45a8e4e4e9f1f30dc41caba2f1152d365b224e1b4/architect.sdk-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "39abafe31201d37a582553ee0dab2125", "sha256": "a323671d2cff0c1c16f59b53664a1869f973d4af272f4b09233f398fa178aa29" }, "downloads": -1, "filename": "architect.sdk-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "39abafe31201d37a582553ee0dab2125", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14753, "upload_time": "2019-07-24T21:47:42", "url": "https://files.pythonhosted.org/packages/d3/59/bfdd96cfbecfc5f4ec32dc2bba37f8a4b0a41b3dd09018f6f4e0c81fe3f6/architect.sdk-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6e8539d627dc6850d51b4ffce9e51c5d", "sha256": "3c8685976e391f35d7bdceeab56223b1e8441321c6f48e6acb6fbd308a01a368" }, "downloads": -1, "filename": "architect.sdk-0.1.3.tar.gz", "has_sig": false, "md5_digest": "6e8539d627dc6850d51b4ffce9e51c5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2054, "upload_time": "2019-07-24T21:47:44", "url": "https://files.pythonhosted.org/packages/3f/a5/b88db1178792a46886ef955f57621c5025b2c6ea59373beb090847eaac6c/architect.sdk-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "301628c7c8eeb8723bdb5948b63ac982", "sha256": "b05c205ca6ee2d9beef074e25b954aeb77a056b0aca0941a3e8699d649bb2938" }, "downloads": -1, "filename": "architect.sdk-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "301628c7c8eeb8723bdb5948b63ac982", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15010, "upload_time": "2019-07-26T20:26:47", "url": "https://files.pythonhosted.org/packages/d9/9b/72b4fb5ceb9cbf7dbb3e30fe7f4fe500514e72c76855a4065694695cb56a/architect.sdk-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a17ab1549f4510d4403cf5ff867f4b5e", "sha256": "2041027b3480157aa9000fb6e2af6fff792529e246d073f82ad7f0ff3e061384" }, "downloads": -1, "filename": "architect.sdk-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a17ab1549f4510d4403cf5ff867f4b5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2093, "upload_time": "2019-07-26T20:26:48", "url": "https://files.pythonhosted.org/packages/80/b7/db31b0d1b3ef98cbedaafa500f7135696c185b4e1ac984a71b48829728ec/architect.sdk-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "79d1d0c66b87a2802d0c9043ad44b086", "sha256": "02a770e6547a9dfd64fc5d17b7e89f11f18301e29454e4651ed2a06e3b5b6a33" }, "downloads": -1, "filename": "architect.sdk-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "79d1d0c66b87a2802d0c9043ad44b086", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15190, "upload_time": "2019-08-02T16:11:34", "url": "https://files.pythonhosted.org/packages/81/d1/877c76d1bef5b136efc9951ae9cff37191bc35bb290a99df4467f9db2a0e/architect.sdk-0.2.0-py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "55bb6af4d7d1244f328d4232c9b91791", "sha256": "df507e4850d188dcb303c39a253bb64028db44c40e9ab8976a19b250d5d8a177" }, "downloads": -1, "filename": "architect.sdk-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "55bb6af4d7d1244f328d4232c9b91791", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16855, "upload_time": "2019-08-12T13:52:48", "url": "https://files.pythonhosted.org/packages/d3/7d/e1c77609d75ab173840e02e814e1ea6db5eafb34c09c5051bdc08efaa994/architect.sdk-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aaf0b6c144e53909664d2d9db092c03a", "sha256": "62af52eb6f21cf10a39a8ff5b997492183403544a18672f76758f8431adab1c5" }, "downloads": -1, "filename": "architect.sdk-0.2.1.tar.gz", "has_sig": false, "md5_digest": "aaf0b6c144e53909664d2d9db092c03a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4650, "upload_time": "2019-08-12T13:52:50", "url": "https://files.pythonhosted.org/packages/43/25/7333a860ba39be2b491b7a18fa922ac88ac4a7e1719f63617eea0270fc1e/architect.sdk-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "55bb6af4d7d1244f328d4232c9b91791", "sha256": "df507e4850d188dcb303c39a253bb64028db44c40e9ab8976a19b250d5d8a177" }, "downloads": -1, "filename": "architect.sdk-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "55bb6af4d7d1244f328d4232c9b91791", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16855, "upload_time": "2019-08-12T13:52:48", "url": "https://files.pythonhosted.org/packages/d3/7d/e1c77609d75ab173840e02e814e1ea6db5eafb34c09c5051bdc08efaa994/architect.sdk-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aaf0b6c144e53909664d2d9db092c03a", "sha256": "62af52eb6f21cf10a39a8ff5b997492183403544a18672f76758f8431adab1c5" }, "downloads": -1, "filename": "architect.sdk-0.2.1.tar.gz", "has_sig": false, "md5_digest": "aaf0b6c144e53909664d2d9db092c03a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4650, "upload_time": "2019-08-12T13:52:50", "url": "https://files.pythonhosted.org/packages/43/25/7333a860ba39be2b491b7a18fa922ac88ac4a7e1719f63617eea0270fc1e/architect.sdk-0.2.1.tar.gz" } ] }