Skip to content

dxray: an X-ray for your data (Python library), and how to publish to PyPI - #58

Merged
fcopensource merged 1 commit into
mainfrom
dxray-python
Nov 24, 2026
Merged

fcopensource merged 1 commit into
mainfrom
dxray-python

Conversation

@fcopensource

Copy link
Copy Markdown
Owner

dxray: one line finds what's wrong with a dataset and what stands out

A new Python library in python/dxray, plus a guide to publishing our Python libraries.

import dxray as dx
dx.scan(df, target="revenue")          # types, problems + fixes, ranked insights, health score
dx.clean(df)                           # safe fixes, with a log of every change
dx.for_llm(df)                         # the dataset described for an AI model
dx.ask(df, "Why did revenue drop?")    # answered by Claude (pip install "dxray[ai]")

What it does

  • Column types beyond pandas dtypes: numbers and dates stored as text, yes/no, IDs, emails, URLs, categories, free text and constants.
  • Data problems, each with the pandas line that fixes it: missing values (including "N/A" and "-" hidden as text), duplicates, repeated IDs, one category spelled several ways, stray spaces, outliers (on a log scale for money-like columns) and sentinel values like -999. Plus a 0–100 health score.
  • Ranked insights in plain English: relationships, groups that differ, what drives a target, trends with the biggest rise and fall, 80/20 concentration, and averages skewed by a few big values.
  • Reports: terminal, Jupyter, one self-contained HTML page with inline SVG charts, Markdown and JSON. A dxray command handles CSV, Excel, Parquet and JSON files.
  • dx.ask(): uses claude-opus-5-5 with streaming and server-side "default" fallbacks, and caches the dataset description across questions. Claude sees the description, not the rows.

Tests

  • 41 tests. The example dataset has planted problems and patterns, and every one is found, with no false alarms on naturally lopsided money columns.
  • dx.ask() was checked through the real Anthropic SDK against a local stand-in API: no key, no cost.
  • The wheel and sdist pass twine check and work from a fresh install.
  • This PR runs .github/workflows/dxray.yml on Linux, Windows and macOS with Python 3.9–3.14.

How to publish: see docs/PUBLISHING-PYTHON-LIBRARIES.md. In short, after merging:

  1. In PyPI's publishing settings, add a pending publisher with project dxray, owner fcopensource, repository veyraeditor, workflow dxray.yml, environment pypi.
  2. Go to Actions → dxray (Python) → Run workflow → pypi.

The same steps work for veyra-snap.

🤖 Generated with Claude Code

…to PyPI

python/dxray: `pip install dxray`, then `dx.scan(df)` says what each column
really is, what's wrong with the data and what stands out, in plain English.

- Column types beyond pandas dtypes: numbers and dates stored as text,
  yes/no, IDs, emails, URLs, categories, free text, constants.
- Data problems, each with the pandas line that fixes it: missing values
  (including "N/A"/"-" text), duplicates, repeated IDs, one category spelled
  several ways, stray spaces, outliers (log scale for money-like columns),
  sentinel values like -999. A 0-100 health score.
- Ranked insights: relationships, groups that differ, what drives a target,
  trends and the biggest rise and fall on the main date column (typos and thin
  periods can't fake them), 80/20 concentration, lopsided averages.
- Reports for the terminal, Jupyter, one self-contained HTML page with inline
  SVG charts, Markdown and JSON.
- dx.clean(): safe mechanical fixes with a log; never drops outliers or fills
  gaps. dx.for_llm(): the dataset described for an AI model.
- dx.ask(): answers from Claude (optional extra dxray[ai]): streaming,
  claude-opus-5-5, server-side "default" fallbacks, the description in a cached
  system prompt. Checked through the real SDK against a local stand-in API.
- The dxray command for CSV/TSV/Excel/Parquet/JSON.

Tests: 41 (every planted problem and pattern in a messy example dataset is
found, no false alarms on naturally lopsided money, clean, for_llm, ask with a
fake client, the CLI, edge cases, 500k rows in seconds). Wheel and sdist pass
twine check and work from a fresh install.

Also .github/workflows/dxray.yml (tests on Linux/Windows/macOS, Python
3.9-3.14; publish with PyPI Trusted Publishing) and
docs/PUBLISHING-PYTHON-LIBRARIES.md, a step-by-step guide to publishing dxray
and veyra-snap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fcopensource
fcopensource merged commit 87f2e17 into main Nov 24, 2026
22 of 25 checks passed
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.

2 participants