{"id":1426,"library":"codeowners","title":"Codeowners Parser","description":"A Python library for parsing and working with CODEOWNERS files, typically used in Git repositories to define ownership for different parts of the codebase. It provides methods to identify the owners of specific file paths based on the rules defined in a CODEOWNERS file. The current version is 0.8.0. Releases are infrequent, usually for minor bug fixes or small feature additions.","status":"active","version":"0.8.0","language":"python","source_language":"en","source_url":"https://github.com/sbdchd/codeowners","tags":["codeowners","parser","git","ownership"],"install":[{"cmd":"pip install codeowners","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from codeowners import Codeowners","symbol":"CodeOwners","correct":"from codeowners import CodeOwners"}],"quickstart":{"code":"from codeowners import Codeowners\n\n# Create a dummy CODEOWNERS file for demonstration\nwith open('.github/CODEOWNERS', 'w') as f:\n    f.write(\"*.py @python-devs\\n/src/docs/* @docs-team\\n/src/app/core/ @core-maintainers\")\n\n# Initialize the parser with the path to the CODEOWNERS file\n# Note: The library searches default paths if not explicitly given, \n# but providing the path is best practice.\nco = Codeowners('.github/CODEOWNERS')\n\n# Get owners for a specific file path\nowners_py = co.of('src/app/utils.py')\nprint(f\"Owners for src/app/utils.py: {owners_py}\")\n\nowners_doc = co.of('src/docs/guide.md')\nprint(f\"Owners for src/docs/guide.md: {owners_doc}\")\n\nowners_core = co.of('src/app/core/models.py')\nprint(f\"Owners for src/app/core/models.py: {owners_core}\")\n\n# Clean up the dummy file\nimport os\nos.remove('.github/CODEOWNERS')\n","lang":"python","description":"This quickstart demonstrates how to initialize the `Codeowners` parser and retrieve the owners for specific file paths. It creates a temporary CODEOWNERS file to illustrate usage."},"warnings":[{"fix":"Applications importing `Codeowners` will encounter an `ImportError`. To migrate, use the new parsing functions available under `codeowners.parser`. If the high-level `Codeowners` object is required, pin the library version to `<0.2.0`.","message":"Version 0.2.0 introduced a significant API-breaking change. The main `Codeowners` class was removed and is no longer importable. The library shifted its focus to providing lower-level parsing functions.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"To avoid ambiguity and ensure the correct file is parsed, always explicitly provide the path to your CODEOWNERS file, e.g., `Codeowners('path/to/your/CODEOWNERS')`.","message":"The `Codeowners` constructor searches for CODEOWNERS files in specific default locations (`.github/CODEOWNERS`, `CODEOWNERS` in root, `docs/CODEOWNERS`) if no explicit path is provided.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your CODEOWNERS file is ordered correctly according to your desired ownership hierarchy. If results are unexpected, verify the precedence rules defined in the CODEOWNERS specification.","message":"The library strictly follows the CODEOWNERS specification's rule that the last matching pattern in the file takes precedence.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you use the correct capitalization when importing the main class: `from codeowners import CodeOwners`.","message":"The main class provided by the `codeowners` library is `CodeOwners` (with an uppercase 'O'), not `Codeowners` (lowercase 'o'). Attempting to import `Codeowners` will result in an `ImportError`.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.8.0':51 'addit':63 'base':38 'bug':58 'codebas':26 'codeown':1,11,45,64 'current':48 'defin':19,42 'differ':22 'featur':62 'file':12,36,46 'fix':59 'git':16,66 'identifi':31 'infrequ':54 'librari':5 'method':29 'minor':57 'owner':33 'ownership':20,67 'pars':7 'parser':2,65 'part':23 'path':37 'provid':28 'python':4 'releas':52 'repositori':17 'rule':41 'small':61 'specif':35 'typic':13 'use':14 'usual':55 'version':49 'work':9","created_at":"2026-04-09T03:47:26.294372+00:00","updated_at":"2026-04-16T02:58:17.644308+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.9.0","cli_name":"codeowners","cli_version":"sh: 1: codeowners: not found","type":"library","homepage":null,"github":"https://github.com/sbdchd/codeowners","docs":null,"changelog":null,"pypi":"https://pypi.org/project/codeowners/","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-06-30","last_verified":"2026-08-27","next_check":"2026-07-30","install_tag":"stale"}}