Skip to main content

A Python wrapper for the Obsidian CLI

Project description

obsidian-cli-py

PyPI version Obsidian CLI Docs

obsidian-cli-py is an unofficial, easy-to-use Python bridge for the new Obsidian CLI.

It allows you to programmatically interact with your Obsidian vaults, create notes, search your knowledge base, and much more, straight from Python!

Features

  • 🚀 Simple and Intuitive API: Pythonic wrappers around obsidian terminal commands.
  • 📦 Lightweight: Uses standard Python subprocess to communicate with the CLI.
  • 📝 Fully Typed: Includes type hints for an excellent IDE experience (autocomplete, type checking).
  • 📖 In-Editor Documentation: The official Obsidian CLI documentation has been integrated directly into the docstrings. You'll see all function explanations right in your IDE without needing to open the browser!

Installation

pip install obsidian-cli-py

Note: This library requires the official Obsidian CLI to be installed and enabled in your Obsidian app (requires Obsidian v1.12.4+). Check the official docs for troubleshooting and setup instructions.

Documentation

Currently, this library does not maintain its own separate web documentation.

Because every function in this library corresponds 1:1 to the official CLI commands, you can simply rely on the official Obsidian CLI documentation. Operations like obsidian search become client.search(), obsidian base:create becomes client.base_create(), and so on.

Quick Start

from obsidian_cli import ObsidianClient

# Initialize the client. Optionally specify a vault name.
client = ObsidianClient(vault="My Vault")

# Create a new note and open it in Obsidian
client.create(name="My First programmatic note", content="# Hello World\n\nThis was created via Python!", open=True, overwrite=True)

# Read the contents of a note
content = client.read(file="My First programmatic note")
print(content)

# Search your vault
results = client.search(query="Python")
print(results)

Available Commands

The wrapper aims to support all Obsidian CLI commands except developer commands.

Additional Commands

  • Run arbitrary/plugin commands: You can run commands registered by third-party plugins (like QuickAdd) using the generic execution method:
    client.execute(command="quickadd", choice="My Choice")
    

How it works

The Python library simply translates your method calls into the corresponding terminal CLI syntax. Pretty self-explanatory 🐐.

For example:

client.create(name="Note", content="Hello", open=True)

Translates to the shell command:

obsidian vault="My Vault" create name="Note" content="Hello" open

Contributing

Contributions are welcome! If a command is missing or something needs fixing, feel free to submit a Pull Request.

  1. Clone the repository.
  2. Run poetry install (or your preferred environment manager).
  3. Run tests with pytest.

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

obsidian_cli_py-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

obsidian_cli_py-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file obsidian_cli_py-0.1.0.tar.gz.

File metadata

  • Download URL: obsidian_cli_py-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Windows/11

File hashes

Hashes for obsidian_cli_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3cb21398ebb1d2581503446055c7ef85f973bd2b5d487f931bfb96c6fb52d374
MD5 87d4272ebd7a1f2f0c8712c63e2bd3d4
BLAKE2b-256 985c67ff202b2961df94e79627d51183a31da95e5960cd03db0ac36bbe63a5c5

See more details on using hashes here.

File details

Details for the file obsidian_cli_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: obsidian_cli_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Windows/11

File hashes

Hashes for obsidian_cli_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8eb0f444eebde3a15586284992106f612a49e5d33fe1252f8e338dbd91374e
MD5 260c94c4cb6ce823b1f258d143131814
BLAKE2b-256 46cbbbdb8d0f2876ac8446d0d36c24394fc1d40137841da8a3179e480813d231

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