{ "info": { "author": "Vlad Calin", "author_email": "vlad.s.calin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries" ], "description": "The **pymicroservice** framework\n================================\n\n[![Build Status](https://travis-ci.org/vladcalin/pymicroservice.svg?branch=master)](https://travis-ci.org/vladcalin/pymicroservice)\n[![Documentation Status](https://readthedocs.org/projects/pymicroservice/badge/?version=latest)](http://pymicroservice.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/pymicroservice.svg)](https://badge.fury.io/py/pymicroservice)\n[![Coverage Status](https://coveralls.io/repos/github/vladcalin/pymicroservice/badge.svg?branch=master)](https://coveralls.io/github/vladcalin/pymicroservice?branch=master)\n\nMotivation\n----------\n\nIn the past years, the microservice-based architecture became very popular in the computing field. \nAlthough this architecture grew more and more popular, there are a few tools that can help an\nindividual to build such systems. The current alternatives are using [nameko](https://github.com/nameko/nameko) \nor by building a web application that acts like a microservice. I started developing this framework in order\nto provide a tool for creating and managing such systems with ease, and that are capable of being specialized in\na certain role, be it entity management, data storage or just computing.\n\nFew words ahead\n---------------\n\nThis library uses the asynchronous features of the Tornado web framework for creating a JSON RPC endpoint through which\none can call exposed methods. The method calls are treated asynchronously. If you have no knowledge about asynchronous\nprogramming in Python, I suggest to read a few words from the\n`Tornado documentation `_ .\n\nAlthough it is not required for you to know about all that coroutines and event loop theory, it sure helps to understand\nwhat happens *under the hood*.\n\nInstallation\n------------\n\nIn order to install this library, run the command\n\n pip install pymicroservice\n\nor to install it from sources\n\n\n git clone https://github.com/vladcalin/pymicroservice.git\n cd pymicroservice\n python setup.py install\n\nTo run the tests, run the command\n\n python setup.py test\n\n\nExample basic usage\n-------------------\nWrite into a ``hello_world_service.py`` file the following code:\n\n```python\n\n\tfrom pymicroservice.core.microservice import PyMicroService, \\\n\t public_method, private_api_method\n \n \n class HelloWorldService(PyMicroService):\n name = \"hello.world.service\"\n host = \"127.0.0.1\"\n port = 5000\n\n @public_method\n def say_hello(self, name):\n return \"hello {}\".format(name)\n\n @private_api_method\n def say_private_hello(self, name):\n return \"this is secret: hello {}\".format(name)\n\n def api_token_is_valid(self, api_token):\n return api_token == \"hello_world_token\"\n\n\n if __name__ == '__main__':\n service = HelloWorldService()\n service.start()\n\n```\n\nAfter running the ``hello_world_service.py`` script, we will have a running microservice at\nhttp://localhost:5000/api . In order to interact with it, we have to use\n the JSONRPC protocol as follows:\n \n```\n POST /api\n {\n \"jsonrpc\": \"2.0\",\n \"method\": \"say_hello\",\n \"params\": {\n \"name\": \"world\"\n },\n \"id\": 1\n }\n```\n\nThe response will be\n\n```\n {\n \"error\": null,\n \"id\": 1,\n \"response\": \"hello world\"\n }\n```\n\nIn order to access the private method, we have to include in the HTTP\nrequest an ``X-Api-Token`` header with the value ``hello_world``, so that the\nmethod ``api_token_is_valid`` will return ``True``.\n\nThis library offers a class through which you can interact with various services:\n\n```python\n\n client = pymicroservice.RemoteClien(\"http://localhost:5000/api\")\n print(client.name) # \"service.hello.world\"\n print(client.methods.say_hello(\"world\")) # \"hello world\"\n \n```\n\n\nIssues\n------\n\nCheck the [Github issue tracker](https://github.com/vladcalin/pymicroservice/issues).\n\nTODO\n----\n\nSee [TODO](TODO.md)\n\nCollaborate\n-----------\n\nAny collaboration is welcome. Feel free to create new issues, make suggestions, open pull requests.\n\nChanges\n-------\n\nSee [CHANGES.md](CHANGES.md)", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vladcalin/pymicroservice", "keywords": "microservice,cloud,rpc,compute,service", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pymicroservice", "package_url": "https://pypi.org/project/pymicroservice/", "platform": "", "project_url": "https://pypi.org/project/pymicroservice/", "project_urls": { "Homepage": "https://github.com/vladcalin/pymicroservice" }, "release_url": "https://pypi.org/project/pymicroservice/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Build microservices with Python", "version": "0.1.0" }, "last_serial": 2562914, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "dde4f9ac53cacc280d3f3259fe28f19e", "sha256": "aff3f7e1b273d10ce55c855a9834bec88e98448251484a4b9bc819128917688d" }, "downloads": -1, "filename": "pymicroservice-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dde4f9ac53cacc280d3f3259fe28f19e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14644, "upload_time": "2016-12-03T18:37:23", "url": "https://files.pythonhosted.org/packages/2b/f7/fb284dd8d3954a8d42a43ce363a3e0b8bf8f1f0b8539cb76864eeb85d6db/pymicroservice-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7a415a89116298f3dcad0233714396e9", "sha256": "99008591a60bd375adfcd2088fe6fef5dd37ce3905ef9418d88d03bfa5b1c55f" }, "downloads": -1, "filename": "pymicroservice-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7a415a89116298f3dcad0233714396e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9767, "upload_time": "2016-12-03T18:37:24", "url": "https://files.pythonhosted.org/packages/a6/1b/55c8c15a9ff8700dc7bdac5c573c53cff90f33419ad408a41bc9a6fdd304/pymicroservice-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "12a9ff8172e2f1c2d64e1303f5942499", "sha256": "eda69446a226fd97b9874fb89b05c18181822e0510d93bf9d61f3ac909c1e76f" }, "downloads": -1, "filename": "pymicroservice-0.0.2.tar.gz", "has_sig": false, "md5_digest": "12a9ff8172e2f1c2d64e1303f5942499", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15701, "upload_time": "2016-12-08T13:47:28", "url": "https://files.pythonhosted.org/packages/1e/c8/68c4d7228b55b8861d477988b2d479287c784e76837c6b72258b80bc7c42/pymicroservice-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d86ad2e8dd52196da5653f6db82bf86c", "sha256": "2d1c9c5d3ba92269d57fa1939b72d5a86aa6b99e4fe161d914602de443f90fb6" }, "downloads": -1, "filename": "pymicroservice-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d86ad2e8dd52196da5653f6db82bf86c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21515, "upload_time": "2016-12-13T19:08:35", "url": "https://files.pythonhosted.org/packages/49/ee/615ac304af63dd029553d37c246a0cf522f1c2138bdc7aae88f0cf4462f5/pymicroservice-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a3ea8deeca5274949ed5f9afd6b88604", "sha256": "5baad0ee3b2fe8aadf72074241f74d50a0f5d5a813d180f3638c13856be47ded" }, "downloads": -1, "filename": "pymicroservice-0.0.3.tar.gz", "has_sig": false, "md5_digest": "a3ea8deeca5274949ed5f9afd6b88604", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16680, "upload_time": "2016-12-13T19:08:37", "url": "https://files.pythonhosted.org/packages/b8/ca/0da2e7e06b34734fc5e63a54c5e82e7e1839911f6c3b733f77a7892f4506/pymicroservice-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "e411b59dcf17cb7c7dbb1f25baaaf247", "sha256": "df6a36df7f36b1eeaddf4a25ddddd0ff282172604bdd142d32356f525ab280f2" }, "downloads": -1, "filename": "pymicroservice-0.0.4.tar.gz", "has_sig": false, "md5_digest": "e411b59dcf17cb7c7dbb1f25baaaf247", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17505, "upload_time": "2017-01-04T14:55:25", "url": "https://files.pythonhosted.org/packages/61/9a/ebd5d3894a721b1288be956ec1466304ae20be52b147a8ab3af377589bcf/pymicroservice-0.0.4.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "743595510a284b7eb51ec20441061606", "sha256": "d5b833e8c27a9f23ae14e83de8bb92d5dd03431184894308dd3be3bd284eccae" }, "downloads": -1, "filename": "pymicroservice-0.1.0.tar.gz", "has_sig": false, "md5_digest": "743595510a284b7eb51ec20441061606", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18191, "upload_time": "2017-01-09T19:01:31", "url": "https://files.pythonhosted.org/packages/e9/8e/f695c4a170aef4926b3d7daee8d4aae99f70cce5f1cb86ff141b94a5e699/pymicroservice-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "743595510a284b7eb51ec20441061606", "sha256": "d5b833e8c27a9f23ae14e83de8bb92d5dd03431184894308dd3be3bd284eccae" }, "downloads": -1, "filename": "pymicroservice-0.1.0.tar.gz", "has_sig": false, "md5_digest": "743595510a284b7eb51ec20441061606", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18191, "upload_time": "2017-01-09T19:01:31", "url": "https://files.pythonhosted.org/packages/e9/8e/f695c4a170aef4926b3d7daee8d4aae99f70cce5f1cb86ff141b94a5e699/pymicroservice-0.1.0.tar.gz" } ] }