CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pydantic

Data validation using Python type hints

90

1.30x
Overview
Eval results
Files

rubric.jsonevals/scenario-8/

{
  "context": "This evaluation assesses the engineer's ability to use Pydantic's data parsing capabilities effectively. It focuses on proper use of BaseModel, validation methods (model_validate, model_validate_json), and configuration options for parsing data from different sources including Python objects, dictionaries, JSON strings, and object attributes.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "BaseModel Definition",
      "description": "Defines a model by inheriting from pydantic.BaseModel with appropriate fields and type hints for username (str), email (str), age (int), is_active (bool), and nested preferences structure",
      "max_score": 20
    },
    {
      "name": "Nested Model Structure",
      "description": "Correctly implements nested model structure for preferences field, either as a nested BaseModel class or using appropriate dict type hints",
      "max_score": 15
    },
    {
      "name": "model_validate() Usage",
      "description": "Uses the model_validate() method to parse and validate data from Python dictionaries",
      "max_score": 15
    },
    {
      "name": "model_validate_json() Usage",
      "description": "Uses the model_validate_json() method to parse and validate data from JSON strings",
      "max_score": 15
    },
    {
      "name": "from_attributes Configuration",
      "description": "Configures the model with from_attributes=True in ConfigDict or model_config to enable parsing from object attributes (ORM mode)",
      "max_score": 20
    },
    {
      "name": "Serialization Method",
      "description": "Uses model_dump() method to export the configuration back to dictionary format",
      "max_score": 10
    },
    {
      "name": "ValidationError Handling",
      "description": "Demonstrates proper handling or propagation of pydantic.ValidationError when invalid data is provided, allowing Pydantic's built-in error reporting to function correctly",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/pypi-pydantic

tile.json