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

Automated Way

Test, build and publish are now completed from a GitHub workflow. The workflow is triggered by pushing a tagged branch v* to GitHub.

poetry version |patch|minor|major|
git add pyproject.toml
git commit -m "Release v2.1.4"
git tag -a "v2.1.4" -m "Release v2.1.4"
pit push --tag origin HEAD

The workflow will run and complete publishing.

Old Manual Way

As above, but after pushing

# ensure your pypi token is registered with Poetry
poetry config pypi-token.pypi <fresh-token>

# publish the package
poetry publish

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.7.tar.gz (7.2 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.7-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: take_note_cli-2.1.7.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for take_note_cli-2.1.7.tar.gz
Algorithm Hash digest
SHA256 3eceae9a30a40c6b73154d00df7d401e6cc0ae0eb1ced2ea31db76a2ee6d0aa7
MD5 3a00977dfc657b8f74cd4c1afee6b2b3
BLAKE2b-256 9c63ab18ab0ee6a1759fa75d42fd0cb8990a102f96d7ec9e1309213e418e7aeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for take_note_cli-2.1.7.tar.gz:

Publisher: python-package.yml on wsinned/take-note

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

File details

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

File metadata

  • Download URL: take_note_cli-2.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for take_note_cli-2.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5f71bbf71401091342f39ca9770d29a4d52ad5e2fe0da5e21f87a44629309640
MD5 688c411e8f2c20cc82442beb0123fefe
BLAKE2b-256 1acea4f622fc951cd57ef47e5652f0bd06bac40baac8624df6d990f2e2f50f9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for take_note_cli-2.1.7-py3-none-any.whl:

Publisher: python-package.yml on wsinned/take-note

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