Skip to main content

A Python wrapper for the Obsidian CLI

Project description

obsidian-cli-py

PyPI version Python versions 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.1.tar.gz (9.2 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.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: obsidian_cli_py-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 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.1.tar.gz
Algorithm Hash digest
SHA256 09a9e60a5b6a094a10ba7c6500f7659fd22fba9edd8c3e40afda046c1c8d0ff6
MD5 dffd9add892143d08fe3a22a2233297c
BLAKE2b-256 911b6f0c52ce9e620183365d6147b48c1a29c6363a4fd72bf08f68a3e9f62611

See more details on using hashes here.

File details

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

File metadata

  • Download URL: obsidian_cli_py-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4b40b7a1d71aa1fe7bed5cfa5856c3f5e5bda2a8a356313d81cdc852fb08ce3
MD5 7b2111dce675e2c40b9116351b6f2563
BLAKE2b-256 5c162036aa22ecf10b4221c7fabd0b244dd6ea70740ad831f65a8656e8913942

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