Skip to main content

🐻 bearkit

The Python toolkit for Bear notes - read, search, and write your notes from Python, with secret detection built in.

PyPI License: MIT Python 3.13+ macOS

API reference · Website · bearcli (the CLI & terminal UI built on it)


Install

pip install bearkit            # or: uv add bearkit

Lightweight by design: no CLI or UI dependencies, just the fundamentals.

Quick start

One object, Bear, for everything:

from bearkit import Bear

with Bear() as bear:
    for note in bear.list_notes(tag="work", limit=10):
        print(note.title, note.tags)

Read and search

Filter by tag (nested sub-tags included), dates, or status; search naively or fuzzily, scoped to tags and widened to archived or trashed notes:

from bearkit import Bear

with Bear() as bear:
    pinned = bear.list_notes(only="pinned")
    note = bear.get_note("C44D09DC")  # a unique 4+ char id prefix works

    for result in bear.search("quarterly planing", fuzzy=True)[:5]:
        print(f"{result.score:5.1f}  {result.note.title}")
    for result in bear.search("invoice", tag=["work", "clients"], include_archived=True):
        print(result.note.title, result.snippet)

Verified writes

Writes go through the Bear app itself and are verified before returning - you get the fresh note back, or BearWriteError if Bear didn't apply the change:

from bearkit import Bear, BearWriteError

with Bear() as bear:
    try:
        note = bear.create_note("Meeting notes", text="agenda...", tags=["work"])
        bear.add_tag(note, "from-python")
    except BearWriteError:
        print("Bear did not apply the change")

Also: add_text (append/prepend/replace), rename, attach_file, trash, archive, rename_tag, delete_tag, and open to bring a note up in Bear.

Secret detection

Scan notes for leaked credentials (token formats, key blocks, credential assignments, high-entropy strings) - fully offline - and redact before sharing:

from bearkit import Bear

with Bear() as bear:
    notes = bear.list_notes(limit=None, include_archived=True)
    report = bear.scan_secrets(notes)
    for finding in report:
        print(finding.note_title, finding.rule, finding.excerpt)  # excerpt is safe to print
    for note in notes:
        if report.has(note.id):
            safe = report.redact(note)  # text with [redacted: <rule>] placeholders

⚠️ Warning - detection is best-effort: a secret that reads like ordinary prose will not be caught. Ideally, don't keep secrets in notes at all.

Good to know

  • Typed - ships py.typed; the full API is annotated.
  • Encrypted notes are listed with their metadata, but their content stays in Bear (note.text is None).
  • Every public function has a runnable sample in the API reference.
  • Want a ready-made tool instead of a library? bearkit powers bearcli - the CLI and full terminal UI, including markdown export and git mirroring.

License

MIT · not affiliated with Shiny Frog

Download files

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

Source Distribution

bearkit-1.6.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

bearkit-1.6.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file bearkit-1.6.1.tar.gz.

File metadata

  • Download URL: bearkit-1.6.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bearkit-1.6.1.tar.gz
Algorithm Hash digest
SHA256 98e7d8e8d48020e7fdc1fbf947e7ed23cd8bc99889106cf78f1c7bfdb56d0898
MD5 ef2461307ed0b49fd010e0c2315da459
BLAKE2b-256 ca397f90cec72454fe55d13be3c412d7b811c62f3ce124d148d40a3cbf225284

See more details on using hashes here.

File details

Details for the file bearkit-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: bearkit-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bearkit-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1330ea9b5de90f7e84ee811d97aad3a1691b2ff9eee70cbc6672d2d1cca852e4
MD5 3aa2d1bf6709f6a5bcacd1e4b2f0e627
BLAKE2b-256 6c836a3769610d6236f04656d6ad9dfc0a2c847cd6463970e9008235c614274e

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