convert-docs 0.3.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.3.0 → convert_docs-0.4.0}/PKG-INFO +36 -29
- {convert_docs-0.3.0 → convert_docs-0.4.0}/README.md +34 -27
- {convert_docs-0.3.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.3.0/src/convert_docs/cli.py +0 -288
- {convert_docs-0.3.0 → convert_docs-0.4.0}/.github/workflows/publish.yml +0 -0
- {convert_docs-0.3.0 → convert_docs-0.4.0}/.gitignore +0 -0
- {convert_docs-0.3.0 → convert_docs-0.4.0}/src/convert_docs/__init__.py +0 -0
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: convert-docs
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
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
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: markitdown[docx,outlook,pdf,pptx,xls,xlsx]>=0.1.5
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
|
|
9
9
|
# convert-docs
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
[markitdown](https://github.com/microsoft/markitdown)
|
|
13
|
-
structure into a destination folder
|
|
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.
|
|
14
15
|
|
|
15
16
|
## Install
|
|
16
17
|
|
|
17
|
-
Requires
|
|
18
|
+
Requires Python 3.10+.
|
|
18
19
|
|
|
19
20
|
```bash
|
|
20
|
-
|
|
21
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
22
|
-
|
|
23
|
-
# Windows (PowerShell)
|
|
24
|
-
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
21
|
+
uv tool install convert-docs
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
Don't have [uv](https://docs.astral.sh/uv/)? Install it first:
|
|
28
25
|
|
|
29
26
|
```bash
|
|
30
|
-
|
|
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
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
Or skip uv entirely and use pip: `pip install convert-docs`
|
|
34
32
|
|
|
35
33
|
## Usage
|
|
36
34
|
|
|
@@ -40,6 +38,13 @@ Run with no flags for an interactive prompt (asks for source, then destination):
|
|
|
40
38
|
convert-docs
|
|
41
39
|
```
|
|
42
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
|
+
|
|
43
48
|
Or pass flags to skip the prompts:
|
|
44
49
|
|
|
45
50
|
```bash
|
|
@@ -48,33 +53,29 @@ convert-docs -e pdf,docx # restrict which extensions get converted
|
|
|
48
53
|
convert-docs -f # force re-conversion, ignoring the up-to-date skip
|
|
49
54
|
convert-docs --last # re-run with the same source/destination/extensions as last time
|
|
50
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
|
|
51
57
|
```
|
|
52
58
|
|
|
53
59
|
| Flag | Description |
|
|
54
60
|
|---|---|
|
|
55
|
-
| `-s, --source` | Source directory to
|
|
56
|
-
| `-o, --output` | Output directory
|
|
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) |
|
|
57
63
|
| `-e, --ext` | Comma-separated extensions to convert |
|
|
58
64
|
| `-f, --force` | Force re-conversion even if output `.md` already exists and is up to date |
|
|
59
65
|
| `-l, --last` | Reuse the source, destination, and extensions from the last run (skips prompts; cannot be combined with `-s`/`-o`) |
|
|
60
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 |
|
|
61
70
|
|
|
62
71
|
Files with unsupported extensions are listed at the end instead of being silently
|
|
63
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.
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Files convert using separate OS processes (real parallelism across CPU cores, not
|
|
68
|
-
`asyncio` — conversion is CPU-bound parsing work, not I/O waiting, so asyncio's
|
|
69
|
-
cooperative concurrency wouldn't actually help). Benchmarked on a 10-core Mac converting
|
|
70
|
-
12–30 real docx files: `-j 4` (the default) cut wall time by ~2.3x vs. sequential.
|
|
71
|
-
Pushing higher didn't help further — `-j 8` was consistently *slower* than `-j 4` in
|
|
72
|
-
testing, since each worker process pays a fixed startup cost importing `markitdown`'s
|
|
73
|
-
dependencies (onnxruntime, magika, pandas), which outweighs the extra parallelism for
|
|
74
|
-
typical batch sizes. If you're converting a very large batch (hundreds of files), it's
|
|
75
|
-
worth experimenting with higher `-j` values yourself; for typical folders the default
|
|
76
|
-
is a reasonable balance. Progress lines print in completion order, not scan order, since
|
|
77
|
-
files finish out of sequence when running in parallel.
|
|
78
|
+
Paths are highlighted in supported terminals; set `NO_COLOR=1` to disable.
|
|
78
79
|
|
|
79
80
|
### Re-running on new files
|
|
80
81
|
|
|
@@ -90,3 +91,9 @@ since scheduled jobs don't load your shell profile).
|
|
|
90
91
|
```bash
|
|
91
92
|
uv tool upgrade convert-docs
|
|
92
93
|
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uv run pytest
|
|
99
|
+
```
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
# convert-docs
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[markitdown](https://github.com/microsoft/markitdown)
|
|
5
|
-
structure into a destination folder
|
|
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.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
9
|
-
Requires
|
|
10
|
+
Requires Python 3.10+.
|
|
10
11
|
|
|
11
12
|
```bash
|
|
12
|
-
|
|
13
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
14
|
-
|
|
15
|
-
# Windows (PowerShell)
|
|
16
|
-
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
13
|
+
uv tool install convert-docs
|
|
17
14
|
```
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
Don't have [uv](https://docs.astral.sh/uv/)? Install it first:
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
|
-
|
|
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
|
|
23
21
|
```
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Or skip uv entirely and use pip: `pip install convert-docs`
|
|
26
24
|
|
|
27
25
|
## Usage
|
|
28
26
|
|
|
@@ -32,6 +30,13 @@ Run with no flags for an interactive prompt (asks for source, then destination):
|
|
|
32
30
|
convert-docs
|
|
33
31
|
```
|
|
34
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
|
+
|
|
35
40
|
Or pass flags to skip the prompts:
|
|
36
41
|
|
|
37
42
|
```bash
|
|
@@ -40,33 +45,29 @@ convert-docs -e pdf,docx # restrict which extensions get converted
|
|
|
40
45
|
convert-docs -f # force re-conversion, ignoring the up-to-date skip
|
|
41
46
|
convert-docs --last # re-run with the same source/destination/extensions as last time
|
|
42
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
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
| Flag | Description |
|
|
46
52
|
|---|---|
|
|
47
|
-
| `-s, --source` | Source directory to
|
|
48
|
-
| `-o, --output` | Output directory
|
|
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) |
|
|
49
55
|
| `-e, --ext` | Comma-separated extensions to convert |
|
|
50
56
|
| `-f, --force` | Force re-conversion even if output `.md` already exists and is up to date |
|
|
51
57
|
| `-l, --last` | Reuse the source, destination, and extensions from the last run (skips prompts; cannot be combined with `-s`/`-o`) |
|
|
52
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 |
|
|
53
62
|
|
|
54
63
|
Files with unsupported extensions are listed at the end instead of being silently
|
|
55
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.
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Files convert using separate OS processes (real parallelism across CPU cores, not
|
|
60
|
-
`asyncio` — conversion is CPU-bound parsing work, not I/O waiting, so asyncio's
|
|
61
|
-
cooperative concurrency wouldn't actually help). Benchmarked on a 10-core Mac converting
|
|
62
|
-
12–30 real docx files: `-j 4` (the default) cut wall time by ~2.3x vs. sequential.
|
|
63
|
-
Pushing higher didn't help further — `-j 8` was consistently *slower* than `-j 4` in
|
|
64
|
-
testing, since each worker process pays a fixed startup cost importing `markitdown`'s
|
|
65
|
-
dependencies (onnxruntime, magika, pandas), which outweighs the extra parallelism for
|
|
66
|
-
typical batch sizes. If you're converting a very large batch (hundreds of files), it's
|
|
67
|
-
worth experimenting with higher `-j` values yourself; for typical folders the default
|
|
68
|
-
is a reasonable balance. Progress lines print in completion order, not scan order, since
|
|
69
|
-
files finish out of sequence when running in parallel.
|
|
70
|
+
Paths are highlighted in supported terminals; set `NO_COLOR=1` to disable.
|
|
70
71
|
|
|
71
72
|
### Re-running on new files
|
|
72
73
|
|
|
@@ -82,3 +83,9 @@ since scheduled jobs don't load your shell profile).
|
|
|
82
83
|
```bash
|
|
83
84
|
uv tool upgrade convert-docs
|
|
84
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"
|