Skip to main content

Python tools for typed input validation.

Project description

Rynput

Python tools for strongly typed input validation.

Description

Rynput is focused on validating strings and converting them to a specific type, if possible. It is particularily effective when configuring a large list of properties which may have very different requirements for their values.

Usage

It is recommended to use the following import statement:

from rynput import Property, PropertyGroup, validators

From there, create the list of properties to validate. The constructor for Property takes a name (str), type (Validator), and optionally a default value and description. Omitting a default value means that the property is marked as "required," and thus cannot be omitted by the input method.

properties = PropertyGroup([
    Property("Option", validators.Option(["Foo", "Bar", "Baz"]), "Foo"), # Default value provided
    Property("Integer", validators.Integer(4, 8)), # Required
    ...
])

The input strings may come from anywhere. However, typical examples may include a user configuration wizard (see examples/input_example.py) or from a config file (examples/json_example.py).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rynput-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rynput-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file rynput-1.0.0.tar.gz.

File metadata

  • Download URL: rynput-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rynput-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bbbef983e7c6f77e732719c86233a5e1046f2f4b491108be7ebd97ed998d4f23
MD5 018ccac4041232b3e4c5e281d9fc5ddb
BLAKE2b-256 d1407434048d539f91c33744f496baea19dbbf99ad8c20e5a842dcfa8959dc3e

See more details on using hashes here.

File details

Details for the file rynput-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rynput-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rynput-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d8b54b940f196d572e38b318885761c71e4d8175446b2a48e6009862e2edcfc
MD5 45aa9d7fc7737c2a744deb48cc04bc09
BLAKE2b-256 0c2e2c720f59969d9e65f91d7834bcec8d5a4c467b790cc91c78b4052258018e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page