checkmarks 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Meni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: checkmarks
3
+ Version: 0.1.0
4
+ Summary: A simple CLI for tracking progress with markdown checklists
5
+ Author-email: menisadi <menisadi@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Meni
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Keywords: cli,markdown,checklists
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: license-file
32
+
33
+ # Checkmarks
34
+
35
+ A simple command-line tool to check the progress of tasks in a Markdown checklist. It scans a `.md` file for checklist items (of the form `- [ ]` and `- [x]`) and displays a progress bar.
36
+
37
+ ## Features
38
+
39
+ - Identifies completed (`- [x]`) and pending (`- [ ]`) tasks in a Markdown file.
40
+ - Calculates the number of tasks done vs. total tasks.
41
+ - Optionally displays the title from the first `# Heading` in the file.
42
+ - Shows a handy progress bar with completion percentage.
43
+
44
+ ## Installation
45
+
46
+ 1. Make sure you have Python 3.7+ installed.
47
+ 2. Clone or download this repository.
48
+
49
+
50
+ ## Usage
51
+
52
+ ```bash
53
+ python checkmarks.py /path/to/your_checklist.md
54
+ ```
55
+
56
+ ## Example
57
+
58
+ Suppose you have a file named todo.md with the following content:
59
+ ```markdown
60
+ # My Todo List
61
+
62
+ - [ ] Buy groceries
63
+ - [x] Write blog post
64
+ - [ ] Go running
65
+ ```
66
+
67
+ Running python checkmarks.py todo.md will produce output like:
68
+ ```
69
+ 📊 Progress for:
70
+ My Todo List
71
+ [█-------] 1/3 tasks completed (33.3%)
72
+ ```
73
+
74
+ ## Contributing
75
+
76
+ Feel free to submit issues or pull requests. This is a small tool, so contributions are always welcome.
77
+
78
+ ## License
79
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,47 @@
1
+ # Checkmarks
2
+
3
+ A simple command-line tool to check the progress of tasks in a Markdown checklist. It scans a `.md` file for checklist items (of the form `- [ ]` and `- [x]`) and displays a progress bar.
4
+
5
+ ## Features
6
+
7
+ - Identifies completed (`- [x]`) and pending (`- [ ]`) tasks in a Markdown file.
8
+ - Calculates the number of tasks done vs. total tasks.
9
+ - Optionally displays the title from the first `# Heading` in the file.
10
+ - Shows a handy progress bar with completion percentage.
11
+
12
+ ## Installation
13
+
14
+ 1. Make sure you have Python 3.7+ installed.
15
+ 2. Clone or download this repository.
16
+
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ python checkmarks.py /path/to/your_checklist.md
22
+ ```
23
+
24
+ ## Example
25
+
26
+ Suppose you have a file named todo.md with the following content:
27
+ ```markdown
28
+ # My Todo List
29
+
30
+ - [ ] Buy groceries
31
+ - [x] Write blog post
32
+ - [ ] Go running
33
+ ```
34
+
35
+ Running python checkmarks.py todo.md will produce output like:
36
+ ```
37
+ 📊 Progress for:
38
+ My Todo List
39
+ [█-------] 1/3 tasks completed (33.3%)
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ Feel free to submit issues or pull requests. This is a small tool, so contributions are always welcome.
45
+
46
+ ## License
47
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
File without changes
@@ -0,0 +1,58 @@
1
+ import argparse
2
+ import re
3
+ from pathlib import Path
4
+
5
+
6
+ def parse_checklist(file_path: Path) -> tuple[int, int, str | None]:
7
+ """Parses a markdown checklist file and returns task counts and optional title."""
8
+ with file_path.open("r", encoding="utf-8") as f:
9
+ content = f.read()
10
+
11
+ # Find all checklist items
12
+ all_tasks: list[str] = re.findall(r"- \[( |x)\] ", content)
13
+ total: int = len(all_tasks)
14
+ done: int = sum(1 for t in all_tasks if t == "x")
15
+
16
+ # Try to extract the first level-1 heading as the title
17
+ title_match = re.search(r"^# (.+)", content, re.MULTILINE)
18
+ title: str | None = title_match.group(1).strip() if title_match else None
19
+
20
+ return done, total, title
21
+
22
+
23
+ def show_progress(
24
+ done: int, total: int, title: str | None = None, bar_length: int = 40
25
+ ) -> None:
26
+ """Displays a progress bar in the terminal, optionally with a custom title."""
27
+ percent: float = (done / total) * 100 if total else 0
28
+ filled_length: int = int(bar_length * done // total) if total else 0
29
+ bar: str = "█" * filled_length + "-" * (bar_length - filled_length)
30
+
31
+ heading: str = (
32
+ f"📊 Progress for:\n{title}" if title else "📊 Checklist Progress"
33
+ )
34
+ print(f"\n{heading}")
35
+ print(f"[{bar}] {done}/{total} tasks completed ({percent:.1f}%)\n")
36
+
37
+
38
+ def main() -> None:
39
+ """Main entry point for the CLI."""
40
+ parser = argparse.ArgumentParser(
41
+ description="Track Markdown checklist progress"
42
+ )
43
+ parser.add_argument(
44
+ "markdown_file", type=str, help="Path to your checklist .md file"
45
+ )
46
+ args = parser.parse_args()
47
+
48
+ md_path: Path = Path(args.markdown_file)
49
+ if not md_path.exists():
50
+ print(f"❌ File not found: {md_path}")
51
+ return
52
+
53
+ done, total, title = parse_checklist(md_path)
54
+ show_progress(done, total, title)
55
+
56
+
57
+ if __name__ == "__main__":
58
+ main()
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: checkmarks
3
+ Version: 0.1.0
4
+ Summary: A simple CLI for tracking progress with markdown checklists
5
+ Author-email: menisadi <menisadi@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Meni
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Keywords: cli,markdown,checklists
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: license-file
32
+
33
+ # Checkmarks
34
+
35
+ A simple command-line tool to check the progress of tasks in a Markdown checklist. It scans a `.md` file for checklist items (of the form `- [ ]` and `- [x]`) and displays a progress bar.
36
+
37
+ ## Features
38
+
39
+ - Identifies completed (`- [x]`) and pending (`- [ ]`) tasks in a Markdown file.
40
+ - Calculates the number of tasks done vs. total tasks.
41
+ - Optionally displays the title from the first `# Heading` in the file.
42
+ - Shows a handy progress bar with completion percentage.
43
+
44
+ ## Installation
45
+
46
+ 1. Make sure you have Python 3.7+ installed.
47
+ 2. Clone or download this repository.
48
+
49
+
50
+ ## Usage
51
+
52
+ ```bash
53
+ python checkmarks.py /path/to/your_checklist.md
54
+ ```
55
+
56
+ ## Example
57
+
58
+ Suppose you have a file named todo.md with the following content:
59
+ ```markdown
60
+ # My Todo List
61
+
62
+ - [ ] Buy groceries
63
+ - [x] Write blog post
64
+ - [ ] Go running
65
+ ```
66
+
67
+ Running python checkmarks.py todo.md will produce output like:
68
+ ```
69
+ 📊 Progress for:
70
+ My Todo List
71
+ [█-------] 1/3 tasks completed (33.3%)
72
+ ```
73
+
74
+ ## Contributing
75
+
76
+ Feel free to submit issues or pull requests. This is a small tool, so contributions are always welcome.
77
+
78
+ ## License
79
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ checkmarks/__init__.py
5
+ checkmarks/cli.py
6
+ checkmarks.egg-info/PKG-INFO
7
+ checkmarks.egg-info/SOURCES.txt
8
+ checkmarks.egg-info/dependency_links.txt
9
+ checkmarks.egg-info/entry_points.txt
10
+ checkmarks.egg-info/top_level.txt
11
+ tests/test_cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ checkmarks = checkmarks.cli:main
@@ -0,0 +1 @@
1
+ checkmarks
@@ -0,0 +1,18 @@
1
+ [project]
2
+ name = "checkmarks"
3
+ version = "0.1.0"
4
+ description = "A simple CLI for tracking progress with markdown checklists"
5
+ authors = [
6
+ { name = "menisadi", email = "menisadi@gmail.com" }
7
+ ]
8
+
9
+ readme = "README.md"
10
+
11
+ license = { file = "LICENSE" }
12
+
13
+ keywords = ["cli", "markdown", "checklists"]
14
+
15
+ dependencies = []
16
+
17
+ [project.scripts]
18
+ checkmarks = "checkmarks.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,107 @@
1
+ import pytest
2
+ import re
3
+ from pathlib import Path
4
+ from checkmarks.cli import parse_checklist, show_progress, main
5
+
6
+
7
+ # Pytest can create and manage temporary files/directories via the 'tmp_path' fixture
8
+ def test_parse_checklist_no_tasks(tmp_path: Path):
9
+ # Create an empty markdown file
10
+ md_file = tmp_path / "empty_checklist.md"
11
+ md_file.write_text("", encoding="utf-8")
12
+
13
+ done, total, title = parse_checklist(md_file)
14
+ assert done == 0
15
+ assert total == 0
16
+ assert title is None
17
+
18
+
19
+ def test_parse_checklist_with_tasks(tmp_path: Path):
20
+ # A sample markdown with tasks and a level-1 heading
21
+ content = """# My Checklist
22
+
23
+ - [ ] Task 1
24
+ - [x] Task 2
25
+ - [x] Task 3
26
+ - [ ] Task 4
27
+ """
28
+ md_file = tmp_path / "tasks.md"
29
+ md_file.write_text(content, encoding="utf-8")
30
+
31
+ done, total, title = parse_checklist(md_file)
32
+ # We expect 2 done tasks, 4 total tasks, and the title "My Checklist"
33
+ assert done == 2
34
+ assert total == 4
35
+ assert title == "My Checklist"
36
+
37
+
38
+ def test_parse_checklist_no_title(tmp_path: Path):
39
+ # A file with tasks but no H1 heading
40
+ content = """- [ ] Task A
41
+ - [x] Task B
42
+ """
43
+ md_file = tmp_path / "notitle.md"
44
+ md_file.write_text(content, encoding="utf-8")
45
+
46
+ done, total, title = parse_checklist(md_file)
47
+ assert done == 1
48
+ assert total == 2
49
+ assert title is None
50
+
51
+
52
+ def test_show_progress_output(capsys):
53
+ # Test that show_progress prints the correct bar and summary
54
+ show_progress(done=3, total=5, title="Test Title", bar_length=10)
55
+
56
+ # capsys captures stdout/stderr output in pytest
57
+ captured = capsys.readouterr()
58
+ output = captured.out
59
+
60
+ # Check that certain strings/patterns appear in the output
61
+ assert "Test Title" in output
62
+ assert "3/5 tasks completed" in output
63
+ # Check for the ASCII bar
64
+ # We expect 3 out of 5 => 60%, so bar_length=10 => 6 "█" if rounding down
65
+ # Actually the code does integer math with //, so 3 * 10 // 5 = 6.
66
+ assert re.search(r"\[█{6}-{4}\]", output) is not None
67
+ assert "(60.0%)" in output
68
+
69
+
70
+ @pytest.mark.parametrize(
71
+ "done,total,percent_str",
72
+ [
73
+ (0, 0, "(0.0%)"), # edge case: no tasks
74
+ (0, 5, "(0.0%)"), # none done
75
+ (5, 5, "(100.0%)"), # all done
76
+ ],
77
+ )
78
+ def test_show_progress_edge_cases(done, total, percent_str, capsys):
79
+ show_progress(done, total, title=None, bar_length=10)
80
+ output = capsys.readouterr().out
81
+ # Just check the percentage part is correct
82
+ assert percent_str in output
83
+
84
+
85
+ def test_main_file_not_found(monkeypatch, capsys):
86
+ # We'll pretend the user ran: `checklist not_a_file.md`
87
+ test_args = ["checklist", "not_a_file.md"]
88
+ monkeypatch.setattr("sys.argv", test_args)
89
+
90
+ main()
91
+ output = capsys.readouterr().out
92
+ assert "❌ File not found: not_a_file.md" in output
93
+
94
+
95
+ def test_main_valid_file(monkeypatch, capsys, tmp_path):
96
+ # Create a temporary markdown file
97
+ md_file = tmp_path / "test.md"
98
+ md_file.write_text("# Title\n- [ ] One\n- [x] Two", encoding="utf-8")
99
+
100
+ # We'll pretend the user ran: `checklist test.md`
101
+ test_args = ["checklist", str(md_file)]
102
+ monkeypatch.setattr("sys.argv", test_args)
103
+
104
+ main()
105
+ output = capsys.readouterr().out
106
+ assert "Title" in output
107
+ assert "1/2 tasks completed" in output