
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Data parsing and validation library for Python.
Modelity is a data parsing and validation library, written purely in Python, and based on the idea that data parsing and validation should be separated from each other, but being a part of single toolkit for ease of use.
In Modelity, data parsing is executed automatically once data model is instantiated or modified, while model validation needs to be explicitly called by the user. Thanks to this approach, models can be feed with data progressively (f.e. in response to user’s input), while still being able to validate at any time.
Unset
sentinel) and
optional fields set to None
__modelity_type_descriptor__
static method in user-defined type.Why I have created this library?
First reason is that I didn’t find such clean separation in known data parsing tools, and found myself needing such freedom in several projects - both private, and commercial ones. Separation between parsing and validation steps simplifies validators, as validators in models can assume that they are called when model is instantiated, therefore they can access all model’s fields without any extra checks.
Second reason is that I often found myself writing validation logic from the scratch for various reasons, especially for large models with lots of dependencies. Each time I had to validate some complex logic manually I was asking myself, why don’t merge all these ideas and make a library that already has these kind of helpers? For example, I sometimes needed to access parent model when validating field that itself is another, nested model. With Modelity, it is easy, as root model (the one that is validated) is populated to all nested models' validators recursively.
Third reason is that I wanted to finish my over 10 years old, abandoned project Formify (the name is already in use, so I have chosen new name for new project) which I was developing in free time at the beginning of my professional work during learning of Python. That project was originally made to handle form parsing and validation to be used along with web framework. Although the project was never finished, I’ve resurrected some ideas from it, especially parsing and validation separation. You can still find source code on my GH profile.
And last, but not least… I made this project for fun with a hope that maybe someone will find it useful :-)
Here's an example data model created with Modelity:
import datetime
import typing
from modelity.model import Model
class Address(Model):
address_line1: str
address_line2: typing.Optional[str]
city: str
state_province: typing.Optional[str]
postal_code: str
country_code: str
class Person(Model):
name: str
second_name: typing.Optional[str]
surname: str
dob: datetime.date
Please visit project's ReadTheDocs site: https://modelity.readthedocs.io/en/latest/.
This project is released under the terms of the MIT license.
Maciej Wiatrzyk maciej.wiatrzyk@gmail.com
FAQs
Data parsing and validation library for Python
We found that modelity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.