{"id":24209,"library":"passagemath-objects","title":"passagemath-objects","description":"Core library for mathematical object infrastructure in the passagemath ecosystem. Provides base classes for Sage-like elements, parents, categories, coercion framework, and metaclasses. Part of the passagemath distribution (successor to SageMath components). Current version 10.8.4, supports Python 3.11-3.14. Released as part of passagemath v10.8.x series.","status":"active","version":"10.8.4","language":"python","source_language":"en","source_url":"https://github.com/passagemath/passagemath-objects","tags":["passagemath","sage","mathematics","category-theory","coercion","parent-element","algebraic-structures"],"install":[{"cmd":"pip install passagemath-objects","lang":"bash","label":"pip install"},{"cmd":"pip install passagemath[objects]","lang":"bash","label":"pip install (via metapackage)"}],"dependencies":[{"reason":"Configuration and global settings for passagemath","package":"passagemath-conf","optional":false},{"reason":"PARI/GP integration for number theory objects","package":"cypari2","optional":true},{"reason":"Efficient memory allocation for large objects","package":"memory_allocator","optional":true}],"imports":[{"note":"The import path changed from sage.* to passagemath.*; using sage.* triggers ModuleNotFoundError","wrong":"from sage.structure.parent import Parent","symbol":"Parent","correct":"from passagemath.objects.parent import Parent"},{"note":"Same namespace migration as Parent","wrong":"from sage.structure.element import Element","symbol":"Element","correct":"from passagemath.objects.element import Element"},{"note":"Categories are now under passagemath.objects","wrong":"from sage.categories.category import Category","symbol":"Category","correct":"from passagemath.objects.category import Category"},{"note":"No common wrong import; previously in sage.structure.coerce","wrong":null,"symbol":"CoercionModel","correct":"from passagemath.objects.coerce import CoercionModel"}],"quickstart":{"code":"from passagemath.objects.parent import Parent\nfrom passagemath.objects.element import Element\nfrom passagemath.objects.category import Category\n\nclass MyParent(Parent):\n    def __init__(self):\n        super().__init__(category=Category())\n\np = MyParent()\nprint(isinstance(p, Parent))  # True","lang":"python","description":"Create a custom parent class with category support using passagemath-objects."},"warnings":[{"fix":"Replace sage structure imports with passagemath.objects.*","message":"All import paths changed from sage.* to passagemath.*. Code written for SageMath will not work.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Replace `CategoryInfinite()` with `Category(is_finite=False)`","message":"The class `CategoryInfinite` is deprecated; use `Category` with appropriate finiteness parameter.","severity":"deprecated","affected_versions":"10.8.0-10.8.4"},{"fix":"Call `CoercionModel()._init_coercion()` after creation or use `from passagemath.objects.parent import Parent` which sets it up automatically.","message":"Coercion model initialization requires explicit setup; default model raises ValueError if used directly without configuration.","severity":"gotcha","affected_versions":">=10.0"},{"fix":"Use `gc.collect()` after cycles or call `Element._reset_cache()` periodically.","message":"Memory leaks may occur if elements are not properly garbage collected due to reference cycles in coercion caches.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change imports to passagemath.objects.*, e.g., 'from passagemath.objects.parent import Parent'","cause":"Code imports from old SageMath namespace (sage.structure) which is not present in passagemath.","error":"ModuleNotFoundError: No module named 'sage'"},{"fix":"Use 'Category(is_finite=False)' instead of CategoryInfinite.","cause":"CategoryInfinite was removed or renamed in recent versions.","error":"ImportError: cannot import name 'CategoryInfinite' from 'passagemath.objects.category'"},{"fix":"Ensure you create a Parent instance first (which initializes coercion) or call CoercionModel()._init_coercion().","cause":"Attempting to use coercion without setting up the global coercion model.","error":"ValueError: coercion model has not been initialized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}