Skip to main content

Python toolkit for the Bear notes app - read, search, secret detection, and verified writes

Project description

🐻 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

Project details


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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bearkit-1.7.6.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.6.tar.gz
Algorithm Hash digest
SHA256 a15d58c678b3f6d4dd1f05f54d602969870f96f2e2b16b6e16d343b0abef9ffd
MD5 ae459980674de806c1c4e80d116e7d01
BLAKE2b-256 89cff3e0626af303d682f6c30ead94a05b9e08622da98a70c6c645ec083257cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bearkit-1.7.6-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2bde4ab287bbc43a89537384c4135a83b56963f0228d403cc53bb0ff402cddde
MD5 bd4b02eaa296e7a9192876b1872dcc49
BLAKE2b-256 f06e7264759adae847bf5e48585d8047284dc15491ab322e5947bbb608145f38

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