Skip to main content

pyDIGGS

PyPI version Python Versions Downloads Downloads/Month Build Status Documentation Status GitHub Issues License

A Python package for Data Interchange for Geotechnical and Geoenvironmental Specialists (DIGGS).

Project Lead

* Xin Peng (<xin_peng@outlook.com>)
* Asitha Senanayake (<asitha.senanayake@utexas.edu>)

Features

  • Validate DIGGS instance files against:
    • DIGGS XSD Schema (2.5.a, 2.6, 3.0.0) with namespace auto-detect (default profile 3.0.0 when the namespace is unknown)
    • DIGGS Standard dictionaries / codeSpace semantics (offline bundle from diggsml.org/def)
    • Schematron business rules (bundled DIGGS lxml-adapted rules by default)
    • Lightweight context checks (structure / SRS / xlink / dataBlock arity)
  • Flexible validation output:
    • Machine-readable findings with stable rule ids, lines, XPaths and gml:ids, as JSON (diggs-findings 1.0) or SARIF 2.1.0 (pydiggs validate, validate())
    • Write validation errors to log files
    • Print validation errors directly to console
  • Command-line interface (CLI) for easy integration
  • Use it from any application:
    • Python: validate() for files, validate_bytes() for uploads and other in-memory data
    • Web apps: an HTTP API with OpenAPI 3.1 (the server extra, then pydiggs serve --http, or mount pydiggs.server.create_router() in FastAPI)
    • Desktop and native apps: a stdio JSON-RPC 2.0 sidecar (pydiggs serve --stdio) that any host language can drive

Security

pyDIGGS treats every DIGGS file as untrusted input. All XML is parsed with external entities, DTD loading and network access refused, so a file cannot make pyDIGGS read other local files or contact a server. There are two exceptions:

  • A codeSpace that points at a local dictionary (file:///, ./, ../). The DIGGS whitelist permits these, and pyDIGGS parses them with the same hardened settings.
  • With DictionarySemanticValidator(allow_network=True), which is off by default, pyDIGGS downloads dictionaries, but only from whitelisted http/https URLs, re-checked on every redirect, with time and size limits.

Schemas and Schematron rules are different: they are code, not data. A custom schema_path or schematron_path runs with your permissions (Schematron is compiled to XSLT, which can read local files), so only pass files you trust. The bundled DIGGS schemas and rules make no file or network access.

Log files are written to the working directory and are never written through a symlink. Vulnerabilities: please report them privately (see SECURITY.md).

Install from the PyPI wheels, which bundle libxml2, rather than building lxml against an older system libxml2.

Web Application

Not a Python user? Looking for leveraging the power of pyDIGGS in a modern web application? Check out:

Quick Start

Install pydiggs (requires Python 3.11+):

uv pip install pydiggs
# or: pip install pydiggs

Basic usage with Python:

from pydiggs import detect_diggs_version, validator

# Profile auto-detected from the instance namespace (unknown → 3.0.0)
validation = validator("path/to/your/diggs_file.xml")

print(detect_diggs_version("path/to/your/diggs_file.xml"))  # "2.5.a", "2.6", or "3.0.0"

# Or pin a profile explicitly (Python API only)
validation = validator("path/to/your/diggs_file.xml", diggs_version="2.6")

# Schema validation
validation.schema_check()

# Dictionary validation (DIGGSml semantic checks; offline dictionaries)
validation.dictionary_check()

# Schematron validation (bundled DIGGS rules by default)
validation.schematron_check()

# Context checks
validation.context_check()

# Or supply a custom Schematron file
validation = validator("path/to/your/diggs_file.xml", schematron_path="path/to/schematron.sch")
validation.schematron_check()

Every check at once, as machine-readable findings:

# JSON (diggs-findings 1.0); exit 0 = no errors, 1 = errors, 2 = usage/unreadable input
pydiggs validate --format json "path/to/your/diggs_file.xml"

# A whole folder as SARIF 2.1.0 for code-scanning tools
pydiggs validate --format sarif --output pydiggs.sarif "path/to/folder"
from pydiggs import validate

report = validate("path/to/your/diggs_file.xml")  # prints nothing, writes no files
print(report.ok, report.counts)
for finding in report.findings:
    print(finding.rule_id, finding.severity, finding.line, finding.xpath)

See findings for the format, rule ids, exit codes and privacy defaults (no snippets, no absolute paths).

Basic usage with CLI:

# Schema validation (auto-detects DIGGS 2.5.a / 2.6 / 3.0.0)
pydiggs schema_check "path/to/your/diggs_file.xml"

# Dictionary validation
pydiggs dictionary_check "path/to/your/diggs_file.xml"

# Schematron validation (bundled rules)
pydiggs schematron_check "path/to/your/diggs_file.xml"

# Context validation
pydiggs context_check "path/to/your/diggs_file.xml"

# Custom Schematron
pydiggs schematron_check "path/to/your/diggs_file.xml" --schematron_path "path/to/schematron.sch"

See usage for diggs_version / schema_path overrides, log output options, and known limits (dictionary check 12 as WARNING, bundled Schematron subset, and more).

For more detailed information and advanced usage, please see the documentation.

Metadata

Release files for pydiggs 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydiggs 1.3.0
File Size Uploaded Provenance Actions
pydiggs-1.3.0.tar.gz 2.7 MB With provenance Details for pydiggs-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydiggs 1.3.0
File Interpreter ABI Platform Actions
pydiggs-1.3.0-py3-none-any.whl Python 3 none any Details for pydiggs-1.3.0-py3-none-any.whl

Total release size: 4.2 MB

Release files / pydiggs-1.3.0.tar.gz

Download URL pydiggs-1.3.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
e94b3bce3d958d69e607ba4e467a6c4516cb1fbccc930b174e09d71d5ae52862
BLAKE2b-256 checksum
How to use checksums
f6441e332d8effcec9299e8d86980961c6261c28a29439fdca2aa444569e2e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / pydiggs-1.3.0-py3-none-any.whl

Download URL pydiggs-1.3.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dc39f92ea351004292f4e523bd6a7922ca6ee2fdb75007d7a970146aa12f58ec
BLAKE2b-256 checksum
How to use checksums
c872415016c700c01480798bc15cc01043a3b774f1ec67e81cdf1cfb441ed8cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for pydiggs 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydiggs-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files Full provenance

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