Skip to main content

obsbase

Read and query Obsidian Bases from Python.

obsbase loads Obsidian .base files and returns the results as Python objects or pandas DataFrames.

Installation

pip install obsbase

Quick start

from obsbase import Vaultvault = Vault("/path/to/your/vault")df = (    vault    .base("books.base")    .run()    .to_dataframe())print(df.head())

Description

Vault
   │
   ├── notes()
   │
   └── base("books.base")
            │
            ▼
          Base
            │
            ▼
          View
            │
            ▼
        ResultSet
            │
            ▼
       pandas.DataFrame

Example

example vault with french cities:

set md files from wikipedia : https://fr.wikipedia.org/wiki/Liste_des_communes_de_France_les_plus_peupl%C3%A9es

villes/    Paris.md    Lyon.md    Marseille.md

top50.base

views:
  - type: table
    name: Tableau
    filters:
      and:
        - file.folder == "villes"
        - Rang_2023 <= 50
    order:
      - file.name
      - Commune
      - Population_de_référence
      - Département
      - Région
      - Rang_2023
    sort:
      - property: Rang_2023
        direction: ASC

Then:

from obsbase import Vault

vault = Vault("examples/obsbase_vault")

base = vault.base("top50.base")

rows = base.run()

df = rows.to_dataframe()

returns

file.name Commune Population_de_référence Département Région Rang_2023
0 Reims Reims 177 674 Marne Grand Est 13
1 Amiens Amiens 136 449 Somme Hauts-de-France 28
2 Avignon Avignon 92 188 Vaucluse Provence-Alpes-Côte d'Azur 49
3 Tourcoing Tourcoing 98 772 Nord Hauts-de-France 43
4 Roubaix Roubaix 98 286 Nord Hauts-de-France 44
5 Villeurbanne Villeurbanne 163 684 Métropole de Lyon Auvergne-Rhône-Alpe 16
... ... ... ... ... ... ...
45 Paris Paris 2 103 778 Paris Île-de-France 1
46 Perpignan Perpignan 121 616 Pyrénées-Orientales Occitanie 32
47 Strasbourg Strasbourg 293 771 Bas-Rhin Grand Est 8
48 Aix-en-Provence Aix-en-Provence 149 695 Bouches-du-Rhône Provence-Alpes-Côte d'Azur 22
49 Toulouse Toulouse 514 819 Haute-Garonne Occitanie 4

API

Vault

vault = Vault(path)

Methods

  • notes()
  • base(filename)

Base

base = vault.base("top50.base")

Methods

  • run()

Attributes

  • views

View

view = base.views[0]

Methods

  • run()

Attributes

  • name
  • type
  • filters
  • columns
  • sort

ResultSet

rows = base.run()

Methods

  • to_dataframe()

Supports

  • iteration
  • indexing
  • len()

Roadmap

  • Read notes
  • Read .base files
  • Execute filters
  • Export to pandas
  • Sorting
  • Nested filters (or)
  • Dataview expressions
  • CSV export
  • Markdown export

Metadata

Release files for obsbase 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obsbase 0.1.3
File Size Uploaded
obsbase-0.1.3.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for obsbase 0.1.3
File Interpreter ABI Platform
obsbase-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / obsbase-0.1.3.tar.gz

Download URL obsbase-0.1.3.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
48176e73d01255a6d47f1cbf5fabe31105c7da31a8bbbd81106ed39f9790afc4
BLAKE2b-256 checksum
How to use checksums
26aa2409da3d4648f29a83652d5784034c205d304da8ddd4fd21f12c437c7f0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / obsbase-0.1.3-py3-none-any.whl

Download URL obsbase-0.1.3-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78c21b943bf5eb42340541a25a282d4d74ae2f84699bef616b6dab653057a154
BLAKE2b-256 checksum
How to use checksums
c3e6a0c6a32251f113cf0c0f92c8917372a8934d76b4cbee1acda50fe64324bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page