take-note-cli 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {take-note-cli-1.1.0/src/take_note_cli.egg-info → take_note_cli-1.2.0}/PKG-INFO +19 -16
  2. {take-note-cli-1.1.0 → take_note_cli-1.2.0}/README.md +8 -0
  3. take_note_cli-1.2.0/pyproject.toml +52 -0
  4. {take-note-cli-1.1.0/src/takenote → take_note_cli-1.2.0/src/take_note_cli}/__main__.py +1 -3
  5. {take-note-cli-1.1.0/src/takenote → take_note_cli-1.2.0/src/take_note_cli}/core/notes.py +25 -9
  6. take_note_cli-1.2.0/src/take_note_cli/utils/__init__.py +0 -0
  7. {take-note-cli-1.1.0/src/takenote → take_note_cli-1.2.0/src/take_note_cli}/utils/args.py +10 -7
  8. {take-note-cli-1.1.0/src/takenote → take_note_cli-1.2.0/src/take_note_cli}/utils/dates.py +4 -5
  9. {take-note-cli-1.1.0/src/takenote → take_note_cli-1.2.0/src/take_note_cli}/utils/paths.py +1 -1
  10. take-note-cli-1.1.0/MANIFEST.in +0 -1
  11. take-note-cli-1.1.0/PKG-INFO +0 -181
  12. take-note-cli-1.1.0/pyproject.toml +0 -8
  13. take-note-cli-1.1.0/setup.cfg +0 -54
  14. take-note-cli-1.1.0/src/take_note_cli.egg-info/SOURCES.txt +0 -20
  15. take-note-cli-1.1.0/src/take_note_cli.egg-info/dependency_links.txt +0 -1
  16. take-note-cli-1.1.0/src/take_note_cli.egg-info/entry_points.txt +0 -2
  17. take-note-cli-1.1.0/src/take_note_cli.egg-info/requires.txt +0 -5
  18. take-note-cli-1.1.0/src/take_note_cli.egg-info/top_level.txt +0 -1
  19. take-note-cli-1.1.0/src/takenote/__init__.py +0 -1
  20. take-note-cli-1.1.0/src/takenote/__version__.py +0 -1
  21. {take-note-cli-1.1.0 → take_note_cli-1.2.0}/LICENSE +0 -0
  22. {take-note-cli-1.1.0/src/takenote/core → take_note_cli-1.2.0/src/take_note_cli}/__init__.py +0 -0
  23. {take-note-cli-1.1.0/src/takenote/utils → take_note_cli-1.2.0/src/take_note_cli/core}/__init__.py +0 -0
@@ -1,34 +1,28 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: take-note-cli
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Create and open notes in your favourite editor.
5
5
  Home-page: https://github.com/wsinned/take-note
6
+ License: MIT
7
+ Keywords: note,tool,utility,cli
6
8
  Author: wsinned
7
9
  Author-email: wsinned@tutanota.com
8
- Project-URL: Source, https://github.com/wsinned/take-note
9
- Keywords: note tool utility cli
10
+ Requires-Python: >=3.8,<4.0
10
11
  Classifier: Development Status :: 5 - Production/Stable
11
12
  Classifier: Environment :: Console
12
- Classifier: Natural Language :: English
13
- Classifier: Operating System :: OS Independent
14
13
  Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Utilities
16
14
  Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python
15
+ Classifier: Natural Language :: English
16
+ Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Programming Language :: Python :: 3 :: Only
24
- Classifier: Programming Language :: Python :: Implementation :: CPython
25
- Requires-Python: <4,>=3.8
26
- Description-Content-Type: text/markdown; charset=UTF-8
27
- License-File: LICENSE
28
- Provides-Extra: test
29
- Requires-Dist: pytest; extra == "test"
30
- Requires-Dist: dateutils; extra == "test"
31
- Requires-Dist: black; extra == "test"
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Utilities
24
+ Project-URL: Repository, https://github.com/wsinned/take-note
25
+ Description-Content-Type: text/markdown
32
26
 
33
27
  # Take Note
34
28
 
@@ -161,6 +155,14 @@ venv/bin/pytest
161
155
  deactivate
