Skip to main content

CLI utilities for Obsidian vault notes: initialize note bases, search markdown files, and read note content or sections.

Project description

notekey

CLI utilities for working with Markdown notes in an Obsidian vault.

notekey can:

  • initialize a folder with an Obsidian .base file and a matching Markdown note
  • search vault notes by tag, filename, or content
  • read a single note, discover its headings, or read a specific heading section

Requirements

  • Python 3.11+
  • An Obsidian vault directory containing a .obsidian/ folder

Installation

After the package is published to PyPI:

pip install notekey

Usage

notekey init [path]
notekey search [path] [--tags TAGS] [--filename NAME] [--content TEXT]
notekey read FILENAME [--sections | --section SECTION] [--json]

For init, omitting path uses the current directory.

For search and read, omitting path uses the OBSIDIAN_VAULT environment variable. If that variable is not set, it uses the current directory.

export OBSIDIAN_VAULT="/path/to/your/vault"

Initialize a note folder

cd /path/to/vault/Projects/MyProject
notekey init

Or pass the target folder explicitly:

notekey init /path/to/vault/Projects/MyProject

This creates:

  • MyProject.base
  • MyProject.md

Add extra base filters with comma-separated tags:

notekey init /path/to/vault/Projects/MyProject --tags python,docs

Overwrite existing generated files with:

notekey init /path/to/vault/Projects/MyProject --force

Search notes

Search by tag:

notekey search --tags python

Search by multiple tags. Files must match all tags:

notekey search --tags python,web

Search by filename:

notekey search --filename flask

Search by content:

notekey search --content pandas

Use = for exact matches:

notekey search --tags "=python"
notekey search --filename "=deep/hidden-note"

Read a note or section

notekey read flask-app

For an exact filename match:

notekey read "=flask-app"

List the headings in a note before choosing a section:

notekey read flask-app --sections

Example output:

flask-app.md

  1  # Flask App
  2  ## Setup
  3  ## Open Questions
  4  ### API Shape

Read a section by its 1-based outline number:

notekey read flask-app --section 3

Read a section by a case-insensitive title substring:

notekey read flask-app --section api

Section reads include the selected heading and its nested child headings, stopping at the next heading of the same or higher level. If a title search matches multiple headings, notekey prints the matching outline entries so you can retry with a number or a more specific title.

For exact section title matching, prefix the section query with =:

notekey read flask-app --section "=API Shape"

Section discovery and section reads can return JSON:

notekey read flask-app --sections --json
notekey read flask-app --section 4 --json

Development

Run tests with:

pytest

Build distribution files with:

python -m build

Upload is intentionally manual. Use TestPyPI or PyPI with your API token when ready.

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

notekey-0.5.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

notekey-0.5.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file notekey-0.5.0.tar.gz.

File metadata

  • Download URL: notekey-0.5.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for notekey-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9ad16b95272fcd0e548c7f1a59b3f474824f59e62574ea44546d31dd30e9d60f
MD5 707cbc36bc224208c36bf121f930f3fe
BLAKE2b-256 708bd4ffbd669f088c3d8d6ecaec7585cb24afa331cd3256ad8b07f12f72b1b1

See more details on using hashes here.

File details

Details for the file notekey-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: notekey-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for notekey-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb6e053595406ef97a2b603aa9a4fbdcce9645f4b40452af3406b5f022b15d3
MD5 2de0bc3843b97d17deb51d3dec65fe2d
BLAKE2b-256 28f86d6e160eaec7fd964c4e566ab4bff6df26ea26e602306ac568aaf62804a7

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