Skip to content

sbdchd/codeowners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codeowners CI pypi

Python codeowners parser based on softprops's Rust library and hmarr's Go library.

Why?

To allow Python users to parse codeowners files in Python.

Install

pip install codeowners

Usage

from codeowners import CodeOwners

example_file = """\
# owners for js files
*.js    @ghost
# python
*.py user@example.com
# misc
/build/logs/ @dmin
docs/*  docs@example.com
"""

owners = CodeOwners(example_file)
assert owners.of("test.js") ==  [('USERNAME', '@ghost')]

Path format

Paths must be repo-relative with no leading slash, matching git check-ignore. A leading slash will not match:

owners = CodeOwners("/build/logs/log.txt @ghost")
assert owners.of("build/logs/log.txt") == [('USERNAME', '@ghost')]  # ✅
assert owners.of("/build/logs/log.txt") == []                       # ✗ leading slash

Dev

uv sync

s/test

s/lint

Releasing a New Version

# bump version in pyproject.toml

# update CHANGELOG.md

# commit release commit to GitHub

Then create a release in the GitHub UI. The Publish workflow builds the package and uploads it to PyPI via trusted publishing (OIDC, no API token).

About

🐝 A Python library for codeowners files

Topics

Resources

License

Stars

Watchers

Forks

Contributors