Skip to main content

Codeowners parser and CLI for Python

Project description

codeowners-cli

Python codeowners parser with a CLI — look up file owners from your CODEOWNERS file.

This is a fork of sbdchd/codeowners, which is a Python port of hmarr's Go library and softprops's Rust crate. This fork adds a codeowners-cli entry point installable via uvx, and modernizes the project tooling to use uv, ruff, and ty.

Install

# Run once with uvx
uvx codeowners-cli <filenames>

# Or install persistently
uv tool install codeowners-cli

CLI Usage

# Auto-detects CODEOWNERS in the current git repo
codeowners-cli src/foo.py tests/bar.py

# Explicit path
codeowners-cli --codeowners .github/CODEOWNERS src/foo.py

# Only show files that have owners
codeowners-cli --only-owners src/foo.py src/bar.py

# Structured output
codeowners-cli --output json src/foo.py
codeowners-cli --output csv  src/foo.py
codeowners-cli --output tsv  src/foo.py

# Omit header row
codeowners-cli --no-header src/foo.py

Default text output:

filename        owners
src/foo.py      @alice @team/backend
src/bar.py      user@example.com

Library Usage

from codeowners import CodeOwners

owners = CodeOwners(open("CODEOWNERS").read())
print(owners.of("src/foo.py"))
# [('USERNAME', '@alice'), ('TEAM', '@team/backend')]

Development

uv sync

# Run tests
uv run pytest

# Lint
uv run ruff check .

# Format
uv run ruff format .

# Type check
uv run ty check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeowners_cli-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeowners_cli-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file codeowners_cli-0.1.0.tar.gz.

File metadata

  • Download URL: codeowners_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codeowners_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 371c40b5240f53af6d672389e075a29f6fe7d34b3f23d51bdb13dd34cce03645
MD5 cfd0ca9be67d230073259335b768f05f
BLAKE2b-256 9776acc8f36a5c20e6add347deb10b6df6672a64434389b015d5af94c969d41c

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeowners_cli-0.1.0.tar.gz:

Publisher: publish.yml on blackary/codeowners

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeowners_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: codeowners_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codeowners_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f61b5980a353315691f8ded3446727ab4a85d7bca500b8022c5389106c19b07a
MD5 729c7d2f833f2162da2b7ec117433635
BLAKE2b-256 3534ec7e0c64d704d771de31dff8ea3f0284bbbae61180006aa7ffb96cf4b185

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeowners_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on blackary/codeowners

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page