Skip to main content

Create and open notes in your favourite editor.

Project description

Take Note

Create, organise and open notes in your favourite editor.

I like having a quick, reliable and repeatable way of taking notes. If I have to open an editor, navigate to the correct file, or create one in the correct place when it doesn't exist, then I find that I end up taking notes in random places. With Take Note, I have a few simple aliases set up so that typing thisWeek in my shell gets me to the right place in my DropBox with a new file, created from a template so that eveything is consistent, if needed. This really scratches my itch. If it works for you great! If not, create your own solution.

Features

  • Written in Python with minimal runtime dependencies. Initially there were none, but I recently added Confuse (in v2.0.0) to allow a config file to do some of the heavy lifting that made aliases cumbersome.
    • Works on Python 3.8 - 3.13.
  • Open notes files for specified week using the code command line for VS Code.
    • --thisWeek, --lastWeek and --nextWeek are supported.
  • Organises notes in a date based folder structure from your root notes folder, e.g. 2023/08
    • The default folder is $HOME/Notes. I prefer to keep them in Google Drive or DropBox so I can access from mobile, tablet or my spare laptop.
    • set the root notes folder using --notesFolder
  • Choose which editor to use with --editor
    • VSCode and Obsidian are supported with dedicated handlers
    • Fallback generic handler will open anything ou can call from the terminal e.g. vi, emacs.
  • Specify a VS Code workspace to open along with the note file with --workspace
    • This will automatically override the --editor setting to code. I have my default workspace set up with:
      • Zen mode
      • Word wrap
  • Specify a template file relative to the root notes folder to use when a new file is created using --template. This also performs a simple replacement of the text HEADER_DATE with the date formatted as "%A %d %B %Y" to use in the document title.
  • Support for batch creation of files in advance. This is useful if you use a device where you can edit files, but can't easily create them. Use --batch 5 along with any of the --*Week options to create that week and the following 4 weeks too.
  • Config file allows base options to be set and reduce command line arguments needed.

Obsidian Integration

Support for opening using Obsidian application uris:

xdg-open "obsidian://open?path=/home/wsinned/Documents/Personal/WorkNotes/2024/11/2024-11-11-Weekly-log.md

This handler opens the vault 'Personal' and the note file in the WorkNotes/2024/11/ folder of the vault.

The command called adapts according to sys.platform e.g. open, start or xdg-open.

Future features

  • Support for daily notes options.

Installation

pipx

The recommended way to install the published package is through pipx.

# from PyPI
pipx install take-note-cli

# direct from github
pipx install git+https://github.com/wsinned/take-note

Usage

Config File

A basic config file will be created in ~/.config/TakeNote/config.yaml if it doesn't already exist. Specifying default values here simplifies use of the command line by reducing the number of options needed to be supplied or added to an alias.

Config File Default Options

  • notesFolder: Notes
  • editor: code
  • workspace:
  • template:
  • batch:
  • verbose: False

Command Line

Command line arguments will override any specified in the config file. Specify a folder using the --notesFolder option. A week option must be supplied from --thisWeek, --lastWeek or --nextWeek

take-note --notesFolder=$HOME/MyNotes --thisWeek

A note will be created in the under the MyNotes/YYYY/mm folder named with the date of the Monday of this week, e.g. 2023-08-07-Weekly-log.md

Aliases

Setting up aliases in you preferred shell is a great way to make accessing your notes quick and easy.

NOTES_FOLDER="$HOME/SomePath/MyNotes"

alias thisWeek="take-note --thisWeek --notesFolder $NOTES_FOLDER --workspace notes.code-workspace"
alias nextWeek="take-note --nextWeek --notesFolder $NOTES_FOLDER --workspace notes.code-workspace --batch 5"
alias lastWeek="take-note --lastWeek --editor hx"

All you have to do now is type one of the following to open the desired note file.

> thisWeek
> lastWeek
> nextWeek

Other Installation Methods

Virtual Environment

python -m venv venv 

source venv/bin/activate

venv/bin/pip install -r requirements.txt

# install with tests as editable src
venv/bin/pip install -e .

Development

Nix & NixOS

The supplied shell.nix definition provides support for entering a nix-shell directly in the repository with all dependencies.

nix-shell --run zsh # ensure using zsh over default bash session

Then follow the instructions for other OS.

Other Linux or macOS

# only needed once, or to recreate the virtual environment
# install dependencies
poetry install

# enter an activated shell and run tests
poetry shell
pytest
ruff . --config pyproject.toml

# run the tests without activating a shell
poetry run pytest

# run the installed app
poetry run take-note-cli --thisWeek

# exit the shell
exit

Linting

The project uses ruff for linting and optionally for formatting.

poetry run ruff . --config pyproject.toml

Build & Publish

From an installed and tested venv, do the following:

Bump the version in pyproject.toml

# build the package
poetry build

# publish the package
poetry publish

Credentials for twine should be either: - stored in .pypirc in the [pypi] section - entered at the prompt, username = token and password = your_api_key

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

take_note_cli-2.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

take_note_cli-2.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file take_note_cli-2.1.0.tar.gz.

File metadata

  • Download URL: take_note_cli-2.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.61

File hashes

Hashes for take_note_cli-2.1.0.tar.gz
Algorithm Hash digest
SHA256 6a915cbc36a81dbdf9bd0c15fc390225d337173d1cab607764d4d55fe7097cb2
MD5 10eeb9bdf7c0ce5693d89064027ae977
BLAKE2b-256 9009d8468ddebb9ad2471d3f7e7a328b2a125d23fcedaed518b091a6bf0f51d2

See more details on using hashes here.

File details

Details for the file take_note_cli-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: take_note_cli-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.61

File hashes

Hashes for take_note_cli-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a26438976c5db3187404d9898a93326d0beb9cd256ee84f74a947e2338b596e
MD5 8eef97df0fc4ca322066ac927d1a587b
BLAKE2b-256 bfffd4e93ac18a81a94ec28d91c45a72c82e797837a051368f078a3e145d4962

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