Skip to content

Modernize client libraries (Python 3, JS/Node, Go module) #409

@wilke

Description

@wilke

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

  • Port libs/shock.py to Python 3 — replace cStringIO with io.BytesIO, urlliburllib.parse, test against current Shock API. This is the most impactful change since Python is widely used in the bioinformatics community.

Medium Priority

  • Modernize go-shock-client — add go.mod, publish as a proper Go module, update to current API (locations, types endpoints). Consider merging into this repo or updating the external repo at github.com/MG-RAST/go-shock-client.
  • Replace libs/shock.js with a modern JS/Node client — drop jQuery dependency, use fetch API, publish as npm package or at minimum make it usable from Node.js.

Low Priority

  • Update shock-client CLI — add support for locations and types commands, update default port references.
  • Decide on Perl client — determine if libs/SHOCK/Client.pm still has users; if not, consider archiving.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions