This page walks you through everything you need to go from zero to a working BasicReturns integration. By the end you will have installed the library, imported both public models, written functions that return consistent success/failure objects, and serialized a result to a dictionary — all in under five minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dev2forge/BasicReturns/llms.txt
Use this file to discover all available pages before exploring further.
Install BasicReturns
Install the package from PyPI using your preferred package manager. The only dependency —
pydantic==2.12.5 — is pulled in automatically.Import the Models
Both public classes are available directly from the top-level
BasicReturns package. A single import line is all you need.Use BasicReturn for Simple Success / Failure
BasicReturn is the right choice when your function either succeeds or fails with no payload to return — for example a write, delete, or validation step. It defaults ok to True, so you only need to set fields when something goes wrong.Use DataAndMsgReturn for Operations That Return Data
DataAndMsgReturn extends BasicReturn with two extra fields: data for the payload and msg for a human-readable status message. The example below is taken directly from the README.Always check
result.ok before accessing result.data. When ok is False, the data field defaults to None (serialized as {} by to_dict()), so reading it without a guard may produce unexpected results in downstream logic.Next Steps
Now that you have a working integration, explore the full model reference to learn about every field, default value, and method in detail.Return Models Reference
Deep-dive into
BasicReturn and DataAndMsgReturn: field types, default values, the to_dict() method, __str__ formatting, and inheritance hierarchy.