Skip to main content

A Python library to parse codeowner files

Project description

codeowners CircleCI pypi

Python bindings to softprops's Rust codeowners library.

Why?

To allow Python users to parse codeowners files without having to rewrite an existing implementation.

Install

poetry add 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')]

Dev

poetry install

cargo test --no-default-features

# trying a build in Python
./.venv/bin/pyo3-pack develop
./.venv/bin/python -c "import codeowners; print(codeowners.CodeOwners)"

Releasing a New Version

# bump version in Cargo.toml

# build the macos version
./.venv/bin/pyo3-pack build --release

# build the linux versions
# Note: this is just the version for the builder container
TAG="sbdchd/codeowners-builder:0.1.2"
docker build -f build.Dockerfile . --tag "$TAG"

# Note: building the Python versions can take a while if you are running Docker inside a VM
docker run --rm -v $(pwd):/io "$TAG" build --release

# upload wheels to PyPi
# Note: this will prompt for PyPi creds
./.venv/bin/twine upload --skip-existing target/wheels/*

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

codeowners-0.1.4-cp38-cp38-manylinux1_x86_64.whl (4.2 MB view hashes)

Uploaded CPython 3.8

codeowners-0.1.4-cp37-cp37m-manylinux1_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.7m

codeowners-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl (499.9 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

codeowners-0.1.4-cp36-cp36m-manylinux1_x86_64.whl (2.1 MB view hashes)

Uploaded CPython 3.6m

codeowners-0.1.4-cp35-cp35m-manylinux1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.5m

Supported by

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