Skip to main content

About

NOTE: this is a fork of https://pypi.org/project/notesdir/ to add Dendron related functionality

Notesdir is a command-line tool to help you manage notes that are stored as regular files. It can assist with:

  • Link management
    • update references to and from a file when moving it

    • show links and backlinks for a file

  • Metadata management
    • store title, true creation date, and tags in each file via mechanisms appropriate to the file type

    • display metadata in unified format

  • Querying
    • look for files with or without specific tags

  • Templating
    • write Mako templates for quickly creating new notes

  • Organizing
    • write rules in Python for organizing directories based on file metadata or relations between files

Philosophy

  • You can use any editors you want.

  • Notes don’t all have to be the same file format. Notesdir can currently parse and update Markdown, HTML, and PDFs; new file type support is straightforward to add; unrecognized file types can coexist peacefully.

  • You can organize your files however you want, and reorganize them at will.

  • Your notes should remain completely usable without notesdir. In particular, links between notes are just regular relative file paths which can be followed by many text editors, terminals, and browsers.

  • You should be able to use just the features of notesdir that you want. The goal is to be more like a library than a framework.

  • Notesdir’s functionality is all easy to use programmatically. The Python API can be imported into your own scripts. The CLI commands also have options to print output as JSON.

Setup

  1. Install Python 3.7 or greater

  2. Run pip3 install notesdir

  3. Create a .notesdir.conf.py file in your home directory:

from notesdir.conf import *

conf = NotesdirConf(
    # SqliteRepo enables caching, which is important if you have more than a few dozen notes.
    # The sqlite database is just a cache: if you delete it, it'll be rebuilt the next time you
    # run notesdir (but that may take a while).
    repo_conf = SqliteRepoConf(
        # List the directories that contain your notes here.
        # These are searched recursively, you should not also list subdirectories.
        root_paths={'/Users/jacob/Zettel'},

        # Specify a path to store the cache in. The file will be created if it does not exist.
        # If you only have a handful of notes, you can use DirectRepoConf instead of SqliteRepoConf,
        # and omit this line.
        cache_path='/Users/jacob/local-only/notesdir-cache.sqlite3'
    ),

    # This is an optional list of path globs where note templates can be found; it's used
    # by the `notesdir new` command.
    template_globs=["/Users/jacob/Zettel/*/templates/*.mako"]
)

# This is optional. It determines the behavior of the `notesdir organize` command. This config sets
# up a couple rules:
# - If a file has title metadata, use that to set the filename, and use a limited set of characters
#   in the filename
# - If you have attachments organized into ".resources" dirs - for example,
#   a file "foo.md" and "foo.md.resources/bar.png" - make sure the files in the resources dir move
#   when the main file moves.
def path_organizer(info):
    path = rewrite_name_using_title(info)
    return resource_path_fn(path) or path

conf.path_organizer = path_organizer

# This is optional. It tells notesdir not to parse or edit certain files. I store attachments
# to notes in directories named like `filename.resources`, and those attachments would never
# contain metadata or links that I want to query or update, so I skip parsing those.
# These files can still be moved by `organize`, and backlinks are still tracked for them.
def skip_parse(parentpath, filename):
    return filename.endswith('.resources')

conf.repo_conf.skip_parse = skip_parse

That’s it! You can run notesdir query to print a list of everything Notesdir currently knows about your notes. (Which may or may not be very much, until you fill in some metadata.) It may take a while the first time, while it builds the cache.

See the full documentation for a walkthrough of all the functionality.

Release files for dendron-notesdir 0.0.6

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

Source distribution (sdist)

Source distribution for dendron-notesdir 0.0.6
File Size Uploaded
dendron-notesdir-0.0.6.tar.gz 32.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dendron-notesdir 0.0.6
File Interpreter ABI Platform
dendron_notesdir-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 74.3 kB

Release files / dendron-notesdir-0.0.6.tar.gz

Download URL dendron-notesdir-0.0.6.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
84da8d30b4922e6c1bd4f5bc9d239436cd0739757f9699f2a70977486d813c15
BLAKE2b-256 checksum
How to use checksums
bbb5ddc3b61248cc2cf22e2e32d179e0c3c78e17e4fe5c4ec0de3f624c458d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Release files / dendron_notesdir-0.0.6-py3-none-any.whl

Download URL dendron_notesdir-0.0.6-py3-none-any.whl
Size 41.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69e9fda8f4e10369f3422aae7f1b9c298495b279353506ecdd1a78173e46ad41
BLAKE2b-256 checksum
How to use checksums
3bf73db1736e69c9e007e47d10254493ef880590ba2ab5246264c70dfba523a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.4

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