Skip to main content

form

Version: 0.1.20

wexample-form is a Python library for declaring CLI forms as composable models with validators and renderers, built on top of wexample-prompt. It targets Python ≥ 3.10 developers in the Wexample suite who need structured, reusable input handling for command-line interfaces. The model layer relies on attrs and cattrs, keeping field definitions, validation, and rendering as distinct, separately testable concerns.

Table of Contents

Quickstart

wexample-form is not yet implemented. The package ships only the py.typed marker and an empty __init__.py; no public API exists to import or call. This page will be written once the model, validator, and renderer layers described in the architecture document are in place.

Tests

Run the test suite:

pytest tests/

With coverage:

pytest --cov=form tests/

Architecture

wexample-form is a Python library for declaring CLI forms as composable models. The design keeps three concerns separate: models declare form fields using attrs, validators check field values independently of presentation, and renderers drive the terminal interaction through wexample-prompt. None of these three layers is expected to reach into the other two.

Repository layout

The project uses PDM with a src layout. The distributable package lives under src/wexample_form/; build metadata is declared in pyproject.toml.

src/
  wexample_form/   ← installed package (wexample-form on PyPI)
tests/             ← pytest suite (testpaths = ["tests"])
examples/          ← runnable usage examples

pytest is configured with pythonpath = ["src"], so the package resolves from source without installation during development.

Dependency stack

Each dependency occupies a distinct layer:

Package Minimum Role
attrs 23.1.0 Class generation and field definitions for form models
cattrs 23.1.0 Structuring and unstructuring of model data
wexample-helpers 19.0.0 Shared utilities from the Wexample suite
wexample-prompt 14.1.0 All terminal output — renderers delegate here entirely

attrs + cattrs handle the model layer; wexample-prompt handles everything the user sees. wexample-helpers provides cross-cutting utilities shared across the suite.

Three-concern design

The library is built around three independently testable concerns:

  1. Model — an attrs-based class that declares the fields of a form, their types, and defaults.
  2. Validator — logic that inspects field values and raises or returns errors without knowing how the form renders.
  3. Renderer — receives a model instance and drives the CLI interaction through wexample-prompt, keeping all terminal code out of the model.

A form is defined as a model, validated independently, then handed to a renderer that uses wexample-prompt to present prompts and collect input. The split means a validator can be unit-tested against plain Python values, and a renderer can be swapped without touching model or validation code.

Integration in the Suite

This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.

The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.

Visit the Wexample Suite documentation for the complete package ecosystem.

Dependencies

  • attrs: >=23.1.0
  • cattrs: >=23.1.0
  • wexample-helpers: >=20.2.0
  • wexample-prompt: >=16.0.0

Versioning & Compatibility Policy

Wexample packages follow Semantic Versioning (SemVer):

  • MAJOR: Breaking changes
  • MINOR: New features, backward compatible
  • PATCH: Bug fixes, backward compatible

We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Free to use in both personal and commercial projects.

About us

Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.

This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.

Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.

Known Limitations & Roadmap

Current limitations and planned features are tracked in the GitHub issues.

See the project roadmap for upcoming features and improvements.

Status & Compatibility

Maturity: Production-ready

Python Support: >=3.10

OS Support: Linux, macOS, Windows

Status: Actively maintained

Migration Notes

When upgrading between major versions, refer to the migration guides in the documentation.

Breaking changes are clearly documented with upgrade paths and examples.

Metadata

Release files for wexample-form 0.1.20

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

Source distribution (sdist)

Source distribution for wexample-form 0.1.20
File Size Uploaded
wexample_form-0.1.20.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wexample-form 0.1.20
File Interpreter ABI Platform
wexample_form-0.1.20-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / wexample_form-0.1.20.tar.gz

Download URL wexample_form-0.1.20.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3f7242faada89cdfb4e408df7eaa2644f5c94c4134f2f350a4900722df710758
BLAKE2b-256 checksum
How to use checksums
514617f261552d36ad167ec0f4dd0ee2e1eb4c0f80fe9f7b74585bf646dde002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-139-generic

Release files / wexample_form-0.1.20-py3-none-any.whl

Download URL wexample_form-0.1.20-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c8e0b9eab5e8932dea72e00cb7f7e57d3930fb04e6964bdd53024c2f5fecc91
BLAKE2b-256 checksum
How to use checksums
9ef9cfb78fc50a4e1ae6f21dfd1cd253021381aa5aa97767e62b75809a598106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-139-generic

Release history Release notifications | RSS feed

0.1.21

2 release files

This release

0.1.20 This release

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release 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