macnotesapp


Namemacnotesapp JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttps://github.com/RhetTbull/macnotesapp
SummaryWork with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.
upload_time2024-04-17 04:05:19
maintainerNone
docs_urlNone
authorRhet Turnbull
requires_python<3.13,>=3.9
licenseMIT
keywords cli mac macos
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MacNotesApp
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.

## Installation

If you just want to use the command line tool, the easiest option is to install via [pipx](https://pypa.github.io/pipx/).

If you use `pipx`, you will not need to create a python virtual environment as `pipx` takes care of this. The easiest way to do this on a Mac is to use [homebrew](https://brew.sh/):

* Open `Terminal` (search for `Terminal` in Spotlight or look in `Applications/Utilities`)
* Install `homebrew` according to instructions at [https://brew.sh/](https://brew.sh/)
* Type the following into Terminal: `brew install pipx`
* Then type this: `pipx install macnotesapp`
* `pipx` will install the `macnotesapp` command line interface (CLI) as an executable named `notes`
* Now you should be able to run `notes` by typing: `notes`

Once you've installed macnotesapp with pipx, to upgrade to the latest version:

    pipx upgrade macnotesapp

**Note**: Currently tested on MacOS 10.15.7/Catalina and 13.1/Ventura.

## Documentation

Full documentation available at [https://RhetTbull.github.io/macnotesapp/](https://RhetTbull.github.io/macnotesapp/)

## Command Line Usage

<!-- [[[cog
import cog
from macnotesapp.cli import cli_main
from click.testing import CliRunner
runner = CliRunner()
result = runner.invoke(cli_main, ["--help"])
help = result.output.replace("Usage: cli-main", "Usage: notes")
cog.out(
    "```\n{}\n```".format(help)
)
]]] -->
```
Usage: notes [OPTIONS] COMMAND [ARGS]...

  notes: work with Apple Notes on the command line.

Options:
  -v, --version  Show the version and exit.
  -h, --help     Show this message and exit.

Commands:
  accounts  Print information about Notes accounts.
  add       Add new note.
  cat       Print one or more notes to STDOUT
  config    Configure default settings for account, editor, etc.
  dump      Dump all notes or selection of notes for debugging
  help      Print help; for help on commands: help <command>.
  list      List notes, optionally filtering by account or text.

```
<!-- [[[end]]] -->

Use `notes help COMMAND` to get help on a specific command. For example, `notes help add`:

<!-- [[[cog
import cog
from macnotesapp.cli import cli_main
from click.testing import CliRunner
runner = CliRunner()
result = runner.invoke(cli_main, ["help", "add", "--no-markup"])
help = result.output.replace("Usage: cli-main", "Usage: notes")
cog.out(
    "```\n{}\n```".format(help)
)
]]] -->
```
Usage: notes add [OPTIONS] NOTE

  Add new note.

  There are multiple ways to add a new note:

  Add a new note from standard input (STDIN):

  notes add

  cat file.txt | notes add

  notes add < file.txt

  Add a new note by passing string on command line:

  notes add NOTE

  Add a new note by opening default editor (defined in $EDITOR or via `notes
  config`):

  notes add --edit

  notes add -e

  Add a new note from URL (downloads URL, creates a cleaned readable version
  to store in new Note):

  notes add --url URL

  notes add -u URL

  If NOTE is a single line, adds new note with name NOTE and no body. If NOTE is
  more than one line, adds new note where name is first line of NOTE and body is
  remainder.

  Body of note must be plain text unless --html/-h or --markdown/-m
  flag is set in which case body should be HTML or Markdown, respectively. If
  --edit/-e flag is set, note will be opened in default editor before
  being added. If --show/-s flag is set, note will be shown in Notes.app
  after being added.

  Account and top level folder may be specified with --account/-a and
  --folder/-f, respectively. If not provided, default account and folder
  are used.

Options:
  -s, --show             Show note in Notes after adding.
  -F, --file FILENAME
  -u, --url URL
  -h, --html             Use HTML for body of note.
  -m, --markdown         Use Markdown for body of note.
  -p, --plaintext        Use plaintext for body of note (default unless changed
                         in `notes config`).
  -e, --edit             Edit note text before adding in default editor.
  -a, --account ACCOUNT  Add note to account ACCOUNT.
  -f, --folder FOLDER    Add note to folder FOLDER.
  --help                 Show this message and exit.

```
<!-- [[[end]]] -->

## Python Usage

<!-- [[[cog
import cog
with open("examples/example.py") as f:
    example = f.read()
cog.out(
    "```python\n{}\n```".format(example)
)
]]] -->
```python
"""Example code for working with macnotesapp"""

from macnotesapp import NotesApp

# NotesApp() provides interface to Notes.app
notesapp = NotesApp()

# Get list of notes (Note objects for each note)
notes = notesapp.notes()
note = notes[0]
print(
    note.id,
    note.account,
    note.folder,
    note.name,
    note.body,
    note.plaintext,
    note.password_protected,
)

print(note.asdict())

# Get list of notes for one or more specific accounts
notes = notesapp.notes(accounts=["iCloud"])

# Create a new note in default folder of default account
new_note = notesapp.make_note(
    name="New Note", body="This is a new note created with #macnotesapp"
)

# Create a new note in a specific folder of a specific account
account = notesapp.account("iCloud")
account.make_note(
    "My New Note", "This is a new note created with #macnotesapp", folder="Notes"
)

# If working with many notes, it is far more efficient to use the NotesList object
# Find all notes with "#macnotesapp" in the body
noteslist = notesapp.noteslist(body=["#macnotesapp"])

print(f"There are {len(noteslist)} notes with #macnotesapp in the body")

# List of names of notes in noteslist
note_names = noteslist.name
print(note_names)

```
<!-- [[[end]]] -->

## Known Issues and Limitations

* Password protected notes are not supported; unlocked password-protected notes can be accessed but locked notes cannot
* Notes containing tags (#tagname) can be read but the tags will be stripped from the body of the note
* Tags cannot be added to notes and will show up as plaintext if added manually with macnotesapp
* Currently, only notes in top-level folders are accessible to `macnotesapp` (#4)
* Attachments are not currently handled and will be ignored (#15)
* The title style is not correctly set (#13)

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/chadmando"><img src="https://avatars.githubusercontent.com/u/20407042?v=4?s=100" width="100px;" alt="chadmando"/><br /><sub><b>chadmando</b></sub></a><br /><a href="#userTesting-chadmando" title="User Testing">📓</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/JonathanDoughty"><img src="https://avatars.githubusercontent.com/u/1918593?v=4?s=100" width="100px;" alt="JonathanDoughty"/><br /><sub><b>JonathanDoughty</b></sub></a><br /><a href="https://github.com/RhetTbull/macnotesapp/issues?q=author%3AJonathanDoughty" title="Bug reports">🐛</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RhetTbull/macnotesapp",
    "name": "macnotesapp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "cli, mac, macos",
    "author": "Rhet Turnbull",
    "author_email": "rturnbull@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/11/e8/0e03c5f63691aa1930d45209ff9f4bfad136e55b6e9f343c937e24133f20/macnotesapp-0.6.1.tar.gz",
    "platform": null,
    "description": "# MacNotesApp\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nWork with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.\n\n## Installation\n\nIf you just want to use the command line tool, the easiest option is to install via [pipx](https://pypa.github.io/pipx/).\n\nIf you use `pipx`, you will not need to create a python virtual environment as `pipx` takes care of this. The easiest way to do this on a Mac is to use [homebrew](https://brew.sh/):\n\n* Open `Terminal` (search for `Terminal` in Spotlight or look in `Applications/Utilities`)\n* Install `homebrew` according to instructions at [https://brew.sh/](https://brew.sh/)\n* Type the following into Terminal: `brew install pipx`\n* Then type this: `pipx install macnotesapp`\n* `pipx` will install the `macnotesapp` command line interface (CLI) as an executable named `notes`\n* Now you should be able to run `notes` by typing: `notes`\n\nOnce you've installed macnotesapp with pipx, to upgrade to the latest version:\n\n    pipx upgrade macnotesapp\n\n**Note**: Currently tested on MacOS 10.15.7/Catalina and 13.1/Ventura.\n\n## Documentation\n\nFull documentation available at [https://RhetTbull.github.io/macnotesapp/](https://RhetTbull.github.io/macnotesapp/)\n\n## Command Line Usage\n\n<!-- [[[cog\nimport cog\nfrom macnotesapp.cli import cli_main\nfrom click.testing import CliRunner\nrunner = CliRunner()\nresult = runner.invoke(cli_main, [\"--help\"])\nhelp = result.output.replace(\"Usage: cli-main\", \"Usage: notes\")\ncog.out(\n    \"```\\n{}\\n```\".format(help)\n)\n]]] -->\n```\nUsage: notes [OPTIONS] COMMAND [ARGS]...\n\n  notes: work with Apple Notes on the command line.\n\nOptions:\n  -v, --version  Show the version and exit.\n  -h, --help     Show this message and exit.\n\nCommands:\n  accounts  Print information about Notes accounts.\n  add       Add new note.\n  cat       Print one or more notes to STDOUT\n  config    Configure default settings for account, editor, etc.\n  dump      Dump all notes or selection of notes for debugging\n  help      Print help; for help on commands: help <command>.\n  list      List notes, optionally filtering by account or text.\n\n```\n<!-- [[[end]]] -->\n\nUse `notes help COMMAND` to get help on a specific command. For example, `notes help add`:\n\n<!-- [[[cog\nimport cog\nfrom macnotesapp.cli import cli_main\nfrom click.testing import CliRunner\nrunner = CliRunner()\nresult = runner.invoke(cli_main, [\"help\", \"add\", \"--no-markup\"])\nhelp = result.output.replace(\"Usage: cli-main\", \"Usage: notes\")\ncog.out(\n    \"```\\n{}\\n```\".format(help)\n)\n]]] -->\n```\nUsage: notes add [OPTIONS] NOTE\n\n  Add new note.\n\n  There are multiple ways to add a new note:\n\n  Add a new note from standard input (STDIN):\n\n  notes add\n\n  cat file.txt | notes add\n\n  notes add < file.txt\n\n  Add a new note by passing string on command line:\n\n  notes add NOTE\n\n  Add a new note by opening default editor (defined in $EDITOR or via `notes\n  config`):\n\n  notes add --edit\n\n  notes add -e\n\n  Add a new note from URL (downloads URL, creates a cleaned readable version\n  to store in new Note):\n\n  notes add --url URL\n\n  notes add -u URL\n\n  If NOTE is a single line, adds new note with name NOTE and no body. If NOTE is\n  more than one line, adds new note where name is first line of NOTE and body is\n  remainder.\n\n  Body of note must be plain text unless --html/-h or --markdown/-m\n  flag is set in which case body should be HTML or Markdown, respectively. If\n  --edit/-e flag is set, note will be opened in default editor before\n  being added. If --show/-s flag is set, note will be shown in Notes.app\n  after being added.\n\n  Account and top level folder may be specified with --account/-a and\n  --folder/-f, respectively. If not provided, default account and folder\n  are used.\n\nOptions:\n  -s, --show             Show note in Notes after adding.\n  -F, --file FILENAME\n  -u, --url URL\n  -h, --html             Use HTML for body of note.\n  -m, --markdown         Use Markdown for body of note.\n  -p, --plaintext        Use plaintext for body of note (default unless changed\n                         in `notes config`).\n  -e, --edit             Edit note text before adding in default editor.\n  -a, --account ACCOUNT  Add note to account ACCOUNT.\n  -f, --folder FOLDER    Add note to folder FOLDER.\n  --help                 Show this message and exit.\n\n```\n<!-- [[[end]]] -->\n\n## Python Usage\n\n<!-- [[[cog\nimport cog\nwith open(\"examples/example.py\") as f:\n    example = f.read()\ncog.out(\n    \"```python\\n{}\\n```\".format(example)\n)\n]]] -->\n```python\n\"\"\"Example code for working with macnotesapp\"\"\"\n\nfrom macnotesapp import NotesApp\n\n# NotesApp() provides interface to Notes.app\nnotesapp = NotesApp()\n\n# Get list of notes (Note objects for each note)\nnotes = notesapp.notes()\nnote = notes[0]\nprint(\n    note.id,\n    note.account,\n    note.folder,\n    note.name,\n    note.body,\n    note.plaintext,\n    note.password_protected,\n)\n\nprint(note.asdict())\n\n# Get list of notes for one or more specific accounts\nnotes = notesapp.notes(accounts=[\"iCloud\"])\n\n# Create a new note in default folder of default account\nnew_note = notesapp.make_note(\n    name=\"New Note\", body=\"This is a new note created with #macnotesapp\"\n)\n\n# Create a new note in a specific folder of a specific account\naccount = notesapp.account(\"iCloud\")\naccount.make_note(\n    \"My New Note\", \"This is a new note created with #macnotesapp\", folder=\"Notes\"\n)\n\n# If working with many notes, it is far more efficient to use the NotesList object\n# Find all notes with \"#macnotesapp\" in the body\nnoteslist = notesapp.noteslist(body=[\"#macnotesapp\"])\n\nprint(f\"There are {len(noteslist)} notes with #macnotesapp in the body\")\n\n# List of names of notes in noteslist\nnote_names = noteslist.name\nprint(note_names)\n\n```\n<!-- [[[end]]] -->\n\n## Known Issues and Limitations\n\n* Password protected notes are not supported; unlocked password-protected notes can be accessed but locked notes cannot\n* Notes containing tags (#tagname) can be read but the tags will be stripped from the body of the note\n* Tags cannot be added to notes and will show up as plaintext if added manually with macnotesapp\n* Currently, only notes in top-level folders are accessible to `macnotesapp` (#4)\n* Attachments are not currently handled and will be ignored (#15)\n* The title style is not correctly set (#13)\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/chadmando\"><img src=\"https://avatars.githubusercontent.com/u/20407042?v=4?s=100\" width=\"100px;\" alt=\"chadmando\"/><br /><sub><b>chadmando</b></sub></a><br /><a href=\"#userTesting-chadmando\" title=\"User Testing\">\ud83d\udcd3</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/JonathanDoughty\"><img src=\"https://avatars.githubusercontent.com/u/1918593?v=4?s=100\" width=\"100px;\" alt=\"JonathanDoughty\"/><br /><sub><b>JonathanDoughty</b></sub></a><br /><a href=\"https://github.com/RhetTbull/macnotesapp/issues?q=author%3AJonathanDoughty\" title=\"Bug reports\">\ud83d\udc1b</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "https://github.com/RhetTbull/macnotesapp",
        "Repository": "https://github.com/RhetTbull/macnotesapp"
    },
    "split_keywords": [
        "cli",
        " mac",
        " macos"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3545987a8c71f94a72b16bd98ed1e51377784b17695ef5b17b45c83fef8db268",
                "md5": "3c62fb8c0e6148c028bd5b0948547455",
                "sha256": "0a27acceaa43bd9b60f816b83dd8e963465ed15f95b4e1903dd51cb6aff2b42f"
            },
            "downloads": -1,
            "filename": "macnotesapp-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c62fb8c0e6148c028bd5b0948547455",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 30753,
            "upload_time": "2024-04-17T04:05:17",
            "upload_time_iso_8601": "2024-04-17T04:05:17.458403Z",
            "url": "https://files.pythonhosted.org/packages/35/45/987a8c71f94a72b16bd98ed1e51377784b17695ef5b17b45c83fef8db268/macnotesapp-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11e80e03c5f63691aa1930d45209ff9f4bfad136e55b6e9f343c937e24133f20",
                "md5": "d0f349783d0956742b29025bb68a77f9",
                "sha256": "a01c4f285eaf98b7e872c76a138891ee93d47bbed6fc7dea4705b19fc766cde3"
            },
            "downloads": -1,
            "filename": "macnotesapp-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d0f349783d0956742b29025bb68a77f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 26554,
            "upload_time": "2024-04-17T04:05:19",
            "upload_time_iso_8601": "2024-04-17T04:05:19.835165Z",
            "url": "https://files.pythonhosted.org/packages/11/e8/0e03c5f63691aa1930d45209ff9f4bfad136e55b6e9f343c937e24133f20/macnotesapp-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 04:05:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RhetTbull",
    "github_project": "macnotesapp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "macnotesapp"
}
        
Elapsed time: 0.26027s