{"id":28244,"library":"spotlight","title":"Spotlight","description":"Data validation library for Python, inspired by Laravel's validation system. Current version 3.4.0, supports Python >=3.6. Active development with frequent releases.","status":"active","version":"3.4.0","language":"python","source_language":"en","source_url":"https://github.com/mdoesburg/spotlight","tags":["validation","form-validation","laravel-inspired"],"install":[{"cmd":"pip install spotlight","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import for the main Validator class.","symbol":"Validator","correct":"from spotlight import Validator"},{"note":"Correct import for the validation error exception.","symbol":"ValidationError","correct":"from spotlight import ValidationError"},{"note":"The `validate` helper function is directly in the spotlight package, not in a submodule.","wrong":"from spotlight.helpers import validate","symbol":"validate","correct":"from spotlight import validate"}],"quickstart":{"code":"from spotlight import Validator\n\nv = Validator({'email': 'user@example.com'}, {'email': 'required|email'})\nif v.passes():\n    print('Validation passed')\nelse:\n    print(v.errors())","lang":"python","description":"Minimal example of creating a Validator instance, checking passes, and retrieving errors."},"warnings":[{"fix":"Use `from spotlight import Validator`.","message":"The import path `from spotlight import Validator` is correct, but many online snippets incorrectly use `from spotlight.validator import Validator` which does not exist.","severity":"gotcha","affected_versions":"all"},{"fix":"Use pipe-separated rules: `'required|email|min:5'`.","message":"Rule strings are space-separated (e.g., 'required|email'), not comma-separated. Using commas will silently fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `Validator` class with `passes()` or `fails()` methods instead of `validate()`.","message":"The `validate()` function (direct call) is deprecated in favor of the `Validator` class for complex rules. It may be removed in future versions.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use `from spotlight import Validator`.","cause":"Incorrect import path; many tutorials mistakenly use `from spotlight.validator import Validator` instead of `from spotlight import Validator`.","error":"ModuleNotFoundError: No module named 'spotlight.validator'"},{"fix":"First call `v.passes()` or `v.fails()`, then access `v.errors()`.","cause":"Calling `v.errors()` before checking validation; errors are only populated after `passes()` or `fails()` is called.","error":"KeyError: 'email' when accessing errors"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}