Skip to content

Document the Python API and API tokens - #24

Open
krokicki wants to merge 6 commits into
mainfrom
docs-python-api-tokens
Open

Document the Python API and API tokens#24
krokicki wants to merge 6 commits into
mainfrom
docs-python-api-tokens

Conversation

@krokicki

@krokicki krokicki commented Aug 25, 2026

Copy link
Copy Markdown
Member

Documents the Python client and API tokens added in JaneliaSciComp/fileglancer#435. Merge alongside that PR — this page describes a feature that does not exist until it lands.

Adds features/python-api.mdx plus its sidebar entry: creating a token in the web UI, the scope table, the two environment variables, working with absolute paths, data links, the Neuroglancer workflow, jobs, and error handling.

What to check

Every code example and factual claim was verified against the implementation rather than the design doc, because the two diverged during the build. Specifically worth confirming:

  • The scope table matches API_SCOPES in fileglancer/auth.py, and jobs:read is described as reaching each job's full record and log files — the /api/jobs prefix covers /{job_id} and /{job_id}/files/{file_type}, so "list jobs" understated it considerably.
  • files:write and jobs:write are documented as not enabled by default, with a note to contact an administrator. That mirrors the api_token_scopes default in the server PR.
  • jobs:write is described as full-account access. It accepts free-form pre_run/post_run shell that runs as the user, so it reaches every file regardless of the files:* scopes granted. The page says so plainly rather than implying containment it does not have.
  • ls() raises rather than returning an empty list for a non-directory, and submit_job needs parameters (defaulted to {} client-side). Both are easy to document backwards.
  • Expired tokens return 401 with the expiry date and keep their row in the UI marked expired; they cannot be renewed.

Conventions

Prose is one line per paragraph, unwrapped, matching the rest of the site. All example paths are neutral placeholders (/data/alice/...) with no institution-specific mount names. astro.config.mjs gains one line, since this site's sidebar is hand-curated rather than autogenerated — without it the page builds but is unreachable.

npm run build passes and the page renders in the Features section.

@StephanPreibisch @JaneliaSciComp/fileglancer

krokicki and others added 6 commits August 24, 2026 21:06
Documents the fileglancer package's Python client (API tokens, scopes,
path operations, data links, Neuroglancer links, jobs, and errors) and
wires the new page into the Features sidebar.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replace the site-specific /nearline/... placeholder with a neutral
/data/alice/... path, document the 401 token-expiry behavior
(message format, Expired badge, no renewal), and note that mkdir
and write require an existing parent directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jobs:write runs pre_run/post_run shell and the job command as the user,
so it isn't confined by files:read/files:write the way the scope list
might imply. State that plainly in the scope table instead of leaving
it to be discovered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The /api/jobs prefix covers the job list, each job's full record, and its
log files, so "List jobs" understated the scope. Matches the wording now
shown in the token creation dialog.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant