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.7.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.7.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearkit-1.7.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.7.1.tar.gz
Algorithm Hash digest
SHA256 fff7a5013a2892fd35544fa1538da29382f2313d96d6f0db8f9eaacc71db3ad9
MD5 6a7a4c61d2270f18f27d32618e37d223
BLAKE2b-256 73505ad4cea2447261d377967ac533299259230ca3813e31d48c5dbbeec768c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearkit-1.7.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.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24fb892e0e788327ce0751425c49c8d4bf5b4706d48660a1c9c3b64203994972
MD5 0d277b320b3aa3b2819707f26538f2e7
BLAKE2b-256 f7d8d4bac5a63f3f74f3c85872870e2d6427d773788e9aecc97f2c2ce277f552

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