{ "info": { "author": "John Huang", "author_email": "john.h.cn@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Java", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Utilities" ], "description": "jpserve\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\r\nJpserve provides a simple and high performance way to execute Python script in JAVA. It includes PyServe and JClient API. \r\n\r\n* PyServe is an execute server running on Python side and listening the execute requests from JAVA.\r\n* The JClient API can executes Python snippet or complete script file from java, it send the script to PyServe and get the execution result. The result is JSON format, so you can exchange the complex data between JAVA and Python flexibly.\r\n\r\nQuick Start\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\r\nPython Side\r\n------------------\r\n\r\nOpen Python console, import jpserve and start the PyServe:\r\n\r\n>>> from jpserve.jpserve import PyServe\r\n>>> server = PyServe((\"localhost\", 8888))\r\n>>> server.start()\r\n>>>\r\n INFO:pserve:starting...\r\n INFO:pserve:pyserve listening in localhost 8888 \r\n>>>\r\n\r\n\r\nJAVA Side\r\n------------------\r\n>>>\r\n// init the PyServeContext, it will make a connection to PyServe\r\nPyServeContext.init(\"localhost\", 8888);\r\n// \r\n// prepare the script, and assign the return value to _result_\r\nString script = \"a = 2\\n\"\r\n + \"b = 3\\n\"\r\n + \"_result_ = a * b\";\r\n//\r\n// sned the script to PyServe, it returns the final result\r\nPyResult rs = executor.exec(script);\r\n//\r\n// check if the execution is success\r\nif (rs.isSuccess()) {\r\n System.out.println(\"Result: \" + rs.getResult()); // get the _result_ value\r\n}\r\nelse {\r\n System.out.println(\"Execute python script failed: \" + rs.getMsg());\r\n} \r\n------------------------\r\nResult: 6", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/johnhuang-cn/jpserve", "keywords": "jpserve,calling Python from Java", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "jpserve", "package_url": "https://pypi.org/project/jpserve/", "platform": "Any", "project_url": "https://pypi.org/project/jpserve/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/johnhuang-cn/jpserve" }, "release_url": "https://pypi.org/project/jpserve/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "jpserve: Calling Python from JAVA", "version": "0.1.0" }, "last_serial": 2393225, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "53fec2ebfb47c62c341477693991a0d0", "sha256": "a9b8ce0a72b6598988ac87b0ff4570cf4d11c2f001f2f76a9ec18cbeadc141f2" }, "downloads": -1, "filename": "jpserve-0.1.0.zip", "has_sig": false, "md5_digest": "53fec2ebfb47c62c341477693991a0d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6757, "upload_time": "2016-10-11T06:27:44", "url": "https://files.pythonhosted.org/packages/0b/d4/2579171502b606d81e35d817202ee88e386eb7902dba1f23cfe5779e16a5/jpserve-0.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "53fec2ebfb47c62c341477693991a0d0", "sha256": "a9b8ce0a72b6598988ac87b0ff4570cf4d11c2f001f2f76a9ec18cbeadc141f2" }, "downloads": -1, "filename": "jpserve-0.1.0.zip", "has_sig": false, "md5_digest": "53fec2ebfb47c62c341477693991a0d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6757, "upload_time": "2016-10-11T06:27:44", "url": "https://files.pythonhosted.org/packages/0b/d4/2579171502b606d81e35d817202ee88e386eb7902dba1f23cfe5779e16a5/jpserve-0.1.0.zip" } ] }