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

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.2.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.2.0
File Size Uploaded Provenance
pydiggs-1.2.0.tar.gz 2.6 MB With provenance Details

Built distribution (wheel)

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

Total release size: 4.0 MB

Release files / pydiggs-1.2.0.tar.gz

Download URL pydiggs-1.2.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
812e34785543af59c75c596df13d90ce5e07fa421f93c57f2de669a3110ca69d
BLAKE2b-256 checksum
How to use checksums
0fb9c831a8cfe1c72e33532e043ab7c6a3f709bc647fe438a8298645cbd597f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 23, 2026.

Transparency log

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

Download URL pydiggs-1.2.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
09072936c9609b853b34c1f77e91340b0e8f2eea597ef2e63a704c597bc89221
BLAKE2b-256 checksum
How to use checksums
97d16587de639cd969c7700febecfb644d73348d7b34f8330f465b279681eefe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 23, 2026.

Transparency log

Security for pydiggs 1.2.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydiggs-1.2.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 Oct 23, 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.

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