Skip to content

Merge APIStar into the Arkindex client

Erwan Rouchet requested to merge apistarstruck into master

Refs ponos-agent#57, https://redmine.teklia.com/issues/7416#note-3, https://redmine.teklia.com/issues/6850

Archives https://gitlab.teklia.com/arkindex/apistar

I only added a shim for apistar.exceptions.ErrorResponse. code.vpn has found two other imports in other projects that I deliberately ignored:

  • apistar.compat.DownloadedFile in base-worker. This import is only used for static typing and the missing import will be found in CI and fixed very quickly.
  • apistar.document.Field in a project for LOC which we no longer care about, and that was used to work around a backend issue that we already fixed, backend#1614 (closed).

The client is no longer compatible with Python 3.7 because it now relies on importlib.metadata to detect the client's version and set a better User-Agent header than before (arkindex-client/{version} instead of apistar 0.7.2). We use the same method in the Ponos agent.

I already started cleaning up quite a bit, removing many features of APIStar that we do not care about: Swagger support, Swagger/OpenAPI 3 autodetection, a CLI with its own config file format, API documentation generation, etc. This removes the dependency on jinja2 and click. It may still be possible to remove some more, perhaps some of the request encoders and response decoders, or to merge the APIStar client (now known as arkindex.client.base.BaseClient) and the ArkindexClient.

The dependency on typesystem remains, as the package is the base of the whole schema parser. We are not up to the latest version, and we had found that v0.3 was causing trouble, so making our own schema parser or trying to upgrade is something we should look into soon.

With this updated client installed, calling the CLI immediately shows both of the warnings that I added in the APIStar shim:

$ arkindex
/home/erouchet/dev/ark/cli/arkindex_cli/commands/classes.py:6: FutureWarning: The Arkindex API client no longer depends on APIStar. Please update your `apistar` imports to use the `arkindex` package.
  import apistar
/home/erouchet/dev/ark/cli/arkindex_cli/commands/elements/link.py:4: FutureWarning: The Arkindex API client no longer depends on APIStar. Please update your `apistar.exceptions` imports to use the `arkindex.exceptions` module.
  from apistar.exceptions import ErrorResponse
usage: arkindex [-h] [-p SLUG] [--gitlab-secure-file GITLAB_SECURE_FILE] [-v] [-V] subcommand ...
arkindex: error: A subcommand is required.

Merge request reports

Loading