{"id":44184,"library":"abstractcp","title":"abstractcp","description":"A Python library (v1.0.0, stable) that provides a decorator to create abstract class variables (class-level attributes) with support for inheritance checks. Requires Python >=3.8.","status":"active","version":"1.0.0","language":"python","source_language":"en","source_url":"https://github.com/reinhrst/abstractcp","tags":["abstract-class-variables","oop","inheritance"],"install":[{"cmd":"pip install abstractcp","lang":"bash","label":"default"}],"dependencies":[],"imports":[{"wrong":"from abstractcp import abstract_classvar","symbol":"Abstract","correct":"from abstractcp import Abstract"},{"symbol":"abstract_class_property","correct":"from abstractcp import abstract_class_property"},{"symbol":"AbstractClassWithoutAbstractPropertiesWarning","correct":"from abstractcp import AbstractClassWithoutAbstractPropertiesWarning"}],"quickstart":{"code":"from abstractcp import abstract_classvar\nfrom abc import ABC\n\nclass MyBase(ABC):\n    x = abstract_classvar(int)\n\nclass MyConcrete(MyBase):\n    x = 10\n\n# Attempting to instantiate MyBase without setting x raises TypeError\n# obj = MyBase()  # TypeError: Can't instantiate abstract class MyBase with abstract class variables x","lang":"python","description":"Define abstract class variables that must be overridden in subclasses."},"warnings":[{"fix":"Ensure your base class inherits from abc.ABC.","message":"abstract_classvar only works with classes inheriting from ABC. Using it on a non-ABC class will not enforce overriding.","severity":"gotcha","affected_versions":"all"},{"fix":"Double-check the type hint when declaring abstract_classvar.","message":"Abstract class variables must be assigned exactly the same type as declared (or a subtype). Mismatched types raise TypeError at instantiation.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.8':27 'abstract':13,29 'abstract-class-vari':28 'abstractcp':1 'attribut':19 'check':24 'class':14,17,30 'class-level':16 'creat':12 'decor':10 'inherit':23,33 'level':18 'librari':4 'oop':32 'provid':8 'python':3,26 'requir':25 'stabl':6 'support':21 'v1.0.0':5 'variabl':15,31","created_at":"2026-06-07T12:48:53.533192+00:00","updated_at":"2026-06-07T12:48:53.533192+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/reinhrst/abstractcp","github":"https://github.com/reinhrst/abstractcp","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}