162
156
  ```
163
157
 
158
+ ## Linting
159
+
160
+ The project uses [ruff](https://github.com/charliermarsh/ruff) for linting and optionally for formatting.
161
+
162
+ ```bash
163
+ venv/bin/ruff . --config pyproject.toml
164
+ ```
165
+
164
166
  ## Build & Publish
165
167
 
166
168
  From an installed and tested venv, do the following:
@@ -179,3 +181,4 @@ venv/bin/twine upload dist/*
179
181
  Credentials for twine should be either:
180
182
  - stored in .pypirc in the [pypi] section
181
183
  - entered at the prompt, username = **token** and password = your_api_key
184
+
@@ -129,6 +129,14 @@ venv/bin/pytest
129
129
  deactivate
130
130
  ```
131
131
 
132
+ ## Linting
133
+
134
+ The project uses [ruff](https://github.com/charliermarsh/ruff) for linting and optionally for formatting.
135
+
136
+ ```bash
137
+ venv/bin/ruff . --config pyproject.toml
138
+ ```
139
+
132
140
  ## Build & Publish
133
141
 
134
142
  From an installed and tested venv, do the following:
@@ -0,0 +1,52 @@
1
+ [tool.poetry]
2
+ name = "take-note-cli"
3
+ version = "1.2.0"
4
+ description = "Create and open notes in your favourite editor."
5
+ license = "MIT"
6
+ authors = [
7
+ "wsinned <wsinned@tutanota.com>",
8
+ ]
9
+ readme = "README.md"
10
+ homepage = "https://github.com/wsinned/take-note"
11
+ repository = "https://github.com/wsinned/take-note"
12
+ keywords = ["note", "tool", "utility", "cli"]
13
+
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Environment :: Console",
17
+ "Natural Language :: English",
18
+ "Operating System :: OS Independent",
19
+ "Intended Audience :: Developers",
20
+ "Topic :: Utilities",
21
+ "License :: OSI Approved :: MIT License",
22
+ ]
23
+
24
+ packages = [
25
+ { include = "take_note_cli", from = "src" },
26
+ ]
27
+
28
+ [tool.poetry.dependencies]
29
+ python = "^3.8"
30
+
31
+ [tool.poetry.group.dev.dependencies]
32
+ pytest = "^7.4.3"
33
+ dateutils = "^0.6.12"
34
+ ruff = "^0.1.4"
35
+
36
+ [tool.poetry.scripts]
37
+ take-note = "take_note_cli.__main__:main"
38
+
39
+ [build-system]
40
+ requires = ["poetry-core"]
41
+ build-backend = "poetry.core.masonry.api"
42
+
43
+ [tool.pytest.ini_options]
44
+ pythonpath = [
45
+ "src"
46
+ ]
47
+
48
+ [tool.ruff]
49
+ src = ["src"]
50
+
51
+ [tool.ruff.per-file-ignores]
52
+
@@ -1,10 +1,8 @@
1
1
  import sys
2
- from takenote.core import notes
2
+ from take_note_cli.core import notes
3
3
 
4
4
 
5
5
  def main():
6
- print("Welcome to take-note-cli.")
7
-
8
6
  notes.main(sys.argv[1:])
9
7
 
10
8
 
@@ -1,17 +1,17 @@
1
- from datetime import date, timedelta
1
+ from datetime import date
2
2
  import sys
