{"id":24017,"library":"matrix-common","title":"Matrix Common","description":"Common utilities shared by Synapse, Sydent, and Sygnal. Provides helpers for version strings, regex patterns, MXC URIs, and more. Current version 1.3.0 supports Python >=3.7. Released as needed by Matrix.org services.","status":"active","version":"1.3.0","language":"python","source_language":"en","source_url":"https://github.com/matrix-org/matrix-python-common","tags":["matrix","utilities","synapse","sydent","sygnal"],"install":[{"cmd":"pip install matrix-common","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Used for class definitions (e.g., MXCUri)","package":"attrs","optional":false}],"imports":[{"note":"MXCUri is in matrix_common.url, not top-level","wrong":"from matrix_common import MXCUri","symbol":"MXCUri","correct":"from matrix_common.url import MXCUri"},{"note":"glob_to_regex is in matrix_common.regex","wrong":"from matrix_common import glob_to_regex","symbol":"glob_to_regex","correct":"from matrix_common.regex import glob_to_regex"},{"note":"get_version_string is in matrix_common.versionstring","wrong":"from matrix_common import get_version_string","symbol":"get_version_string","correct":"from matrix_common.versionstring import get_version_string"}],"quickstart":{"code":"from matrix_common.url import MXCUri\nfrom matrix_common.regex import glob_to_regex\nfrom matrix_common.versionstring import get_version_string\n\n# Parse an MXC URI\nuri = MXCUri.from_string(\"mxc://example.com/abc123\")\nprint(f\"Server: {uri.server}, Media ID: {uri.media_id}\")\n\n# Convert glob to regex\npattern = glob_to_regex(\"*.txt\")\nprint(f\"Regex: {pattern}\")\n\n# Get version string from module\nversion = get_version_string()\nprint(f\"Version: {version}\")","lang":"python","description":"Basic usage of key utilities"},"warnings":[{"fix":"Use absolute imports from matrix_common (e.g., from matrix_common.url import MXCUri).","message":"Version 1.2.0 moved to src layout. Imports that relied on direct access to submodules may break if not using the new package structure.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Upgrade to Python 3.7 or later.","message":"Python 3.6 support dropped in v1.3.0. Code running on Python 3.6 will fail to install or import.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"If using a custom working directory, pass the cwd argument explicitly.","message":"get_version_string now optionally accepts a cwd parameter (since v1.2.0). If calling without cwd, ensure the version file is discoverable from the package root.","severity":"gotcha","affected_versions":">=1.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install matrix-common' in the correct environment.","cause":"Package not installed or installed in a different Python environment.","error":"ModuleNotFoundError: No module named 'matrix_common'"},{"fix":"Use 'from matrix_common.url import MXCUri'.","cause":"Trying to import MXCUri from the top-level package instead of matrix_common.url.","error":"ImportError: cannot import name 'MXCUri' from 'matrix_common'"},{"fix":"Import explicitly: 'from matrix_common.regex import glob_to_regex'.","cause":"Trying to access submodule via dot notation (e.g., matrix_common.regex) without importing it first.","error":"AttributeError: module 'matrix_common' has no attribute 'regex'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}