Skip to main content

divejson

Python tools for DiveJSON, an open interchange format for scuba dive logs: the validator, the converters that read other dive-log formats into DiveJSON, and divejson conform, the conformance runner an implementation of the format is checked with.

The format itself — the normative specification, the JSON Schema and the conformance corpus — lives in divejson/divejson. This is an implementation of it, in a repository of its own, and it vendors that repository's schema, fixtures and mapping documents from the commit named in SPEC_REF. CI checks the copy against the specification at that commit on every pull request, so which version of the format this package implements is a fact in the tree rather than a claim in a sentence.

Install

pip install divejson

Python 3.10 or newer.

Validate a document

divejson validate my-logbook.divejson

The JSON Schema, and then the requirements the specification states in prose and a schema cannot — identifier uniqueness, referential closure, profile-series integrity, the member order, the UTC offset on exported_at. Exit status is non-zero if any file fails, with one line per violation.

Convert a logbook into DiveJSON

divejson convert my-logbook.uddf

writes my-logbook.divejson beside the input and reports, line by line, what the source did not carry — no UTC offsets, a cylinder whose size nobody recorded, coordinates that were 0.000000. Nothing absent is filled in: that report is the other half of the output, not a diagnostic, and it is what tells a diver which parts of their history their old application never kept. The mapping rules, the three places UDDF is genuinely ambiguous, and what is deliberately left unmapped are in docs/uddf-mapping.md.

Run a conformance corpus

divejson conform fixtures --strict

Walks a corpus — valid/ documents that must validate, invalid/ ones that must not, and one directory of reader pairs per source format, named for the format — and says what this implementation makes of it. The exit status distinguishes two ways of not passing:

status meaning
0 every case passed
1 a case failed: a valid document that does not validate, an invalid one that does, a pair whose produced document differs from the expected one
2 the corpus's shape is wrong: an empty directory, a pair missing one of its halves, or pairs for a format this implementation does not register — cases that never ran, which is not the same answer as cases that failed

--only <format> and --skip <format> narrow the run to a format's pairs, and neither reaches valid/ or invalid/. --strict turns a format this implementation reads and the corpus has no pairs for from a warning into an error.

What it reads

format what this package does versions
DiveJSON validates 1.0
UDDF reads into DiveJSON 3.0 – 3.2.3

The UDDF reader matches element names rather than the declared version, so older documents using the same names are read too: the corpus it is checked against carries 2.2.0, 3.2.0, 3.2.1 and 3.2.2, under three different root shapes.

Releasing

A release is a tag. Move __version__ in divejson/__init__.py — the build reads the version from there, so it is the only place it lives — head the changelog's new entries with it, land that, and push v<version>. .github/workflows/release.yml then builds the sdist and, from it, the wheel; checks that the tag names the version it built and that the wheel actually runs the corpus; and publishes to PyPI by trusted publishing, with no API token anywhere. Nothing else publishes, and a release is the only thing another repository can pin.

Notices

fitdecode (MIT) is a dependency of this package. The FIT Protocol and FIT file format are proprietary to Garmin; this project is not affiliated with or endorsed by Garmin, and carries no part of the FIT SDK.

License

MIT — see LICENSE. The vendored schema/, fixtures/ and docs/ are MIT in the specification repository too; the specification prose itself, which is CC BY 4.0, is not vendored here.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

divejson-0.2.0.tar.gz (98.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

divejson-0.2.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file divejson-0.2.0.tar.gz.

File metadata

  • Download URL: divejson-0.2.0.tar.gz
  • Upload date:
  • Size: 98.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for divejson-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f5cb726426a88bc861ae9771202d4b093f9c2b6d2c3a65f25a52bdc5d614a1be
MD5 8d0f949d6f1a4916f94f2e58b857ef16
BLAKE2b-256 5aaae616bb4dc699cfea9a993ecdda5d8692bdb5a2a8ac959a5f58041697a6fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for divejson-0.2.0.tar.gz:

Publisher: release.yml on divejson/divejson-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file divejson-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: divejson-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for divejson-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a14d40b8c2d0015038c5da92e893771672b1e028c05fe11673ffbff3449f1d0
MD5 2634c29101a2b80044e72fdd50c33739
BLAKE2b-256 2878de5ab8cc4924521d5f2f0d801291256981be261ac963fb04dc3c016e9382

See more details on using hashes here.

Provenance

The following attestation bundles were made for divejson-0.2.0-py3-none-any.whl:

Publisher: release.yml on divejson/divejson-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page