Skip to main content

Oblate — data, made easy

Oblate is a Python library that provides modern and robust interface for data and schema validation.

Focused around simplicity and flexibility, Oblate has the following features:

  • Intuitive and modern object oriented interface
  • Built in support for commonly used data structures
  • Easily extendible and customizable to suit every use case
  • Robust with no compromise on performance and speed
  • Typed and plays well with static type checking

Documentation • Source Code • Python Package Index

Installation

Oblate is available on PyPi and can be installed using pip.

$ pip install oblate 

ℹ️ Didn't work? Try prefixing the above command with python -m if you don't have pip on PATH or the command doesn't work for some reason.

Usage

Oblate is focused around simplicity and ease of usage. Below snippet is an example of how data is handled using Oblate:

from oblate import validate, fields
import oblate

# A schema defines the structure of data
class Author(oblate.Schema):
    name = fields.String()  # Field must be a string
    bio = fields.String(none=True)  # Field allows None to be passed
    rating = fields.Integer(default=0)  # Optional field that defaults to 0

    # Apply custom validations to a field
    @validate.field(rating)
    def validate_rating(self, value, ctx):
        assert value >= 0 and value <= 10, 'Rating must be in range 0-10 inclusive'

class Book(oblate.Schema):
    title = fields.String()
    price = fields.Float()
    author = fields.Object(Author)

data = {
    'title': 'Art of Data Validation',
    'price': 20.30,
    'author': {
        'name': 'John',
        'bio': None,
        'rating': 4,
    }
}
book = Book(data)
print(f"{book.title} by {book.author.name}")

Check the Quickstart section in documentation for an introduction to the basics of library.

Metadata

Release files for oblate 1.2.1

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

Built distribution (wheel)

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

Release files / oblate-1.2.1-py3-none-any.whl

Download URL oblate-1.2.1-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7365e00e2f25e1780802a8bb1683553dae2491534cb21b0eb6846c0fa1db6ed1
BLAKE2b-256 checksum
How to use checksums
b4561c39fa9c3b3653fc4874cf5a7aec5ff521805bcd275150d517e5ffdd4bca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.2.1 This release

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

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