Skip to main content

An unofficial, easy-to-use python bridge/wrapper for the new Obsidian CLI.

Project description

py-wrapper-for-obsidian-cli

PyPI version Python versions Obsidian CLI Docs

py-wrapper-for-obsidian-cli 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 wrapper-for-obsidian-cli

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_wrapper 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

wrapper_for_obsidian_cli-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

wrapper_for_obsidian_cli-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wrapper_for_obsidian_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 663109a1284cb053a09e47f54e61195d1875122fde0c0f9ecafc5fd31dd7378a
MD5 a89b9e87a80d9253531b261bfd3897ff
BLAKE2b-256 b301416c682cc077495b397b6619629f250bf53a723698007204b135f5a64ac2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrapper_for_obsidian_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e80d92333193022de46ddd157a8724d240b1d91d2f9402683b496cc430407549
MD5 b760cefd8f9033d8c7e69b2dd8c5094e
BLAKE2b-256 0657fbaa45724290e4298045e01077cc68de93588a4f5d4f8e4e18fab88ad525

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