Skip to main content

Kokomikke

Kokomikke (koh•koh•mi•ke) is a Python library that looks up GitHub access tokens from various sources.

Installation

pip install kokomikke

Usage

Basic usage is as simple as:

import kokomikke

token = kokomikke.search()

By default, this will look for a GitHub token in the following locations, in order, returning as soon as one is found:

  1. The GITHUB_API_TOKEN environment variable
  2. The GITHUB_TOKEN environment variable
  3. The GH_TOKEN environment variable
  4. The GITHUB_PAT environment variable
  5. The GH_PAT environment variable
  6. GitHub CLI via gh auth token
  7. GitHub CLI via hosts.yml

If no token is found, kokomikke.search() will return None.

Sources

In order to search for token, Kokomikke needs sources. A source is an object of a class that inherits from kokomikke.sources.Source and implements the lookup() method:

from kokomikke.sources import Source

class MySource(Source):
    def lookup(self) -> str | None:
        # lookup logic goes here

Kokomikke comes with the following sources built-in:

kokomikke.sources.EnvironmentVariableSource

Searches a list of environment variables, in order, for a non-empty value.

It takes the following arguments:

  • variables (list[str], keyword-only, default: [GITHUB_API_TOKEN, GITHUB_TOKEN, GH_TOKEN, GITHUB_PAT, GH_PAT]): The variables to search.

kokomikke.sources.GitHubCLISource

Runs gh auth token and, if there is no error, returns its output.

It takes the following arguments:

  • hostname (str, keyword-only, default: github.com): The hostname of the GitHub instance to get a token for.

kokomikke.sources.GitHubCLIYamlSource

Reads GitHub CLI's hosts.yml file and returns a token if one is present.

It takes the following arguments:

  • hostname (str, keyword-only, default: github.com): The hostname of the GitHub instance to get a token for.

kokomikke.sources.GitSource

Calls git credential fill and returns a token if one is present in the output.

It takes the following arguments:

  • hostname (str, keyword-only, default: github.com): The hostname of the GitHub instance to get a token for.

kokomikke.sources.CommandSource

Runs an arbitrary command and, if there is no error, returns its output.

It takes the folowing arguments:

  • command: (list, keyword-only): Command arguments.

kokomikke.search() takes an optional sources argument, which expects a list of sources, each of which will be evaluated in order. For example, to first look for a token via gh auth token, but fall back to pass if that fails:

import kokomikke
from kokomikke.sources import CommandSource, GitHubCLISource

pass_source = CommandSource(command=["pass", "github.com/mona"])

token = kokomikke.search([GitHubCLISource, pass_source])

Metadata

Release files for kokomikke 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kokomikke 0.1.4
File Size Uploaded
kokomikke-0.1.4.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kokomikke 0.1.4
File Interpreter ABI Platform
kokomikke-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / kokomikke-0.1.4.tar.gz

Download URL kokomikke-0.1.4.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8131acfe6259aac10e343d3adb5a5b5debc1caa013c2b93385eeebeefaf2ea11
BLAKE2b-256 checksum
How to use checksums
4c33f8b7ea7cc90d1212b2ffc6dba9b0a4cbd42b0e4c582571ce08821af4307b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / kokomikke-0.1.4-py3-none-any.whl

Download URL kokomikke-0.1.4-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8850feb49e6509a485068f651927a0a365af96f5159ee70daa37213904e5708
BLAKE2b-256 checksum
How to use checksums
c32e3d62491c7fbbaf9ee6cf27bb45f3fdaeef2f9c991228f7ef9801a8e3a03d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page