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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearkit-1.7.5.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.5.tar.gz
Algorithm Hash digest
SHA256 56625fbaa335444cb40b47c844f47c6c844ed09472e0dcf4aa192ec4adad1a5d
MD5 a8884a0d5a0ffd738ca1c8db1546581b
BLAKE2b-256 bd1f4b0dba29c904b0a79ffc88f68ebaa7990729680f075c5ea61b3a92915959

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearkit-1.7.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b76505efc02e82d314f3f7fb74d44024bbd63dc90e4ebafb32ff445791ce105a
MD5 152cdfc8279d403df0a651d873884154
BLAKE2b-256 fd4a244aea48672b43e65af2c0a69bbabd9e418faa39e4e1edef1ecce2526951

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