docs: add a Python SDK quick start - #22
Open
dchaudhari7177 wants to merge 1 commit into
Open
Conversation
Everything the CLI does is on the DataSentry client, but the first SDK experience was undiscoverable. quickstart.py is sixteen lines: open a workspace, scan a synthetic CSV, print the score, print the top issues by priority, close the client in a finally. Public methods only -- scan_file, quality_score, close -- and no new dependencies. make_csv.py plants one flaw per row rather than corrupting randomly, so the documented output reproduces on any machine. The README states the four things that are not obvious from the signature: scan_file returns a triple, priority_score is the right sort key rather than severity, close() belongs in a finally because the client holds an open SQLite handle, and project= decides where scan history lives. Repairs are left to examples/demo/.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #15
examples/python-sdk/—quickstart.pyis 16 lines of code, and the output in the README was captured from running it, then re-run from a clean state to confirm it reproduces.Constraints
scan_file,quality_score,close, plusexport_reportin the optional snippet. Nothing reads_store,_registryor any other private attributemake_csv.pywrites ten rows; the last four carry one deliberate flaw each — a malformed email,2026-02-30, a missing price, an exact duplicate — so each finding traces to a visible cause and the numbers are identical on any machine.gitignorekeepsorders.csvand.datasentry/out of the repositoryThe four notes in the README
These are the things I got wrong or had to look up while writing it, so they seemed worth writing down:
scan_filereturns a triple, not a scan. The middle element is per-detector timing and status; the example discards it with_detector_runspriority_score, not severity. Priority already folds in confidence, affected ratio and detector agreement. In this very output thehighdatetime issue sits second, because three detectors agreed aboutunit_price— sorting by severity would misrepresent what the tool actually concludedclose()belongs in afinally. The client holds an open SQLite metadata handle; leaking it is survivable in a script and is not in a long-running processproject="."decides where.datasentry/lives, which is what makes a second run comparable to the firstAlso
The optional report snippet uses
client.export_report(scan.id), which returns the JSON report as a dict. HTML export is pointed at the CLI rather than reached for through the client.Repairs are left out and pointed at
examples/demo/, matching the same boundary as #14.Linked from
examples/README.mdin the goal table.