convert-docs 0.2.0__tar.gz → 0.4.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.
- convert_docs-0.4.0/PKG-INFO +99 -0
- convert_docs-0.4.0/README.md +91 -0
- {convert_docs-0.2.0 → convert_docs-0.4.0}/pyproject.toml +5 -2
- convert_docs-0.4.0/src/convert_docs/cli.py +578 -0
- convert_docs-0.4.0/tests/test_cli.py +451 -0
- convert_docs-0.4.0/uv.lock +1455 -0
- convert_docs-0.2.0/PKG-INFO +0 -76
- convert_docs-0.2.0/README.md +0 -68
- convert_docs-0.2.0/src/convert_docs/cli.py +0 -237
- {convert_docs-0.2.0 → convert_docs-0.4.0}/.github/workflows/publish.yml +0 -0
- {convert_docs-0.2.0 → convert_docs-0.4.0}/.gitignore +0 -0
- {convert_docs-0.2.0 → convert_docs-0.4.0}/src/convert_docs/__init__.py +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: convert-docs
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Convert documents (pdf, docx, pptx, xlsx, ...) to Markdown via markitdown, recursively for a folder or directly for a single file.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: markitdown[docx,outlook,pdf,pptx,xls,xlsx]>=0.1.5
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# convert-docs
|
|
10
|
+
|
|
11
|
+
Convert documents (pdf, docx, pptx, xlsx, and more) to Markdown via
|
|
12
|
+
[markitdown](https://github.com/microsoft/markitdown). Point it at a folder and it
|
|
13
|
+
recursively converts everything, mirroring the structure into a destination folder;
|
|
14
|
+
point it at a single file and it converts just that file.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Requires Python 3.10+.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uv tool install convert-docs
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Don't have [uv](https://docs.astral.sh/uv/)? Install it first:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
|
|
28
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or skip uv entirely and use pip: `pip install convert-docs`
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
Run with no flags for an interactive prompt (asks for source, then destination):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
convert-docs
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Tip (macOS): select a file or folder in Finder and press `Option+Command+C` to copy
|
|
42
|
+
its full path, then paste it into the prompt.
|
|
43
|
+
|
|
44
|
+
Pointing it at a single file converts just that file, writing the `.md` next to it by
|
|
45
|
+
default. To use a different output name, append a comma and the new name at the source
|
|
46
|
+
prompt: `~/Downloads/Report.pdf, quarterly-summary` writes `quarterly-summary.md`.
|
|
47
|
+
|
|
48
|
+
Or pass flags to skip the prompts:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
convert-docs -s ~/Documents/Reports -o ~/Documents/Reports_MD
|
|
52
|
+
convert-docs -e pdf,docx # restrict which extensions get converted
|
|
53
|
+
convert-docs -f # force re-conversion, ignoring the up-to-date skip
|
|
54
|
+
convert-docs --last # re-run with the same source/destination/extensions as last time
|
|
55
|
+
convert-docs -j 8 # convert 8 files in parallel instead of the default 4
|
|
56
|
+
convert-docs -n # dry run: show what would happen, write nothing
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Flag | Description |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `-s, --source` | Source file or directory to convert (skips the interactive prompt) |
|
|
62
|
+
| `-o, --output` | Output directory (mirrors source structure), or for a single-file source, an output directory or file path (skips the interactive prompt) |
|
|
63
|
+
| `-e, --ext` | Comma-separated extensions to convert |
|
|
64
|
+
| `-f, --force` | Force re-conversion even if output `.md` already exists and is up to date |
|
|
65
|
+
| `-l, --last` | Reuse the source, destination, and extensions from the last run (skips prompts; cannot be combined with `-s`/`-o`) |
|
|
66
|
+
| `-j, --jobs` | Convert this many files in parallel using separate processes (default: `min(4, cpu_count)`; use `1` for sequential) |
|
|
67
|
+
| `-n, --dry-run` | Show what would be converted, skipped, or collide, without writing anything |
|
|
68
|
+
| `--log-file` | Append this run's output to a file as well as stdout |
|
|
69
|
+
| `--version` | Print the installed version and exit |
|
|
70
|
+
|
|
71
|
+
Files with unsupported extensions are listed at the end instead of being silently
|
|
72
|
+
skipped, and any conversion failures are reported with the underlying error.
|
|
73
|
+
Common noise directories (`.git`, `node_modules`, `.venv`, `__pycache__`, etc.) are
|
|
74
|
+
skipped automatically. If two source files would produce the same output path (e.g.
|
|
75
|
+
`report.docx` and `report.pdf` both map to `report.md`), the first is converted and
|
|
76
|
+
the rest are reported as collisions rather than silently overwritten.
|
|
77
|
+
|
|
78
|
+
Paths are highlighted in supported terminals; set `NO_COLOR=1` to disable.
|
|
79
|
+
|
|
80
|
+
### Re-running on new files
|
|
81
|
+
|
|
82
|
+
Every run saves its source/destination/extensions to `~/.config/convert-docs/last_run.json`.
|
|
83
|
+
Since conversion already skips files whose output is up to date, `convert-docs --last` is a
|
|
84
|
+
cheap way to pick up newly added files in a folder you've converted before — run it manually
|
|
85
|
+
whenever you want to sync, or wire it into a cron job / scheduled task on whatever interval
|
|
86
|
+
suits you (just point it at the tool's full path, e.g. `~/.local/bin/convert-docs --last`,
|
|
87
|
+
since scheduled jobs don't load your shell profile).
|
|
88
|
+
|
|
89
|
+
## Update
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uv tool upgrade convert-docs
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uv run pytest
|
|
99
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# convert-docs
|
|
2
|
+
|
|
3
|
+
Convert documents (pdf, docx, pptx, xlsx, and more) to Markdown via
|
|
4
|
+
[markitdown](https://github.com/microsoft/markitdown). Point it at a folder and it
|
|
5
|
+
recursively converts everything, mirroring the structure into a destination folder;
|
|
6
|
+
point it at a single file and it converts just that file.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Requires Python 3.10+.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv tool install convert-docs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Don't have [uv](https://docs.astral.sh/uv/)? Install it first:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
|
|
20
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or skip uv entirely and use pip: `pip install convert-docs`
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Run with no flags for an interactive prompt (asks for source, then destination):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
convert-docs
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Tip (macOS): select a file or folder in Finder and press `Option+Command+C` to copy
|
|
34
|
+
its full path, then paste it into the prompt.
|
|
35
|
+
|
|
36
|
+
Pointing it at a single file converts just that file, writing the `.md` next to it by
|
|
37
|
+
default. To use a different output name, append a comma and the new name at the source
|
|
38
|
+
prompt: `~/Downloads/Report.pdf, quarterly-summary` writes `quarterly-summary.md`.
|
|
39
|
+
|
|
40
|
+
Or pass flags to skip the prompts:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
convert-docs -s ~/Documents/Reports -o ~/Documents/Reports_MD
|
|
44
|
+
convert-docs -e pdf,docx # restrict which extensions get converted
|
|
45
|
+
convert-docs -f # force re-conversion, ignoring the up-to-date skip
|
|
46
|
+
convert-docs --last # re-run with the same source/destination/extensions as last time
|
|
47
|
+
convert-docs -j 8 # convert 8 files in parallel instead of the default 4
|
|
48
|
+
convert-docs -n # dry run: show what would happen, write nothing
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Flag | Description |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `-s, --source` | Source file or directory to convert (skips the interactive prompt) |
|
|
54
|
+
| `-o, --output` | Output directory (mirrors source structure), or for a single-file source, an output directory or file path (skips the interactive prompt) |
|
|
55
|
+
| `-e, --ext` | Comma-separated extensions to convert |
|
|
56
|
+
| `-f, --force` | Force re-conversion even if output `.md` already exists and is up to date |
|
|
57
|
+
| `-l, --last` | Reuse the source, destination, and extensions from the last run (skips prompts; cannot be combined with `-s`/`-o`) |
|
|
58
|
+
| `-j, --jobs` | Convert this many files in parallel using separate processes (default: `min(4, cpu_count)`; use `1` for sequential) |
|
|
59
|
+
| `-n, --dry-run` | Show what would be converted, skipped, or collide, without writing anything |
|
|
60
|
+
| `--log-file` | Append this run's output to a file as well as stdout |
|
|
61
|
+
| `--version` | Print the installed version and exit |
|
|
62
|
+
|
|
63
|
+
Files with unsupported extensions are listed at the end instead of being silently
|
|
64
|
+
skipped, and any conversion failures are reported with the underlying error.
|
|
65
|
+
Common noise directories (`.git`, `node_modules`, `.venv`, `__pycache__`, etc.) are
|
|
66
|
+
skipped automatically. If two source files would produce the same output path (e.g.
|
|
67
|
+
`report.docx` and `report.pdf` both map to `report.md`), the first is converted and
|
|
68
|
+
the rest are reported as collisions rather than silently overwritten.
|
|
69
|
+
|
|
70
|
+
Paths are highlighted in supported terminals; set `NO_COLOR=1` to disable.
|
|
71
|
+
|
|
72
|
+
### Re-running on new files
|
|
73
|
+
|
|
74
|
+
Every run saves its source/destination/extensions to `~/.config/convert-docs/last_run.json`.
|
|
75
|
+
Since conversion already skips files whose output is up to date, `convert-docs --last` is a
|
|
76
|
+
cheap way to pick up newly added files in a folder you've converted before — run it manually
|
|
77
|
+
whenever you want to sync, or wire it into a cron job / scheduled task on whatever interval
|
|
78
|
+
suits you (just point it at the tool's full path, e.g. `~/.local/bin/convert-docs --last`,
|
|
79
|
+
since scheduled jobs don't load your shell profile).
|
|
80
|
+
|
|
81
|
+
## Update
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv tool upgrade convert-docs
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
uv run pytest
|
|
91
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "convert-docs"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.4.0"
|
|
4
|
+
description = "Convert documents (pdf, docx, pptx, xlsx, ...) to Markdown via markitdown, recursively for a folder or directly for a single file."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
dependencies = [
|
|
@@ -11,6 +11,9 @@ dependencies = [
|
|
|
11
11
|
[project.scripts]
|
|
12
12
|
convert-docs = "convert_docs.cli:main"
|
|
13
13
|
|
|
14
|
+
[dependency-groups]
|
|
15
|
+
dev = ["pytest>=8"]
|
|
16
|
+
|
|
14
17
|
[build-system]
|
|
15
18
|
requires = ["hatchling"]
|
|
16
19
|
build-backend = "hatchling.build"
|