Summary
The Shock client libraries in libs/ and shock-client/ are outdated. The Python client is Python 2 only and broken on Python 3, the JavaScript client is a 2013 jQuery browser script, and the Go client library has not been updated since 2019. For scripting against Shock today, users must fall back to raw curl commands.
Current State
| Client |
Language |
Location |
Last Active |
Issues |
go-shock-client |
Go library |
vendor/github.com/MG-RAST/go-shock-client/ |
2019 |
No go.mod; not published as a Go module; vendored/frozen |
shock-client |
Go CLI |
shock-client/ |
2018 |
Compiles but no new features; wiki docs reference port 7044 |
shock.py |
Python 2 |
libs/shock.py |
2019 |
Broken on Python 3 — uses cStringIO, urllib.urlencode, urllib.quote |
shock.js |
JS (jQuery) |
libs/shock.js |
2013 |
Browser-only; jQuery dependency; no npm package; pre-ES6 |
SHOCK::Client |
Perl |
libs/SHOCK/Client.pm |
2019 |
Functional but unmaintained |
Proposed Work
High Priority
Medium Priority
Low Priority
Alternative
If maintaining multiple language clients is too much overhead, consider:
- Documenting the REST API thoroughly (done in fee7725) and providing a
curl-based tutorial (done in docs/tutorial.md)
- Generating clients from the OpenAPI spec (
docs/API/shock-openapi.yaml) using a tool like openapi-generator
Summary
The Shock client libraries in
libs/andshock-client/are outdated. The Python client is Python 2 only and broken on Python 3, the JavaScript client is a 2013 jQuery browser script, and the Go client library has not been updated since 2019. For scripting against Shock today, users must fall back to rawcurlcommands.Current State
go-shock-clientvendor/github.com/MG-RAST/go-shock-client/go.mod; not published as a Go module; vendored/frozenshock-clientshock-client/shock.pylibs/shock.pycStringIO,urllib.urlencode,urllib.quoteshock.jslibs/shock.jsSHOCK::Clientlibs/SHOCK/Client.pmProposed Work
High Priority
libs/shock.pyto Python 3 — replacecStringIOwithio.BytesIO,urllib→urllib.parse, test against current Shock API. This is the most impactful change since Python is widely used in the bioinformatics community.Medium Priority
go-shock-client— addgo.mod, publish as a proper Go module, update to current API (locations, types endpoints). Consider merging into this repo or updating the external repo atgithub.com/MG-RAST/go-shock-client.libs/shock.jswith a modern JS/Node client — drop jQuery dependency, usefetchAPI, publish as npm package or at minimum make it usable from Node.js.Low Priority
shock-clientCLI — add support for locations and types commands, update default port references.libs/SHOCK/Client.pmstill has users; if not, consider archiving.Alternative
If maintaining multiple language clients is too much overhead, consider:
curl-based tutorial (done indocs/tutorial.md)docs/API/shock-openapi.yaml) using a tool likeopenapi-generator