Name | macnotesapp JSON |
Version |
0.7.0
JSON |
| download |
home_page | https://github.com/RhetTbull/macnotesapp |
Summary | Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code. |
upload_time | 2024-09-15 13:02:21 |
maintainer | None |
docs_url | None |
author | Rhet Turnbull |
requires_python | <3.13,>=3.9 |
license | MIT |
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 -->
[](#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
There are two ways to install the command line tool: `pipx` or `homebrew`.
### Install with [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.
### Install with [homebrew](brew.sh)
* Install `homebrew` according to instructions at [https://brew.sh/](https://brew.sh/)
Once you have installed `homebrew`, you can install the CLI in the terminal with:
brew tap RhetTbull/macnotesapp https://github.com/RhetTbull/macnotesapp
brew update
brew install macnotesapp
* Now you should be able to run `notes` by typing: `notes`
## 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>
<td align="center" valign="top" width="14.28%"><a href="https://skife.org/"><img src="https://avatars.githubusercontent.com/u/1291?v=4?s=100" width="100px;" alt="Brian McCallister"/><br /><sub><b>Brian McCallister</b></sub></a><br /><a href="https://github.com/RhetTbull/macnotesapp/commits?author=brianm" title="Code">💻</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/d2/f9/04956bb7d3c51ffa9f29ae136db3e3e9b47188233090395276161511cb5b/macnotesapp-0.7.0.tar.gz",
"platform": null,
"description": "# MacNotesApp\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#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\nThere are two ways to install the command line tool: `pipx` or `homebrew`.\n\n### Install with [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### Install with [homebrew](brew.sh)\n\n* Install `homebrew` according to instructions at [https://brew.sh/](https://brew.sh/)\n\nOnce you have installed `homebrew`, you can install the CLI in the terminal with:\n\n brew tap RhetTbull/macnotesapp https://github.com/RhetTbull/macnotesapp\n brew update\n brew install macnotesapp\n\n* Now you should be able to run `notes` by typing: `notes`\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 <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://skife.org/\"><img src=\"https://avatars.githubusercontent.com/u/1291?v=4?s=100\" width=\"100px;\" alt=\"Brian McCallister\"/><br /><sub><b>Brian McCallister</b></sub></a><br /><a href=\"https://github.com/RhetTbull/macnotesapp/commits?author=brianm\" title=\"Code\">\ud83d\udcbb</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\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.7.0",
"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": "dcda16e372495429999b3cd74ee1ee748693d0dc2586db14d89bd3d88897792c",
"md5": "863ca3af7bb9a49ede724b484bd5e2f2",
"sha256": "b9a04e52614eed6fcc37f6a21e24c088b8273c7e2b5ec8698362e96d67133f39"
},
"downloads": -1,
"filename": "macnotesapp-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "863ca3af7bb9a49ede724b484bd5e2f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 30881,
"upload_time": "2024-09-15T13:02:19",
"upload_time_iso_8601": "2024-09-15T13:02:19.819441Z",
"url": "https://files.pythonhosted.org/packages/dc/da/16e372495429999b3cd74ee1ee748693d0dc2586db14d89bd3d88897792c/macnotesapp-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d2f904956bb7d3c51ffa9f29ae136db3e3e9b47188233090395276161511cb5b",
"md5": "4bb214efefa00a5851e56187463ff293",
"sha256": "dfe37c1cfa509debe4dfcbf1571f04a4ddd9fc0ae752811e6eb94c8157f7832d"
},
"downloads": -1,
"filename": "macnotesapp-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "4bb214efefa00a5851e56187463ff293",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 26805,
"upload_time": "2024-09-15T13:02:21",
"upload_time_iso_8601": "2024-09-15T13:02:21.661675Z",
"url": "https://files.pythonhosted.org/packages/d2/f9/04956bb7d3c51ffa9f29ae136db3e3e9b47188233090395276161511cb5b/macnotesapp-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-15 13:02:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RhetTbull",
"github_project": "macnotesapp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "macnotesapp"
}