{"id":27785,"library":"ga4gh-vrsatile-pydantic","title":"GA4GH VRS and VRSATILE Pydantic Models","description":"Provides Pydantic data models for the GA4GH Variation Representation Specification (VRS) and VRSATILE schemas. Currently at v0.2.0, this library transitioned from Pydantic v1 to v2 in a major breaking change. Active development with experimental pre-releases.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/ga4gh/vrs-pydantic","tags":["ga4gh","vrs","vrsatile","pydantic","genomics","variation","data-model"],"install":[{"cmd":"pip install ga4gh-vrsatile-pydantic","lang":"bash","label":"Latest release"}],"dependencies":[{"reason":"Core dependency for data models","package":"pydantic","optional":false},{"reason":"Required for VRSATILE-specific models","package":"ga4gh.vrsatile","optional":false}],"imports":[{"note":"Pre-v0.2.0 import path changed after migration to pydantic v2","wrong":"from ga4gh.vrsatile.models import Allele","symbol":"Allele","correct":"from ga4gh.vrsatile.pydantic import Allele"},{"note":"Incorrect submodule path – models are exported directly from pydantic module","wrong":"from ga4gh.vrsatile.pydantic.vrsatile_models import CopyNumberChange","symbol":"CopyNumberChange","correct":"from ga4gh.vrsatile.pydantic import CopyNumberChange"}],"quickstart":{"code":"from ga4gh.vrsatile.pydantic import Allele, CopyNumberChange\n\n# Example: creating an Allele\nallele = Allele(\n    type=\"Allele\",\n    location={\n        \"type\": \"SequenceLocation\",\n        \"sequence_id\": \"ga4gh:SQ._0wi-qoPhFdH\",\n        \"interval\": {\n            \"type\": \"SequenceInterval\",\n            \"start\": {\"type\": \"Number\", \"value\": 55181320},\n            \"end\": {\"type\": \"Number\", \"value\": 55181321}\n        }\n    },\n    state={\n        \"type\": \"LiteralSequenceExpression\",\n        \"sequence\": \"A\"\n    }\n)\n\n# Validate\nprint(allele.model_dump_json(exclude_none=True))","lang":"python","description":"Creates a VRS Allele model using Pydantic v2 syntax."},"warnings":[{"fix":"Replace all .dict() with .model_dump() and .json() with .model_dump_json() in your code.","message":"v0.2.0 migrated from Pydantic v1 to v2. All .dict() calls must be replaced with .model_dump(), and .json() with .model_dump_json().","severity":"breaking","affected_versions":"0.2.0+"},{"fix":"Upgrade to v0.2.0 and migrate code to Pydantic v2 syntax.","message":"v0.1.0-dev releases (pre-release) used Pydantic v1. These are not compatible with v0.2.0. Avoid using dev versions in production.","severity":"deprecated","affected_versions":"0.1.0-dev*"},{"fix":"Update imports: from ga4gh.vrsatile.pydantic import Allele (instead of from ga4gh.vrsatile.models import Allele).","message":"The import path changed after v0.2.0. Models were previously under ga4gh.vrsatile.models but now under ga4gh.vrsatile.pydantic.","severity":"gotcha","affected_versions":"0.2.0+"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install ga4gh-vrsatile-pydantic>=0.2.0 and ensure imports are from ga4gh.vrsatile.pydantic.","cause":"Version mismatch: code assumes Pydantic v1 import path (pre-0.2.0) or uses wrong submodule.","error":"ga4gh.vrsatile.pydantic doesn't exist"},{"fix":"Replace .dict() with .model_dump() and .json() with .model_dump_json().","cause":"Code written for Pydantic v1 (.dict()) but using v0.2.0 which uses Pydantic v2 (.model_dump()).","error":"AttributeError: 'Allele' object has no attribute 'dict'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}