Skip to main content

Library for Managing your Obsidian Vault

Project description

OVault

A python library for accessing and editing your Obsidian vault.

Check out the examples!

Install

pip install ovault

or locally

git pull https://github.com/BalderHolst/ovault
cd ovault
pip install .

Example

import ovault

 # Open a vault at a given path
vault = ovault.Vault("test-vaults/simple_vault")

print()
print("Vault Path  :", vault.path)
print("Notes       :", len(vault.notes()))
print("Attachments :", len(vault.attachments()))
print("Tags        :", sorted(vault.tags()))
print()

# Get the note named 'first_note'
note = vault.note("first_note")

print("Note Name   :", note.name)
print("Note Path   :", note.path)
print("Note Tokens :", note.tokens())

Output:


Vault Path  : /home/balder/projects/ovault/test-vaults/simple_vault
Notes       : 11
Attachments : 0
Tags        : ['callout4youtag', 'frontmatter-tag1', 'frontmatter-tag2', 'linksaregood']

Note Name   : first_note
Note Path   : first_note.md
Note Tokens : [Header(# FIRST NOTE!), Text(Wuhuuuuuuuuuuu!Thi...), InternalLink(second note), Text(.Takes a look at t...), InternalLink(sub/todo), Text()]

Features

Vault Management

Indexing
  • Indexing: Automatically indexes all notes and attachments within the vault upon initialization.
  • Ignored Files: Respects and parses .vault-ignore files to exclude specified paths during indexing.
  • Dangling Links: Identify and list links within your notes that point to non-existent files.

Note Handling

Access & Properties
  • Access Notes & Attachments: Retrieve all notes or attachments in the vault as Python objects.
  • Frontmatter Extraction: Manipulate YAML frontmatter from notes.
Modification
  • Dynamic Note Modification: Programmatically insert or replace parts of a note

Tag Management

Querying Tags
  • List All Tags: Get a complete list of tags present in your vault.
  • Filter by Tag: Retrieve all notes associated with a specific tag.

Markdown Parsing & Tokenization

Token Representation
  • Rich Token Representation: Notes are parsed into a detailed stream of Token objects, representing various markdown elements.
  • Available Tokens:
    • Plain Text: This is text
    • Headers: (# Heading)
    • Internal Links: ([[Note Name]], ![[Image.png]])
    • External Links: ([link text](url), ![image alt](url))
    • Tags: (#tag)
    • Code Blocks: (fenced code, inline code)
    • Quotes: (> Quote)
    • Math: ($inline$ and $$display$$ LaTeX)
    • Dividers: (---)
    • Callouts: (> [!type] Title)
    • Frontmatter: (YAML metadata)
    • List: - item 1\n- item 2
    • NumericList: 1. first\n2. second
    • CheckList: - [x] done\n- [ ] not done
    • TemplaterCommand: (<% code goes here %>)

See lexer/tokens.rs for token definitions.

Contributing

I would be more than happy if anyone finds this useful enough to add to, or modify this code.

Development

Install ovault and development dependencies with

pip install -e ".[dev]"

or use the nix flake

nix develop

Build for Testing

maturin develop --release --features python

Test

./test.sh

Build Documentation

./docs/build.py

Release

  1. Bump version in Cargo.toml
  2. Commit change and push
  3. Merge dev into main and push
  4. Create a git tag with the same version: git tag <version>
  5. Push new tag: git push --tags

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ovault-0.0.7-cp37-abi3-win_amd64.whl (529.4 kB view details)

Uploaded CPython 3.7+Windows x86-64

ovault-0.0.7-cp37-abi3-manylinux_2_34_x86_64.whl (697.5 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.34+ x86-64

ovault-0.0.7-cp37-abi3-macosx_11_0_arm64.whl (634.2 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

Details for the file ovault-0.0.7-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: ovault-0.0.7-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 529.4 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ovault-0.0.7-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a716f2f216512b15ced003935e9f491e59e8b9c83b8ba1d7ddb7d043039ee8c7
MD5 e20d8412b5264c726d3ed0a01ca30443
BLAKE2b-256 cecc0d832940547940eed2b63a1e675eec3c42fbc77a32e16aa0970a9545c433

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.7-cp37-abi3-win_amd64.whl:

Publisher: release.yaml on BalderHolst/ovault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ovault-0.0.7-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ovault-0.0.7-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bc2ae1fe40a32748da2927e8633e8b87031d496a78e8d93a11c8a5e76ee4ac12
MD5 b3ee4c190045eb70e0422153cf6390a5
BLAKE2b-256 907c3cfe81215cb706520ee7709993b7460ba32c84b2dcc196df484da12824a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.7-cp37-abi3-manylinux_2_34_x86_64.whl:

Publisher: release.yaml on BalderHolst/ovault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ovault-0.0.7-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ovault-0.0.7-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5bf74a8c48533fc65baa2fcc20e37da7ff16bd1be3a4875fd7e65af6eb8d7c1
MD5 e0a4ade22149eba3d3018dd2c263a10e
BLAKE2b-256 1ce1785c06e234db4cc9281178ac896195acb14bb079a8ff1b7c0751ac4dd564

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.7-cp37-abi3-macosx_11_0_arm64.whl:

Publisher: release.yaml on BalderHolst/ovault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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