dargs
Process arguments for the deep modeling project.
What it is and what it does
dargs is a Python argument validation and documentation library that examines input dictionaries against a schema you define using the Argument class. It checks types, validates nested keys and sub-argument types, and supports a special variant mode where dictionary contents can be determined by the value of a flag key. The library provides three main methods: check (validates structure), normalize (adds defaults and resolves aliases), and gendoc (outputs documentation with optional HTML anchors for cross-reference).
The package integrates with PEP 484 type annotations and offers native support for Sphinx, Jupyter Notebook, and DP-GUI. It can generate JSON schema from an Argument definition for use with JSON editors, and supports loading dictionary values from external JSON or YAML files via a $ref key. It's designed for projects that need declarative, reusable argument schemas with built-in documentation generation.
Use it for:
- Define and validate configuration dictionaries for scientific computing or deep learning pipelines with nested parameters and type safety
- Generate documentation and JSON schemas from argument definitions for use in web UIs or IDE integrations
- Normalize user input by applying default values and resolving aliases before passing to downstream functions
- Handle variant argument structures where the allowed keys depend on the value of a discriminator flag
- Integrate argument validation into Sphinx-based documentation or Jupyter notebooks for interactive parameter exploration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates, normalizes, and documents structured argument dictionaries with type checking, default values, and variant support for Python programs.
Yes, if you need declarative argument validation with built-in documentation. The package is actively maintained, has low install friction, and solves a real problem for projects with complex nested configuration. The LGPLv3 license requires careful review if you're building proprietary software, but the library itself is stable and dependency-light.
Install
dargs on PyPI
pip
pip install dargsuv
uv add dargspoetry
poetry add dargsInstalling dargs
Before you install
Low install friction with a pure-Python wheel and only two lightweight runtime dependencies (typeguard, typing_extensions). Repository is active with recent commits and no archived status.
License in practice
LGPLv3 copyleft license requires that derivative works and modifications be distributed under the same license; proprietary applications using this as a library may need to comply with linking and disclosure obligations.
Quickstart
pip install dargs
from dargs import Argument
arg_def = Argument('config', dict, [Argument('key', str)])
arg_def.check({'key': 'value'})
Verify before relying
- Whether JSON schema generation integrates with external JSON editors as claimed in the description
- Scope and maturity of Sphinx and Jupyter Notebook integration features
- Performance characteristics when validating deeply nested or large argument structures
Package facts
| License | GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — typeguard, typing_extensions |
| Maintenance | actively maintained — 171 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 134,661/month — #11,467 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dargs-0.5.0.post0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
dpguiProvides a web-based GUI for collecting…
copyleft · top 15,000 on PyPI
typeguardPerforms run-time type checking for Python…
permissive · top 1,000 on PyPI
sphinx-argparseSphinx extension that automatically generates…
permissive · top 5,000 on PyPI
marshmallow-jsonschemaConverts marshmallow schemas into JSON Schema…
permissive · top 5,000 on PyPI
jschonValidates JSON data against JSON Schema (drafts…
permissive · top 15,000 on PyPI
lxml-stubsProvides type annotations for the lxml package…
permissive · top 5,000 on PyPI
json-ref-dictProvides a dict-like interface to JSONSchema…
permissive · top 15,000 on PyPI
parse-typeExtends the parse module with type converters…
permissive · top 5,000 on PyPI
flake8-annotationsA Flake8 plugin that enforces PEP 3107-style…
permissive · top 15,000 on PyPI
darglintDarglint is a docstring linter that checks…
permissive · top 15,000 on PyPI