Skip to main content

An HCLI connector that can be used to expose any CLI expressed through hypertext command line interface (HCLI) semantics.

Project description

An HCLI Connector that can be used to expose a REST API with a built-in CLI, via hypertext command line interface (HCLI) semantics.


HCLI Core implements an HCLI Connector, a type of Service Connector, as a WSGI application and provides a way for developers to expose a service hosted CLI, as a REST API, via HCLI semantics. Such an API exposes a”built-in” CLI that can be interacted with dynamically with any HCLI client. Up to date, in-band, man page style API/CLI documentation is readily available for use to help understand how to interact with the API.

Most, if not all, programming languages have a way to issue shell commands. With the help of a generic HCLI client, such as Huckle [1], APIs that make use of HCLI semantics are readily consumable anywhere via the familiar command line (CLI) mode of operation, and this, without there being a need to write a custom and dedicated CLI to interact with a specific HCLI API.

You can find out more about HCLI on hcli.io [2]

The HCLI Internet-Draft [3] is a work in progress by the author and the current implementation leverages hal+json alongside a static form of ALPS (semantic profile) [4] to help enable widespread cross media-type support.

Help shape HCLI and it’s ecosystem on the discussion list [5] or by raising issues on github!

[1] https://github.com/cometaj2/huckle

[2] http://hcli.io

[3] https://github.com/cometaj2/I-D/tree/master/hcli

[4] http://alps.io

[5] https://groups.google.com/forum/#!forum/huck-hypermedia-unified-cli-with-a-kick

Installation

hcli_core requires Python 3.5-3.9 and pip.

You’ll need an WSGI compliant application server to run hcli_core. For example, you can use Green Unicorn (https://gunicorn.org/)

$ pip install gunicorn

Install hcli_core via pip. You can launch gunicorn from anywhere by using “hcli_core path”. You can also look at the hcli_core help file:

$ pip install hcli_core

$ hcli_core help

$ gunicorn –workers=5 –threads=2 -b 127.0.0.1:8000 –chdir `hcli_core path` “hcli_core:connector()”

If you want to load a sample HCLI other than the default, you can try loading the sample hfm (hypertext file manager) HCLI. A folder path to any 3rd party HCLI can be provided in the same way:

$ gunicorn –workers=5 –threads=2 -b 127.0.0.1:8000 –chdir `hcli_core path` “hcli_core:connector(”""`hcli_core sample hfm`”"")”

Curl your new service to understand what is being exposed. The HCLI root URL, to use with an HCLI client, is the cli link relation:

$ curl http://127.0.0.1:8000

Install an HCLI client, for example Huckle (https://github.com/cometaj2/huckle), and access the default sample jsonf CLI exposed by HCLI Core (you may need to restart your terminal to be able to use jsonf by name directly; otherwise you can attempt to source ~/.bash_profile or ~/.bashrc):

$ pip install huckle

$ huckle cli install http://127.0.0.1:8000

$ jsonf help

You can also look at the huckle help file:

$ huckle help

Bugs

  • No good handling of control over request and response in cli code which can lead to exceptions and empty response client side.

  • The hfm sample HCLI fails disgracefully when copying a remote file name that doesn’t exist (server error).

  • Unresolved, but otherwise apparently unimpactful gunicorn deprecated warning (gunicorn/workers/gthread.py:323: DeprecatedWarning: Call to deprecated property body. Please use text instead. respiter = self.wsgi(environ, resp.start_response)).

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hcli_core-0.10.4.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

hcli_core-0.10.4-py2.py3-none-any.whl (53.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file hcli_core-0.10.4.tar.gz.

File metadata

  • Download URL: hcli_core-0.10.4.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.9

File hashes

Hashes for hcli_core-0.10.4.tar.gz
Algorithm Hash digest
SHA256 50cbebda5b7f100d5a36546457d09ed7ce1abbc9dfa575ba9ffc4441ad669e4e
MD5 22f13f8a7e117faceda540307e9d2c46
BLAKE2b-256 1148a08a8257827e9f659150d8ed58e38181f66f95b59e82563f15fbea08b83c

See more details on using hashes here.

File details

Details for the file hcli_core-0.10.4-py2.py3-none-any.whl.

File metadata

  • Download URL: hcli_core-0.10.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.9

File hashes

Hashes for hcli_core-0.10.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5932b0410c4aaad26b2a87b8cda8136c1116a08af5c91f53d60f5b7e012b0b35
MD5 6952ea10abf89d7e3e6a987dfdbb0910
BLAKE2b-256 3f9c7dcd09efdb40a6ff54443111077a76a72f09a91f6dbd0a609043c0987ba6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page