3
- from takenote.utils.paths import (
3
+ from take_note_cli.utils.paths import (
4
4
  generate_note_folder,
5
5
  generate_note_path,
6
6
  generate_template_path,
7
7
  )
8
- from takenote.utils.dates import (
8
+ from take_note_cli.utils.dates import (
9
9
  get_monday,
10
10
  get_time_delta_from_options,
11
11
  format_header_date,
12
12
  get_weeks_delta,
13
13
  )
14
- from takenote.utils.args import process_args
14
+ from take_note_cli.utils.args import process_args
15
15
  from subprocess import call
16
16
 
17
17
 
@@ -50,35 +50,51 @@ def get_path_for_file(week: date, folder_path):
50
50
  def create_batch_of_files(options, week, template_path):
51
51
  initial_note_path = None
52
52
  if options.batch is not None:
53
- for i in range(1, options.batch):
53
+ for i in range(options.batch):
54
54
  batch_week = week + get_weeks_delta(i)
55
55
  note_path, file_exists = get_path_for_file(batch_week, options.notesFolder)
56
- if i == 1:
56
+ if i == 0:
57
57
  initial_note_path = note_path
58
58
 
59
59
  if not file_exists:
60
60
  if options.verbose:
61
61
  print(f"Creating file: {note_path}")
62
62
  create_file(note_path, template_path, batch_week)
63
+ else:
64
+ initial_note_path, file_exists = get_path_for_file(week, options.notesFolder)
65
+ if not file_exists:
66
+ if options.verbose:
67
+ print(f"Creating file: {initial_note_path}")
68
+ create_file(initial_note_path, template_path, week)
69
+
63
70
  return initial_note_path
64
71
 
65
72
 
66
- def open_file(folder_path, editor, note_file, workspace=None):
73
+ def open_file(folder_path, editor, note_file, verbose, workspace=None):
67
74
  args = [editor, note_file]
68
75
  if workspace:
69
76
  args.append(folder_path.joinpath(workspace))
70
77
 
78
+ if verbose:
79
+ print(f"Opening file with args: {args}")
80
+
71
81
  call(args)
72
82
 
73
83
 
74
84
  def main(argv):
85
+ template_path = None
75
86
  options, parser = process_args(argv)
87
+
76
88
  if options.verbose:
89
+ print("Welcome to take-note-cli")
77
90
  print(options)
78
91
 
79
92
  delta = calculate_week_offset(options, parser)
80
93
  week = get_monday(date.today()) + delta
81
- template_path = generate_template_path(options.notesFolder, options.template)
94
+
95
+ if options.template is not None:
96
+ template_path = generate_template_path(options.notesFolder, options.template)
97
+
82
98
  note_path = create_batch_of_files(options, week, template_path)
83
99
 
84
- open_file(options.notesFolder, options.editor, note_path, options.workspace)
100
+ open_file(options.notesFolder, options.editor, note_path, options.verbose, options.workspace)
@@ -1,19 +1,20 @@
1
1
  import argparse
2
2
  import pathlib
3
- from sys import exit
4
- import takenote.__version__
3
+ import importlib.metadata
4
+
5
+ __version__ = importlib.metadata.version("take-note-cli")
5
6
 
6
7
 
7
8
  def init_argparse() -> argparse.ArgumentParser:
8
- help_text = """Create a notes file for the requested
9
- week."""
9
+ help_text = """Create a notes file for the requested
10
+ week."""
10
11
 
11
12
  parser = argparse.ArgumentParser(usage="%(prog)s [OPTIONS]", description=help_text)
12
13
  parser.add_argument(
13
14
  "-v",
14
15
  "--version",
15
16
  action="version",
16
- version=f"{parser.prog} version {takenote.__version__}",
17
+ version=f"{parser.prog} version {__version__}",
17
18
  )
18
19
  parser.add_argument(
19
20
  "--verbose",
@@ -26,7 +27,8 @@ def init_argparse() -> argparse.ArgumentParser:
26
27
  default=pathlib.Path.home().joinpath("Notes"),
27
28
  type=pathlib.Path,
28
29
  help="""The root path for the notes folder.
29
- If not supplied this defaults to the Notes folder in the users home folder.""",
30
+ If not supplied this defaults to the Notes
31
+ folder in the users home folder.""",
30
32
  )
31
33
  parser.add_argument(
32
34
  "--editor",
@@ -38,7 +40,8 @@ def init_argparse() -> argparse.ArgumentParser:
38
40
  "--workspace",
39
41
  default=None,
40
42
  help="""The VSCode workspace to open along with the notes.
41
- If supplied this overrides the --editor option to 'code' for Visual Studio Code""",
43
+ If supplied this overrides the --editor option to 'code'
44
+ for Visual Studio Code""",
42
45
  )
43
46
  parser.add_argument(
44
47
  "--thisWeek",
@@ -16,9 +16,8 @@ def format_file_date(the_date: date):
16
16
 
17
17
 
18
18
  def get_time_delta_from_options(options):
19
- if options.thisWeek:
20
- delta = timedelta(0)
21
- elif options.lastWeek:
19
+ delta = timedelta(0)
20
+ if options.lastWeek:
22
21
  delta = timedelta(-WEEK)
23
22
  elif options.nextWeek:
24
23
  delta = timedelta(WEEK)
@@ -27,7 +26,7 @@ def get_time_delta_from_options(options):
27
26
 
28
27
 
29
28
  def get_weeks_delta(weeks: int):
30
- if weeks >= 1:
29
+ if weeks >= 0:
31
30
  return timedelta(WEEK * weeks)
32
31
  else:
33
- raise ValueError("Batch size must be 1 or greater.")
32
+ raise ValueError("Batch size must be 0 or greater.")
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
  from datetime import date
3
- from takenote.utils.dates import format_file_date
3
+ from take_note_cli.utils.dates import format_file_date
4
4
 
5
5
 
6
6
  def generate_note_path(week: date):
@@ -1 +0,0 @@
1
- include LICENSE *.md
@@ -1,181 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: take-note-cli
3
- Version: 1.1.0
4
- Summary: Create and open notes in your favourite editor.
5
- Home-page: https://github.com/wsinned/take-note
6
- Author: wsinned
7
- Author-email: wsinned@tutanota.com
8
- Project-URL: Source, https://github.com/wsinned/take-note
9
- Keywords: note tool utility cli
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Environment :: Console
12
- Classifier: Natural Language :: English
13
- Classifier: Operating System :: OS Independent
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Utilities
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.8
20
- Classifier: Programming Language :: Python :: 3.9
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Programming Language :: Python :: 3 :: Only
24
- Classifier: Programming Language :: Python :: Implementation :: CPython
25
- Requires-Python: <4,>=3.8
26
- Description-Content-Type: text/markdown; charset=UTF-8
27
- License-File: LICENSE
28
- Provides-Extra: test
29
- Requires-Dist: pytest; extra == "test"
30
- Requires-Dist: dateutils; extra == "test"
31
- Requires-Dist: black; extra == "test"
32
-
33
- # Take Note
34
-
35
- **Create and open notes in your favourite editor.**
36
-
37
- ## Features
38
-
39
- - Written in Python with no runtime dependencies.
40
- - Works on Python 3.8 - 3.11.
41
- - Open notes files for specified week using the `code` command line for VS Code.
42
- - --thisWeek, --lastWeek and --nextWeek are supported.
43
- - Organises notes in a date based folder structure from your root notes folder, e.g. 2023/08
44
- - set the root notes folder using --notesFolder
45
- - Choose which editor to use with --editor
46
- - Specify a VS Code workspace to open along with the note file with --workspace
47
- - This will override the --editor setting to `code`
48
- - 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.
49
- - 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.
50
-
51
- ## Future features
52
-
53
- - Support for daily notes options.
54
-
55
- ## Installation
56
-
57
- ### pipx
58
-
59
- The recommended way to install the published package is through [pipx](https://pypa.github.io/pipx/).
60
-
61
- ```bash
62
- # from PyPI
63
- pipx install take-note-cli
64
-
65
- # direct from github
66
- pipx install git+https://github.com/wsinned/take-note
67
- ```
68
-
69
- ## Usage
70
-
71
- ### Command Line
72
-
73
- Specify a folder using the --notesFolder option, otherwise $HOME/Notes will be used
74
- A week option must be supplied from --thisWeek, --lastWeek or --nextWeek
75
-
76
- ```bash
77
- take-note --notesFolder=$HOME/MyNotes --thisWeek
78
- ```
79
-
80
- 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
81
-
82
- ### Aliases
83
-
84
- Setting up aliases in you preferred shell is a great way to make accessing your notes quick and easy.
85
-
86
- ```bash
87
- notes_folder="$HOME/SomePath/MyNotes"
88
- args="--notesFolder $notes_folder --workspace notes.code-workspace --template Home-weekly-log-template.md"
89
-
90
- alias thisWeek="take-note --thisWeek $args"
91
- alias nextWeek="take-note --nextWeek $args"
92
- alias lastWeek="take-note --lastWeek $args"
93
- ```
94
-
95
- All you have to do now is type one of the following to open the desired note file.
96
-
97
- ```bash
98
- > thisWeek
99
- > lastWeek
100
- > nextWeek
101
- ```
102
-
103
- ## Other Installation Methods
104
-
105
- ### Virtual Environment
106
-
107
- ```bash
108
- python -m venv venv
109
-
110
- source venv/bin/activate
111
-
112
- venv/bin/pip install -r requirements.txt
113
-
114
- # install with tests as editable src
115
- venv/bin/pip install -e .
116
-
117
- ```
118
-
119
- ## Development
120
-
121
- ### Nix & NixOS
122
-
123
- The supplied shell.nix definition provides support for entering a nix-shell directly in the repository with all dependencies.
124
-
125
- ```zsh
126
- nix-shell --run zsh # ensure using zsh over default bash session
127
-
128
- # only needed once, or to recreate the virtual environment
129
- python -m venv venv
130
-
131
- source venv/bin/activate
132
-
133
- # install with tests as editable src
134
- venv/bin/pip install -e '.[test]'
135
-
136
- # run the tests
137
- pytest
138
-
139
- # close the virtual environment and exit the shell when done
140
- deactivate
141
- exit
142
- ```
143
-
144
- ### Other Linux or macOS
145
-
146
- ```zsh
147
- # only needed once, or to recreate the virtual environment
148
- python -m venv venv
149
-
150
- source venv/bin/activate
151
-
152
- venv/bin/pip install -r requirements.txt -r requirements.dev.txt
153
-
154
- # install with tests as editable src
155
- venv/bin/pip install -e '.[test]'
156
-
157
- # run the tests
158
- venv/bin/pytest
159
-
160
- # close the virtual environment when done
161
- deactivate
162
- ```
163
-
164
- ## Build & Publish
165
-
166
- From an installed and tested venv, do the following:
167
-
168
- ```bash
169
- # check the version:
170
- cat src/takenote/__version__.py
171
-
172
- # build the package
173
- venv/bin/pyproject-build
174
-
175
- # publish the package
176
- venv/bin/twine upload dist/*
177
- ```
178
-
179
- Credentials for twine should be either:
180
- - stored in .pypirc in the [pypi] section
181
- - entered at the prompt, username = **token** and password = your_api_key
@@ -1,8 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=40.8.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [tool.pytest.ini_options]
6
- pythonpath = [
7
- "src"
8
- ]
@@ -1,54 +0,0 @@
1
- [metadata]
2
- name = take-note-cli
3
- version = attr: takenote.__version__
4
- description = Create and open notes in your favourite editor.
5
- long_description = file: README.md
6
- long_description_content_type = text/markdown; charset=UTF-8
7
- license_files = LICENSE
8
- author = wsinned
9
- author_email = wsinned@tutanota.com
10
- url = https://github.com/wsinned/take-note
11
- project_urls =
12
- Source = https://github.com/wsinned/take-note
13
- keywords = note tool utility cli
14
- classifiers =
15
- Development Status :: 5 - Production/Stable
16
- Environment :: Console
17
- Natural Language :: English
18
- Operating System :: OS Independent
19
- Intended Audience :: Developers
20
- Topic :: Utilities
21
- License :: OSI Approved :: MIT License
22
- Programming Language :: Python
23
- Programming Language :: Python :: 3
24
- Programming Language :: Python :: 3.8
25
- Programming Language :: Python :: 3.9
26
- Programming Language :: Python :: 3.10
27
- Programming Language :: Python :: 3.11
28
- Programming Language :: Python :: 3 :: Only
29
- Programming Language :: Python :: Implementation :: CPython
30
-
31
- [options.packages.find]
32
- where = src
33
-
34
- [options]
35
- package_dir =
36
- = src
37
- packages = find:
38
- include_package_data = True
39
- python_requires = >=3.8, <4
40
-
41
- [options.extras_require]
42
- test =
43
- pytest
44
- dateutils
45
- black
46
-
47
- [options.entry_points]
48
- console_scripts =
49
- take-note = takenote.__main__:main
50
-
51
- [egg_info]
52
- tag_build =
53
- tag_date = 0
54
-
@@ -1,20 +0,0 @@
1
- LICENSE
2
- MANIFEST.in
3
- README.md
4
- pyproject.toml
5
- setup.cfg
6
- src/take_note_cli.egg-info/PKG-INFO
7
- src/take_note_cli.egg-info/SOURCES.txt
8
- src/take_note_cli.egg-info/dependency_links.txt
9
- src/take_note_cli.egg-info/entry_points.txt
10
- src/take_note_cli.egg-info/requires.txt
11
- src/take_note_cli.egg-info/top_level.txt
12
- src/takenote/__init__.py
13
- src/takenote/__main__.py
14
- src/takenote/__version__.py
15
- src/takenote/core/__init__.py
16
- src/takenote/core/notes.py
17
- src/takenote/utils/__init__.py
18
- src/takenote/utils/args.py
19
- src/takenote/utils/dates.py
20
- src/takenote/utils/paths.py
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- take-note = takenote.__main__:main
@@ -1,5 +0,0 @@
1
-
2
- [test]
3
- pytest
4
- dateutils
5
- black
@@ -1 +0,0 @@
1
- from . __version__ import __version__
@@ -1 +0,0 @@
1
- __version__ = '1.1.0'
File without changes