{ "info": { "author": "Rett Berg", "author_email": "googberg@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "# jsh: JSON-RPC standards for the shell\n\n`jsh` refers to both:\n - JSH: a standard protocol for \"shell scripts\" to be able to talk to eachother\n in a manner similar to JSON-RPC, along with a `jshlib.py` single-file python\n library reference implementation.\n - `jsh`: a cmdline tool for converting standard shell-like arguments\n into json.\n\nThe JSH spec is almost identical to the [JSON-RPC 2.0] specification. It is\na specification for cmdline programs to take a jsonrpc compatible json\nblob via the argument `--jsh-request` argument. i.e. if `ls` supported\nJSH the following might have similar functionality:\n\n```bash\nls --all /foo/bar\n\nREQUEST='{\n \"jsonrpc\":\"2.0\",\n \"method\":\"ls\",\n \"params\":{\"all\":true, \"path\": \"/foo/bar\"}\n}'\nls --jsh-request \"$REQUEST\"\n\nls --jsh-request $(jsh m=ls --all=true --path='\"/foo/bar\"')\n```\n\nIn addition to this, JSH requires the following when the `--jsh-request` is passed:\n- **MUST** output valid json on stdout _UNLESS_ a documented application\n defined flag in `params` or `method` specifies otherwise (i.e. Method vs\n MethodBinary)\n - If outputing multiple 'results' (i.e. list of files, results of search,\n etc), **MUST**\n output them as separate records separated by newlines `\\n`\n - These can be iteratively injsested by `jshlib.load_jsh`\n- **SHOULD** output structured logs to stderr, one json record per line, in the\n form (other keys are allowed)\n\n\n```json\n{\"lvl\":\"ERROR\", \"msg\":\"this is a message\"}\n```\n\nJSH was explicitly developed for use in build systems, which often need to\ncombine outputs from multiple stages using many different programming languages.\nHowever, it's purpose is broader reaching:\n- Elminiate the error-prone parsing of outputs, using JSON instead.\n - Standard composability of developer tooling, both at the OS level and higher.\n - Still allowing for fast development and prototyping in any language.\n- Enable the user of json query tools (like `jq`) to munge and redirect data,\n as opposed to text-based tools like `awk` or `sed`.\n- Allow for shell scripts to quickly be \"hosted\".\n - Trivial to make them work via web requests, allowing faster and cleaner\n sysadmin interfaces.\n\n\n# Usage and API\n\n```bash\npip install jshlib\n```\n\n## `jsh` cmdline tool\nComes with cmdline tool `jsh` which can:\n\n- Create `json-rpc` request for use with JSH compliant commands.\n- (future) format json to be more human readable\n- (future) create well-formatted tables for certain formats of output\n\n\n## jshlib python library\n\nThe following functions and types are essential:\n\n- `parse_jsh_argv`: parses the `argv` cmdline arguments for JSH compliance\n- `Request` and `Error` objects, which represent the appropriate JSON-RPC objects.\n- `dump_stdout` and `dump_stderr` for dumping python objects (dict, list, int, etc)\n to the respective output.\n- `load_json_iter` will continuously load json objects from a stream (i.e.\n stdin, stdout, file socket, etc). This allows for semi-performantly chaining\n jsh tools, assuming that each one outputs its \"records\" as they becomes\n available.\n\nIt is planned to support more languages ASAP.\n\n\n# License\n\nThe source code is Licensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or\n http://opensource.org/licenses/MIT)\n\nat your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\n[JSON-RPC 2.0]: https://www.jsonrpc.org/specification_v2", "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/vitiral/jsh", "keywords": "", "license": "MIT or APACHE-2.0", "maintainer": "", "maintainer_email": "", "name": "jshlib", "package_url": "https://pypi.org/project/jshlib/", "platform": "", "project_url": "https://pypi.org/project/jshlib/", "project_urls": { "Homepage": "https://github.com/vitiral/jsh", "Issue Tracker": "https://github.com/vitiral/jsh/issues" }, "release_url": "https://pypi.org/project/jshlib/0.1.0/", "requires_dist": null, "requires_python": ">=2.7", "summary": "JSON-RPC standards for the shell", "version": "0.1.0" }, "last_serial": 5642992, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7ace825665768a8e8e1ad8f128ff0177", "sha256": "0a77d6ea6e33e89dfa6665798ebf658aa6bdeaf313c89f683e7cbc6e1dcb8cef" }, "downloads": -1, "filename": "jshlib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7ace825665768a8e8e1ad8f128ff0177", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 7938, "upload_time": "2019-08-07T03:43:23", "url": "https://files.pythonhosted.org/packages/97/b1/24231a0c459b4c7aedccb5cf4c3f83ce433b12b27f1bdc47484ba73266a0/jshlib-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ace825665768a8e8e1ad8f128ff0177", "sha256": "0a77d6ea6e33e89dfa6665798ebf658aa6bdeaf313c89f683e7cbc6e1dcb8cef" }, "downloads": -1, "filename": "jshlib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7ace825665768a8e8e1ad8f128ff0177", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 7938, "upload_time": "2019-08-07T03:43:23", "url": "https://files.pythonhosted.org/packages/97/b1/24231a0c459b4c7aedccb5cf4c3f83ce433b12b27f1bdc47484ba73266a0/jshlib-0.1.0.tar.gz" } ] }