powerline-k8s


Namepowerline-k8s JSON
Version 1.5.3 PyPI version JSON
download
home_pagehttps://github.com/j4ckofalltrades/powerline-k8s
SummaryA custom Powerline segment for displaying the current Kubernetes context and namespace
upload_time2024-03-30 16:55:25
maintainerNone
docs_urlNone
authorJordan Duabe
requires_python<4.0,>=3.9
licenseMIT
keywords powerline kubernetes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![powerline-k8s](https://res.cloudinary.com/j4ckofalltrades/image/upload/v1697278938/foss/gh-social-icons/powerline-k8s_arypmi.png)

[![PyPI](https://img.shields.io/pypi/v/powerline-k8s)](https://pypi.org/project/powerline-k8s/)
![PyPI_Python_Version](https://img.shields.io/pypi/pyversions/powerline-k8s)
[![License](https://img.shields.io/pypi/l/powerline-k8s.svg)](https://pypi.python.org/pypi/powerline-k8s)
[![Docs](https://img.shields.io/badge/docs-v1.5.2-green?link=j4ckofalltrades.github.io%2Fpowerline--k8s)](https://j4ckofalltrades.github.io/powerline-k8s)
[![CI](https://github.com/j4ckofalltrades/powerline-k8s/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/j4ckofalltrades/powerline-k8s/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/j4ckofalltrades/powerline-k8s/branch/main/graph/badge.svg?token=J5GLE5ZY2V)](https://codecov.io/gh/j4ckofalltrades/powerline-k8s)

A custom [Powerline](https://github.com/powerline/powerline) segment for displaying the current Kubernetes context and namespace.

![](https://res.cloudinary.com/j4ckofalltrades/image/upload/v1623588713/foss/powerline-k8s_uc0cxj.png)

## Installation

### Using pip

`$ pip install powerline-k8s`

## Configuration

### Colorscheme

Add the following config items to your Powerline colorscheme config file (usually located at `~/.config/powerline/colorschemes/`),
see [Powerline Colorschemes](https://powerline.readthedocs.io/en/master/configuration/reference.html#colorschemes) for more info.

```json
{
  "k8s":           { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
  "k8s_namespace": { "fg": "solarized:red",  "bg": "solarized:base02", "attrs": [] },
  "k8s_context":   { "fg": "solarized:blue", "bg": "solarized:base02", "attrs": [] },
  "k8s:divider":   { "fg": "gray4",          "bg": "solarized:base02", "attrs": [] }
}
```

### Segment

Add the following config item to your Powerline segments config file,
see [Powerline Segment reference](https://powerline.readthedocs.io/en/master/configuration/segments.html#segment-reference) for more info.

```json
{
  "function": "powerline_k8s.k8s",
  "priority": 30
}
```

- If adding the segment to the shell, edit `~/.config/powerline/themes/shell/default.json`.
- If adding the segment to the tmux status line, edit `~/.config/powerline/themes/tmux/default.json`.

### Alternative config location

If your Kubernetes config file is not in the default location `~/.kube/config`, you can point to it by setting
the value of the `$KUBECONFIG` environment variable to where your config file is.

### Toggle visibility

Toggle entire segment or specific section's visibility with the following environment variables:

- `POWERLINE_K8S_SHOW`
- `POWERLINE_K8S_SHOW_NS`

Note: Full segment visibility takes precedence over namespace section visibility.

```shell
# toggle segment visibility
$ POWERLINE_K8S_SHOW=0 powerline-daemon --replace # hide powerline-k8s segment
$ POWERLINE_K8S_SHOW=1 powerline-daemon --replace # show powerline-k8s segment (default)

# toggle namespace section visibility
$ POWERLINE_K8S_SHOW_NS=0 powerline-daemon --replace # hide namespace section
$ POWERLINE_K8S_SHOW_NS=1 powerline-daemon --replace # show namespace section (default)
```

Alternatively you can add the following function to your shell for easier toggling:

```shell
toggle_powerline_k8s() {
  case "$1" in
    # pass the '-ns' flag to toggle namespace visibility
    "-ns" | "--namespace")
      if [[ "${POWERLINE_K8S_SHOW_NS:-1}" -eq 1 ]]; then
        export POWERLINE_K8S_SHOW_NS=0
      else
        export POWERLINE_K8S_SHOW_NS=1
      fi
    ;;
    *)
      # toggle segment visibility
      if [[ "${POWERLINE_K8S_SHOW:-1}" -eq 1 ]]; then
        export POWERLINE_K8S_SHOW=0
      else
        export POWERLINE_K8S_SHOW=1
      fi
    ;;
  esac
}
```

## Demo

[![asciicast](https://asciinema.org/a/424536.svg)](https://asciinema.org/a/424536?autoplay=1&speed=2)


## Stats

![Alt](https://repobeats.axiom.co/api/embed/fbba579306e9c836bd6aa443e43637a0131c45f3.svg "Repobeats analytics image")


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/j4ckofalltrades/powerline-k8s",
    "name": "powerline-k8s",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "powerline, kubernetes",
    "author": "Jordan Duabe",
    "author_email": "me@jduabe.dev",
    "download_url": "https://files.pythonhosted.org/packages/80/57/2b2f3626f625a3b74f15916d90e73fedcccfb3ef92baa15adf2f917fbdd7/powerline_k8s-1.5.3.tar.gz",
    "platform": null,
    "description": "![powerline-k8s](https://res.cloudinary.com/j4ckofalltrades/image/upload/v1697278938/foss/gh-social-icons/powerline-k8s_arypmi.png)\n\n[![PyPI](https://img.shields.io/pypi/v/powerline-k8s)](https://pypi.org/project/powerline-k8s/)\n![PyPI_Python_Version](https://img.shields.io/pypi/pyversions/powerline-k8s)\n[![License](https://img.shields.io/pypi/l/powerline-k8s.svg)](https://pypi.python.org/pypi/powerline-k8s)\n[![Docs](https://img.shields.io/badge/docs-v1.5.2-green?link=j4ckofalltrades.github.io%2Fpowerline--k8s)](https://j4ckofalltrades.github.io/powerline-k8s)\n[![CI](https://github.com/j4ckofalltrades/powerline-k8s/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/j4ckofalltrades/powerline-k8s/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/j4ckofalltrades/powerline-k8s/branch/main/graph/badge.svg?token=J5GLE5ZY2V)](https://codecov.io/gh/j4ckofalltrades/powerline-k8s)\n\nA custom [Powerline](https://github.com/powerline/powerline) segment for displaying the current Kubernetes context and namespace.\n\n![](https://res.cloudinary.com/j4ckofalltrades/image/upload/v1623588713/foss/powerline-k8s_uc0cxj.png)\n\n## Installation\n\n### Using pip\n\n`$ pip install powerline-k8s`\n\n## Configuration\n\n### Colorscheme\n\nAdd the following config items to your Powerline colorscheme config file (usually located at `~/.config/powerline/colorschemes/`),\nsee [Powerline Colorschemes](https://powerline.readthedocs.io/en/master/configuration/reference.html#colorschemes) for more info.\n\n```json\n{\n  \"k8s\":           { \"fg\": \"solarized:blue\", \"bg\": \"solarized:base02\", \"attrs\": [] },\n  \"k8s_namespace\": { \"fg\": \"solarized:red\",  \"bg\": \"solarized:base02\", \"attrs\": [] },\n  \"k8s_context\":   { \"fg\": \"solarized:blue\", \"bg\": \"solarized:base02\", \"attrs\": [] },\n  \"k8s:divider\":   { \"fg\": \"gray4\",          \"bg\": \"solarized:base02\", \"attrs\": [] }\n}\n```\n\n### Segment\n\nAdd the following config item to your Powerline segments config file,\nsee [Powerline Segment reference](https://powerline.readthedocs.io/en/master/configuration/segments.html#segment-reference) for more info.\n\n```json\n{\n  \"function\": \"powerline_k8s.k8s\",\n  \"priority\": 30\n}\n```\n\n- If adding the segment to the shell, edit `~/.config/powerline/themes/shell/default.json`.\n- If adding the segment to the tmux status line, edit `~/.config/powerline/themes/tmux/default.json`.\n\n### Alternative config location\n\nIf your Kubernetes config file is not in the default location `~/.kube/config`, you can point to it by setting\nthe value of the `$KUBECONFIG` environment variable to where your config file is.\n\n### Toggle visibility\n\nToggle entire segment or specific section's visibility with the following environment variables:\n\n- `POWERLINE_K8S_SHOW`\n- `POWERLINE_K8S_SHOW_NS`\n\nNote: Full segment visibility takes precedence over namespace section visibility.\n\n```shell\n# toggle segment visibility\n$ POWERLINE_K8S_SHOW=0 powerline-daemon --replace # hide powerline-k8s segment\n$ POWERLINE_K8S_SHOW=1 powerline-daemon --replace # show powerline-k8s segment (default)\n\n# toggle namespace section visibility\n$ POWERLINE_K8S_SHOW_NS=0 powerline-daemon --replace # hide namespace section\n$ POWERLINE_K8S_SHOW_NS=1 powerline-daemon --replace # show namespace section (default)\n```\n\nAlternatively you can add the following function to your shell for easier toggling:\n\n```shell\ntoggle_powerline_k8s() {\n  case \"$1\" in\n    # pass the '-ns' flag to toggle namespace visibility\n    \"-ns\" | \"--namespace\")\n      if [[ \"${POWERLINE_K8S_SHOW_NS:-1}\" -eq 1 ]]; then\n        export POWERLINE_K8S_SHOW_NS=0\n      else\n        export POWERLINE_K8S_SHOW_NS=1\n      fi\n    ;;\n    *)\n      # toggle segment visibility\n      if [[ \"${POWERLINE_K8S_SHOW:-1}\" -eq 1 ]]; then\n        export POWERLINE_K8S_SHOW=0\n      else\n        export POWERLINE_K8S_SHOW=1\n      fi\n    ;;\n  esac\n}\n```\n\n## Demo\n\n[![asciicast](https://asciinema.org/a/424536.svg)](https://asciinema.org/a/424536?autoplay=1&speed=2)\n\n\n## Stats\n\n![Alt](https://repobeats.axiom.co/api/embed/fbba579306e9c836bd6aa443e43637a0131c45f3.svg \"Repobeats analytics image\")\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A custom Powerline segment for displaying the current Kubernetes context and namespace",
    "version": "1.5.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/j4ckofalltrades/powerline-k8s/issues",
        "Documentation": "https://j4ckofalltrades.github.io/powerline-k8s",
        "Homepage": "https://github.com/j4ckofalltrades/powerline-k8s",
        "Repository": "https://github.com/j4ckofalltrades/powerline-k8s"
    },
    "split_keywords": [
        "powerline",
        " kubernetes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd00d47ff3202fd9848517503eb1427f04a68d94ec7885a9699019b12d4dc9f4",
                "md5": "d8b4659a512116c939adf09eb9814536",
                "sha256": "f28f900468012fcf8483079f1559d2ee62c761394f839197b0a7c4eb602586af"
            },
            "downloads": -1,
            "filename": "powerline_k8s-1.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8b4659a512116c939adf09eb9814536",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4910,
            "upload_time": "2024-03-30T16:55:24",
            "upload_time_iso_8601": "2024-03-30T16:55:24.095461Z",
            "url": "https://files.pythonhosted.org/packages/dd/00/d47ff3202fd9848517503eb1427f04a68d94ec7885a9699019b12d4dc9f4/powerline_k8s-1.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80572b2f3626f625a3b74f15916d90e73fedcccfb3ef92baa15adf2f917fbdd7",
                "md5": "013595fa5c2008f66bdbe1e9f1864d6c",
                "sha256": "d9a40424807422e6e45e0df1c971ec6306aa283055a8dc676f88f976e0c6f2b3"
            },
            "downloads": -1,
            "filename": "powerline_k8s-1.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "013595fa5c2008f66bdbe1e9f1864d6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4554,
            "upload_time": "2024-03-30T16:55:25",
            "upload_time_iso_8601": "2024-03-30T16:55:25.680875Z",
            "url": "https://files.pythonhosted.org/packages/80/57/2b2f3626f625a3b74f15916d90e73fedcccfb3ef92baa15adf2f917fbdd7/powerline_k8s-1.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-30 16:55:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "j4ckofalltrades",
    "github_project": "powerline-k8s",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "powerline-k8s"
}
        
Elapsed time: 1.38004s