Skip to main content

Python package for classifying kubectl commands as modifying or non-modifying

Project description

Kubectl Infra Classifier

Classifies if a kubectl command modifies infrastructure (yes/no).

Features

  • Detects if a kubectl command is modifying ("yes") or non-modifying ("no")
  • Handles real-world, piped, and complex kubectl command scenarios
  • Designed for extensibility and production use

Installation

pip install .
# or with build isolation
pip install --use-pep517 .

Usage

As a Python package

from kube_classify.utils import load_model
model = load_model("models/kubectl_classifier.joblib")
result = model.predict(["kubectl apply -f deployment.yaml"])
print("yes" if result[0] == 1 else "no")

Training

Train a new model with your dataset:

make train

Makefile Commands

  • make install — Install the package in editable mode for development
  • make train — Train the model (ensures correct PYTHONPATH)
  • make test — Run the test suite
  • make lint — Lint the codebase with flake8
  • make clean — Remove model artifacts and cache files

Project Structure

  • src/kube_classify/ — Main package code
  • data/ — Training data
  • models/ — Saved models
  • tests/ — Test suite

License

MIT

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

kube_classify-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

kube_classify-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kube_classify-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for kube_classify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5e0a8a5cd8a19ecb656e5e37f3aba7f25ded8b5666dc8b55c34aa6987097027
MD5 9449ccdb70a5d66c587772267cf58aee
BLAKE2b-256 8eb0fde8e123312556bd7c3cd37b534e41c25ab86f72f06e5b2f8335ddf5bf94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kube_classify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for kube_classify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 506fe4664cf30006f8ffda77f2cf7cdd67e137eda06ec05b2c20b482a58c1d55
MD5 4c56968cccfdba327ace4e83034df0b1
BLAKE2b-256 42e22ff5a7b0092bc30613960724e7b42794c920a81db9c062f77481cd2d8867

See more details on using hashes here.

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