pyDIGGS
A Python package for Data Interchange for Geotechnical and Geoenvironmental Specialists (DIGGS).
- Licensed under the Apache License 2.0
- Documentation: https://xinp-hub.github.io/pydiggs
- GitHub: https://github.com/xinp-hub/pydiggs
- PyPI: https://pypi.org/project/pydiggs
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:
- 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
codeSpacethat 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()
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.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydiggs-1.1.1.tar.gz | 2.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydiggs-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.4 MB
Release files / pydiggs-1.1.1.tar.gz
| Download URL | pydiggs-1.1.1.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
737c14cbf84ac537009693c235ff0bf277a50e4694f324a50acf9e61c897b42e
|
|
BLAKE2b-256 checksum How to use checksums |
cb9836c98c27da0bcc7eb47be68d8d3a087d9fb82e8b2cb2b950c4bf7d18c1bc
|
| 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 14, 2026.
Transparency logRelease files / pydiggs-1.1.1-py3-none-any.whl
| Download URL | pydiggs-1.1.1-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e658aaf5c57ad6d3c0c3c66f4a510e918b7d351c8e655997f078e355ceb1790
|
|
BLAKE2b-256 checksum How to use checksums |
6ab534b36abb56800a53662010344851713f777afb97a1b4bfd00ef13a2e9561
|
| 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 14, 2026.
Transparency log