docs2epub 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

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.
docs2epub/__init__.py CHANGED
@@ -2,4 +2,4 @@ __all__ = [
2
2
  "__version__",
3
3
  ]
4
4
 
5
- __version__ = "0.1.0"
5
+ __version__ = "0.1.1"
docs2epub/cli.py CHANGED
@@ -14,11 +14,33 @@ def _build_parser() -> argparse.ArgumentParser:
14
14
  description="Turn documentation sites into an EPUB (Kindle-friendly).",
15
15
  )
16
16
 
17
+ # Short positional form (for uvx):
18
+ # docs2epub <START_URL> <OUT.epub>
17
19
  p.add_argument(
18
- "--start-url",
19
- required=True,
20
+ "start_url_pos",
21
+ nargs="?",
20
22
  help="Starting URL for scraping (initially: Docusaurus docs page).",
21
23
  )
24
+ p.add_argument(
25
+ "out_pos",
26
+ nargs="?",
27
+ help="Output EPUB file path.",
28
+ )
29
+
30
+ # Flag form (more explicit):
31
+ p.add_argument(
32
+ "--start-url",
33
+ dest="start_url",
34
+ default=None,
35
+ help="Starting URL for scraping (overrides positional start_url).",
36
+ )
37
+ p.add_argument(
38
+ "--out",
39
+ dest="out",
40
+ default=None,
41
+ help="Output EPUB file path (overrides positional out).",
42
+ )
43
+
22
44
  p.add_argument(
23
45
  "--base-url",
24
46
  default=None,
@@ -40,20 +62,23 @@ def _build_parser() -> argparse.ArgumentParser:
40
62
  help="Output format. Default: epub2 (Kindle-friendly).",
41
63
  )
42
64
 
43
- p.add_argument(
44
- "--out",
45
- required=True,
46
- help="Output EPUB file path.",
47
- )
48
-
49
65
  return p
50
66
 
51
67
 
52
68
  def main(argv: list[str] | None = None) -> int:
53
69
  args = _build_parser().parse_args(argv)
54
70
 
71
+ start_url = args.start_url or args.start_url_pos
72
+ out_value = args.out or args.out_pos
73
+
74
+ if not start_url or not out_value:
75
+ raise SystemExit(
76
+ "Usage: docs2epub <START_URL> <OUT.epub> --title ... --author ...\n"
77
+ "(or use --start-url/--out flags)"
78
+ )
79
+
55
80
  options = DocusaurusNextOptions(
56
- start_url=args.start_url,
81
+ start_url=start_url,
57
82
  base_url=args.base_url,
58
83
  max_pages=args.max_pages,
59
84
  sleep_s=args.sleep_s,
@@ -64,11 +89,12 @@ def main(argv: list[str] | None = None) -> int:
64
89
  raise SystemExit("No chapters scraped (did not find article content).")
65
90
 
66
91
  out_path: Path
92
+ out_path_value = Path(out_value)
67
93
 
68
94
  if args.format == "epub2":
69
95
  out_path = build_epub2_with_pandoc(
70
96
  chapters=chapters,
71
- out_file=Path(args.out),
97
+ out_file=out_path_value,
72
98
  title=args.title,
73
99
  author=args.author,
74
100
  language=args.language,
@@ -86,7 +112,7 @@ def main(argv: list[str] | None = None) -> int:
86
112
 
87
113
  out_path = build_epub(
88
114
  chapters=chapters,
89
- out_file=Path(args.out),
115
+ out_file=out_path_value,
90
116
  meta=meta,
91
117
  )
92
118
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docs2epub
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Turn documentation sites into an EPUB (Kindle-friendly).
5
5
  Author: Breno Brito
6
6
  License: MIT
@@ -31,6 +31,16 @@ uv run docs2epub --help
31
31
 
32
32
  ## Usage
33
33
 
34
+ ### uvx (no install)
35
+
36
+ ```bash
37
+ uvx docs2epub \
38
+ https://www.techinterviewhandbook.org/software-engineering-interview-guide/ \
39
+ tech-interview-handbook.epub \
40
+ --title "Tech Interview Handbook" \
41
+ --author "Yangshun Tay"
42
+ ```
43
+
34
44
  ### Docusaurus “Next” crawl
35
45
 
36
46
  ```bash
@@ -1,11 +1,11 @@
1
- docs2epub/__init__.py,sha256=cQZgZRibboC-fCxb4OVzIvaNHJerdDGBpi_kCIoPHj4,54
2
- docs2epub/cli.py,sha256=8r-nxAMA-UOs4GOnFTpa6AdfoKICL9JbZMwtOQ_bD18,2365
1
+ docs2epub/__init__.py,sha256=zCC51i_uxiMh2wmZYBMWo4zCNEe8sfrk0dhrvo6eZ8E,54
2
+ docs2epub/cli.py,sha256=wq0oQP2W9p_eRR9P0W1AvZTn-yrutxfm7u6qU2JCcRA,3056
3
3
  docs2epub/docusaurus_next.py,sha256=OybL3KPwDZvp2sOL3locE374Zb80M1kubx81SH2GxgQ,3378
4
4
  docs2epub/epub.py,sha256=OsPWcPGTgazAeNpWASIE6e4HQ5ILQr2VFO1-Aj3y1kg,2986
5
5
  docs2epub/kindle_html.py,sha256=iymXlYFDfEIRIKC3vaepV_K-SFEvCPpAI5FESj7udOU,2153
6
6
  docs2epub/model.py,sha256=uL7uwbG6yU0bEGpSFxxIv2pcZHQR9cs2prfqk5iNQwc,160
7
7
  docs2epub/pandoc_epub2.py,sha256=m_9yJeeciyeoXMx5bVJs2qIutGDXifvd8TtFh2DRm-k,2335
8
- docs2epub-0.1.0.dist-info/METADATA,sha256=ex5GH-1rxlvgzIxqht1Tdv5leQeRXB1pZnkUrS7M5Hc,1490
9
- docs2epub-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
10
- docs2epub-0.1.0.dist-info/entry_points.txt,sha256=DHK4mzthrIXUvM8Y8Vo_3jG2IhegEDDM7T9CvCkUtvw,49
11
- docs2epub-0.1.0.dist-info/RECORD,,
8
+ docs2epub-0.1.1.dist-info/METADATA,sha256=QJ8YaNtyyUqoSf8dYMeT9bNAmZ3RCmb2s74_VYvbdvM,1718
9
+ docs2epub-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
10
+ docs2epub-0.1.1.dist-info/entry_points.txt,sha256=DHK4mzthrIXUvM8Y8Vo_3jG2IhegEDDM7T9CvCkUtvw,49
11
+ docs2epub-0.1.1.dist-info/RECORD,,