{"id":20893,"library":"adaptive-cards-py","title":"adaptive-cards-py","description":"Python library for building Adaptive Cards using Pydantic models. Version 0.4.2, requires Python >=3.10. Uses Pydantic v2 for validation. Active development.","status":"active","version":"0.4.2","language":"python","source_language":"en","source_url":"https://github.com/dennis6p/adaptive-cards-py","tags":["adaptive-cards","microsoft-teams","bot-framework","pydantic"],"install":[{"cmd":"pip install adaptive-cards-py","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for data validation and serialization since v0.3.0","package":"pydantic","optional":false}],"imports":[{"note":"Wrong package name changed in early versions; use underscore","wrong":"from adaptivecards import AdaptiveCard","symbol":"AdaptiveCard","correct":"from adaptive_cards import AdaptiveCard"},{"note":"Elements are in submodules; correct since v0.4.0 restructuring","wrong":"from adaptive_cards import TextBlock","symbol":"TextBlock","correct":"from adaptive_cards.elements import TextBlock"}],"quickstart":{"code":"from adaptive_cards import AdaptiveCard\nfrom adaptive_cards.elements import TextBlock\n\ncard = AdaptiveCard()\ncard.add_item(TextBlock(text='Hello, World!'))\nprint(card.to_json())","lang":"python","description":"Creates a simple Adaptive Card with a text block and prints JSON."},"warnings":[{"fix":"Update to use Pydantic models and .to_json() method.","message":"v0.3.0 replaced dataclasses with Pydantic. If you used dataclass serialization, your code will break.","severity":"breaking","affected_versions":"<0.3.0"},{"fix":"Use from adaptive_cards.elements import TextBlock instead of from adaptive_cards import TextBlock.","message":"v0.4.0 restructured modules: elements are now in submodules like adaptive_cards.elements.","severity":"breaking","affected_versions":"<0.4.0"},{"fix":"Upgrade to v0.2.1 or later.","message":"If you miss the 'type' field in payload when submitting to Teams, the card may not render. This was fixed in v0.2.1.","severity":"gotcha","affected_versions":">=0.2.0, <0.2.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install adaptive-cards-py and use 'from adaptive_cards import AdaptiveCard'.","cause":"Using incorrect package name or import path.","error":"ImportError: cannot import name 'AdaptiveCard' from 'adaptivecards'"},{"fix":"Upgrade to v0.3.0+ or use json.dumps(card.__dict__) for older versions.","cause":"Version <0.3.0 used dataclasses and didn't have to_json().","error":"AttributeError: 'AdaptiveCard' object has no attribute 'to_json'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}