Skip to main content

Library for Managing your Obsidian Vault

Project description

OVault

A python library for accessing and editing your Obsidian vault.

[!WARNING] This library can easily make large changes to your vault which may be difficult to reverse. Make sure to have a backup of your vault before using OVault to modify it.

Check out the examples!

Code Example

import ovault

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

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 : 3
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()]

Included Utilities

OVault includes runnable modules for common tasks. Get an overview by running the ovault module:

python -m ovault

Output:

OVault provies a few utilties out of the box.

You can run them like so: `python3 -m ovault.<module>`

Available modules:
    ovault.visualize_graph        : Visualize your Obsidian vault graph using pyvis.
    ovault.check_links            : Check all external links to websites in an Obsidian vault and report any broken links.
    ovault.to_html                : Convert an obsidian vault to a simple static HTML site.
    ovault.mv                     : Rename a file within an Obsidian vault, updating all links accordingly.
    ovault.info                   : Show information about an Obsidian vault.
    ovault.name_pasted_images     : Rename pasted images in the vault based on the note they are pasted into.
    ovault.help                   : Show a list of all utility modules included in `ovault`.
    ovault.filename_compatibility : Check filenames for compatibility across different operating systems.

Install

pip install ovault

or locally

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

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.

See Token in lexer/tokens.rs for all 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

./scripts/test.sh

Generate coverage report with

cargo tarpaulin --engine llvm --release --out Html

Build Documentation

./scripts/build-docs.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.10-cp37-abi3-win_amd64.whl (584.3 kB view details)

Uploaded CPython 3.7+Windows x86-64

ovault-0.0.10-cp37-abi3-manylinux_2_34_x86_64.whl (741.8 kB view details)

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

ovault-0.0.10-cp37-abi3-macosx_11_0_arm64.whl (683.7 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ovault-0.0.10-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 584.3 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.10-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fd8b40f60fdc9538acbb5390d5d3b125b86a38795403d8261b48a90383dbbbd1
MD5 9002d2ba2ca525bbcee7bbd2eb64dc4a
BLAKE2b-256 e0d6e85735d9460e16dcf7013906bbd13b6ecb991b26b548be407e1822ad7ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.10-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.10-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ovault-0.0.10-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ce19c51d6b9dc06adad9f427d502d59576985cd1bf8439db1d7ebf5d84a01a97
MD5 2440937d6773dbfe3bd2e7344d781e80
BLAKE2b-256 0d25d3941ec9fe56a3233647964d07160fcc08c01bacb714a3dfa88d5fd2b61a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.10-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.10-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ovault-0.0.10-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 429be887127e5c35f735320b3e1ebe500c25b774c12a823cba6f33e4def490e4
MD5 61366821e0d963cf86feee8f2119e659
BLAKE2b-256 3f01d59c72774c96f120c819fd1bee75bb223c945cfb9e4b813a23f04f9fedad

See more details on using hashes here.

Provenance

The following attestation bundles were made for ovault-0.0.10-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