Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
99ee300
doc: updated README with contributor notes
monazhu Mar 12, 2026
25610b5
added CLAUDE.md to assist with contributor development
monazhu Mar 12, 2026
63103fc
doc: added tutorial notebook
monazhu Mar 12, 2026
b54c93a
chore(deps): bump requests from 2.32.5 to 2.33.0
dependabot[bot] Mar 26, 2026
3e8f7a7
fix: handle duplicate column names in normalize_columns()
nccanderson Mar 31, 2026
d0acc9a
fix: drop duplicate columns instead of suffixing with _2
nccanderson Mar 31, 2026
5211d7a
chore(release): v1.0.2 [skip ci]
Mar 31, 2026
bec98b1
fix: cast Null-typed columns to String to prevent downstream schema e…
nccanderson Apr 1, 2026
b58a81c
chore(release): v1.0.3 [skip ci]
Apr 1, 2026
84fedff
fix: source hmd column from properties instead of legacy top-level field
nccanderson Apr 1, 2026
8443725
chore(release): v1.0.4 [skip ci]
Apr 1, 2026
50ee8b9
chore: added pyyaml and hatchling as project dependencies
monazhu Apr 13, 2026
5be5484
fix: added schema for type casting known columns
monazhu Apr 13, 2026
3f2c105
chore: update ci/cd to check schema for field types at build
monazhu Apr 13, 2026
69eb065
updated procedure for getting and mapping schema dictionaries
monazhu Apr 13, 2026
29e68fc
updated type casting for exceptions
monazhu Apr 13, 2026
fc8e83a
updated scripts to handle schema conversion
monazhu Apr 13, 2026
fa5417e
chore: updated gh ci workflow
monazhu Apr 13, 2026
961cd94
added unit tests to validate schema changes
monazhu Apr 13, 2026
d6b1741
updated timestamp for schema generation
monazhu Apr 13, 2026
7b32a32
fix: resolve lint errors in generated schema and transform module
monazhu Apr 13, 2026
398473c
chore(release): v1.0.5 [skip ci]
Apr 13, 2026
2bdcc12
chore: checkout cvr-slicer in CI for schema freshness validation
monazhu Apr 13, 2026
ccf9cf3
fix: resolve merge conflict in ci.yml — keep slicer checkout step
monazhu Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
- name: Lint with ruff
run: uv run ruff check src/ tests/

- name: Checkout slicer fields
uses: actions/checkout@v4
with:
repository: CognitiveVR/cvr-slicer
path: ../cvr-slicer
sparse-checkout: doc/slicer_fields.yaml
continue-on-error: true

- name: Validate schema freshness
run: |
if [ -f "../cvr-slicer/doc/slicer_fields.yaml" ] || [ -f "../cvr-cortex/doc/slicer_fields.yaml" ]; then
Expand Down
54 changes: 54 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CLAUDE.md — cognitive3dpy contributor guide

## Dev environment

The project uses `uv`. To set up:

```bash
uv sync --all-extras
```

This installs the package, all dev dependencies, and the optional pandas extra.

## Running tests

```bash
uv run pytest tests/ -q # all tests
uv run pytest tests/test_transform.py -q # single file
```

Tests use `respx` to mock HTTP calls — no real API credentials needed.

## Architecture

All data flows through a shared pipeline in `_transform.py`:

```
API JSON → pl.DataFrame → normalize_columns() → coerce_types() → [join_scene_names()] → [select_compact()] → to_output()
```

- `_transform.py` — all DataFrame transformation logic; the first place to look for type/schema issues
- `_client.py` — HTTP client, auth headers, error handling
- `_pagination.py` — session list pagination
- `_lookups.py` — metadata resolution (scenes, objects, objectives); results are cached by project_id
- `_filters.py` — builds the session filter payload sent to the API
- Each public function lives in its own module (`sessions.py`, `events.py`, etc.)

## Key conventions

- **Polars internally, pandas only at the boundary** — all processing uses `polars.DataFrame`; `to_output()` is the only place pandas conversion happens
- **Column naming** — `normalize_columns()` converts everything to `snake_case`; `c3d.*` API properties become `c3d_*` (e.g. `c3d.metrics.fps_score` → `c3d_metrics_fps_score`)
- **Numeric metric columns are always Float64** — `coerce_types()` casts all `c3d_metrics_*`, `c3d_metric_components_*`, and `c3d_roomsize_meters` columns to `pl.Float64`, even when the API returns whole numbers as integers
- **Empty DataFrames have explicit schemas** — functions return typed empty frames (not schema-less) when no data is found
- **Date inputs** — all public functions accept `date`/`datetime` objects, epoch timestamps (int/float seconds), or `"YYYY-MM-DD"` strings

## Release process

Releases are fully automated via `python-semantic-release` on push to `main`. Use conventional commits:

- `fix:` → patch bump
- `feat:` → minor bump
- `feat!:` or `BREAKING CHANGE:` footer → major bump
- `chore:` / `docs:` → no release

The CI workflow (`release.yml`) determines the next version, creates a git tag, builds with `uv`, and publishes to PyPI automatically. Do not manually edit the version in `pyproject.toml`.
654 changes: 0 additions & 654 deletions README.html

This file was deleted.

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,14 @@ All data-fetching functions support these session filters:
- `project_id` — override the default set by `c3d_project()`
- `output` — `"polars"` (default) or `"pandas"`
- `warn_empty` — emit a `UserWarning` when 0 rows are returned (default `True`); set to `False` to suppress

## Contributing

```bash
git clone https://github.com/CognitiveVR/cognitive3dpy.git
cd cognitive3dpy
uv sync --all-extras # installs package + dev + pandas dependencies
uv run pytest tests/ # run tests
```

Releases are automated via [python-semantic-release](https://python-semantic-release.readthedocs.io/) on push to `main`. Use [conventional commits](https://www.conventionalcommits.org/) (`fix:`, `feat:`, `feat!:`) to trigger a release.
Loading
Loading