Skip to content

SK-2707: Improve Python SDK onboarding — docs, samples, and correctness fixes#263

Open
Devesh-Skyflow wants to merge 9 commits into
mainfrom
devesh/SK-2707-readme-sample-fixes
Open

SK-2707: Improve Python SDK onboarding — docs, samples, and correctness fixes#263
Devesh-Skyflow wants to merge 9 commits into
mainfrom
devesh/SK-2707-readme-sample-fixes

Conversation

@Devesh-Skyflow
Copy link
Copy Markdown
Collaborator

Improves the onboarding experience for the Python SDK by fixing doc/code correctness drift, documenting the previously-undocumented public API surface, and lowering the time-to-first-success. Based on a consolidated backlog merging an onboarding/first-run audit with the API-coverage audit (Confluence: SDK1/Python).

Why

  • The README contradicted the code in ways that break or mislead new users before they write any code (e.g. claimed Python 3.8 support while the package requires 3.9; listed PATCH as a connection method that doesn't exist in RequestMethod).
  • ~35+ public interfaces (response objects, request params, enums, client-management methods, service-account functions, Detect helpers) were undocumented, forcing users to read source.
  • There was no "zero-to-running" path (no guidance on where to find vault_id/cluster_id/credentials), no response-shape documentation, no troubleshooting guidance, and no type-checker support (py.typed missing at the package root).

Goal

  • Make the README correct and the public API discoverable, and let a new user get to a first successful call from the docs alone.
  • Intended outcomes:
    • Correctness: Python requirement 3.8 → 3.9 (matches setup.py + CI); removed non-existent PATCH connection method; aligned setuptools floor between requirements.txt and setup.py; renamed misleading deidentify_file_async.pydeidentify_file_concurrent.py (it uses thread-based concurrency, not asyncio).
    • Typing: added skyflow/py.typed (PEP 561) and shipped it via package_data so mypy/pyright see the SDK's types.
    • Docs: new docs/api_reference.md (response objects, request params, enums, client-management methods, service-account functions, Detect helpers — all verified against source) linked from the README; new README sections "Before you begin", "Using the client in production", and "Troubleshooting"; status badges.
    • Samples: samples/README.md (prerequisites, how to run, per-sample index) and samples/.env.example.
    • Planning: docs/onboarding-backlog.md consolidating both audits into a prioritized backlog.
  • Non-goals (future PRs): typed config/request objects (TypedDict/pydantic), hosted API reference (Sphinx/ReadTheDocs) + README split, framework integration guides (Django/Flask/FastAPI), contributor files (CONTRIBUTING.md / issue templates / CODE_OF_CONDUCT). The UploadFileRequest empty-stub cleanup is intentionally deferred (potential breaking change, to be gated on a version bump).

Testing

  • Docs/config/sample changes only — no SDK runtime behavior changed.
  • Verified the built wheel includes skyflow/py.typed and skyflow/generated/rest/py.typed.
  • Smoke-tested imports and confirmed RequestMethod.PATCH does not exist (hasattr(RequestMethod, 'PATCH') == False), backing the README fix.
  • Every attribute, parameter, and enum value in docs/api_reference.md was cross-checked against the source constructors/enums; the samples/README.md index was cross-checked against the actual sample files.
  • No unit tests added because there is no new/changed executable code. No prod-release concerns.

Tech debt

  • Addresses tech debt: removes doc/code drift, documents the public API surface, and adds the PEP 561 typing marker.
  • Does not add tech debt. Lays groundwork for the deferred bigger-bet items tracked in docs/onboarding-backlog.md.

Devesh-Skyflow and others added 9 commits June 2, 2026 09:35
- Add top-level skyflow/py.typed (PEP 561) so type checkers see the
  SDK's types; include it (and the generated rest marker) via package_data.
- Align setuptools floor in requirements.txt with setup.py (>= 75.3.3).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Rename deidentify_file_async.py -> deidentify_file_concurrent.py and
  clarify it uses thread-based concurrency, not asyncio (SDK is sync-only).
- Add samples/README.md (prerequisites, how to run, per-sample index) and
  samples/.env.example for collecting vault values.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix Python requirement (3.8 -> 3.9) to match setup.py and CI.
- Remove PATCH from connection methods (not a RequestMethod member).
- Add docs/api_reference.md documenting response objects, request params,
  enums, client-management methods, Detect helpers, and service-account
  functions (all verified against source); link it from the README.
- Add README sections: Before you begin, Using the client in production,
  and Troubleshooting; add status badges.
- Add docs/onboarding-backlog.md consolidating the onboarding and
  API-coverage audits into a prioritized backlog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The README listed PATCH as a supported connection method but RequestMethod
had no PATCH member, so RequestMethod.PATCH raised AttributeError. The SDK
passes request.method.value straight through to the connection (it does not
restrict to a fixed set), so PATCH is a real capability that was simply
missing from the enum. Add PATCH = "PATCH" and restore it in the README and
API reference (reversing the earlier doc-only removal).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove samples/.env.example and the dotenv/.env loading guidance from
samples/README.md. The samples are run by replacing the inline
<PLACEHOLDER> values directly. Update the OB-11 backlog entry to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each vault, token, connection, and Detect operation now shows an
"Example response" block with the printed response object, so the response
shape is visible at the point of use instead of only via the API reference
link. Shapes verified against the response parsers and existing tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add per-class anchors to the response-objects table in
docs/api_reference.md and turn each "Returns a <X>Response" mention in the
README into a link to its anchor, so readers can jump straight to the full
attribute reference for that response.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ions)

Replace the flat "Attributes" column with a per-response subsection that
documents each attribute's type and meaning, marks optional attributes with
`| None`, and explains the shared `errors` shape once. Response anchors now
come from the subsection headings (README deep-links still resolve).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Document all request classes in docs/api_reference.md, adding the
  previously-missing ones (Detokenize, Tokenize, Delete, Query,
  ReidentifyText, GetDetectRun, InvokeConnection) with parameter tables.
- Make request headings anchor-friendly and link each request-class mention
  in the README to its parameter reference, so request options are
  discoverable at the point of use (mirrors the response-object links).

Co-Authored-By: Claude Opus 4.8 (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