Project

General

Profile

Actions

Idea #21935

open

Identify the public API of the Python SDK and make a plan to hide non-public stuff in an internal module

Added by Peter Amstutz 26 days ago. Updated 9 days ago.

Status:
New
Priority:
Normal
Assigned To:
Category:
SDKs
Start date:
07/11/2024
Due date:
Story points:
-
Release:
Release relationship:
Auto

Description

Proposed:

  • arvados.cache has a single class, merge it into arvados.api. (I believe we can maintain backwards compatibility by saying cache = api inside arvados/__init__.py.)
  • Ditto arvados.safeapi.
  • Move the following modules wholesale into arvados._internal, removing leading underscore as needed:
    • arvados.diskcache
    • arvados.http_to_keep
    • arvados.retry
    • arvados.timer (maybe just move this class to arvados._internal since it's so small?)
    • arvados._normalize_stream
    • arvados._pycurlhelper
    • arvados._ranges
  • In arvados.util:
    • deprecated moves to arvados._internal
    • All the _BaseDir* classes move to arvados._internal.basedirs

Subtasks 2 (1 open1 closed)

Task #21980: Review the planResolvedPeter Amstutz07/11/2024Actions
Task #21987: Review 21935-clean-pysdk-apiIn ProgressPeter Amstutz07/13/2024Actions
Actions #1

Updated by Brett Smith 26 days ago

  • Description updated (diff)
Actions #2

Updated by Peter Amstutz 25 days ago

  • Release set to 70
  • Target version changed from Future to Development 2024-07-24 sprint
Actions #3

Updated by Peter Amstutz 19 days ago

  • Assigned To set to Brett Smith
Actions #4

Updated by Peter Amstutz 11 days ago

arvados.safeapi is imported explicitly under certain circumstances (e.g. FUSE, arvados-cwl-runner), so it should probably continue to be import-able at the same location even if it the actual code is moved into another module.

Actions #5

Updated by Brett Smith 11 days ago

Peter Amstutz wrote in #note-4:

arvados.safeapi is imported explicitly under certain circumstances (e.g. FUSE, arvados-cwl-runner), so it should probably continue to be import-able at the same location even if it the actual code is moved into another module.

Yup. The goal for this ticket is to have the module disappear from the web documentation sidebar so there's less to navigate. Plan A is to remove the whole module and define the name in __init__.py as I mentioned. If that's not sufficient to retain backwards compatibility, plan B is to turn the module into a compatibility shim and then explicitly configure pdoc to skip that when generating documentation.

Actions #6

Updated by Brett Smith 11 days ago

Another note from discussion: http_to_keep includes functionality that could be useful in public, but the current API wasn't designed with that in mind and has already had one breaking change between releases. Let's make the current code internal before the API ossifies, and we always have the option to develop a public API for it in the future.

Actions #7

Updated by Brett Smith 9 days ago

21935-clean-pysdk-api @ 5982a7c82355edcb3f3d3dd7c6a29cc8e2e9c107 - developer-run-tests: #4342 - failed only on #21927

  • All agreed upon points are implemented / addressed.
    • As part of moving _normalize_stream and _ranges, I merged them together into one module arvados._internal.streams.
    • During implementation I made a judgment call to leave arvados.retry alone. It is probably the least useful module in the SDK, but something has to carry that title, and it at least has a designed API that's been stable for a long time that implements some Arvados-specific smarts. Given that, avoiding the API break felt better than a move. But if you feel strongly otherwise I wouldn't object to going ahead.
    • As part of moving arvados.util._deprecated, I found we still had arv-migrate-docker19 in the repository, even though its moment is well past. I then also noticed some lingering documentation about the jobs API that was removed in #15397. Scope grew to remove all of that while I was at it.
  • Anything not implemented (discovered or discussed during work) has a follow-up story.
    • N/A
  • Code is tested and passing, both automated and manual, what manual testing was done is described
    • See above. Also rendered and reviewed the Python SDK documentation manually.
  • Documentation has been updated.
    • I did write docstrings for new modules. I did not write or modernize docstrings for every class or function that moved; I don't believe that's in scope. The main benefit of this ticket is that it improves the pydoc documentation, both on the web and the CLI, by showing users a more useful list of modules to browse with less internal noise in it.
  • Behaves appropriately at the intended scale (describe intended scale).
    • No change in scale
  • Considered backwards and forwards compatibility issues between client and server.
    • Per earlier conversation, this branch provides shim modules to keep backwards-compatible names for modules and classes that were over-specialized but definitely public-facing.
  • Follows our coding standards and GUI style guidelines.
    • Yes, and the branch includes small PEP 8 improvements throughout, mostly around import organization.
Actions

Also available in: Atom PDF