txt2ebook 0.1.143__tar.gz → 0.1.144__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 (110) hide show
  1. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.pre-commit-config.yaml +1 -1
  2. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/CHANGELOG.md +9 -0
  3. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/PKG-INFO +1 -1
  4. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/noxfile.py +20 -6
  5. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/pyproject.toml +20 -21
  6. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/book.py +1 -3
  7. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/massage.py +3 -1
  8. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/uv.lock +331 -185
  9. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.coveragerc +0 -0
  10. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.gitignore +0 -0
  11. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.python-version +0 -0
  12. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/CONTRIBUTING.md +0 -0
  13. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/LICENSE.md +0 -0
  14. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/README.md +0 -0
  15. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/Makefile +0 -0
  16. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/make.bat +0 -0
  17. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/CHANGELOG.md +0 -0
  18. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/CONTRIBUTING.md +0 -0
  19. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/LICENSE.md +0 -0
  20. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/README.md +0 -0
  21. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/_static/logo.png +0 -0
  22. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/conf.py +0 -0
  23. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/index.rst +0 -0
  24. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.formats.rst +0 -0
  25. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.helpers.rst +0 -0
  26. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.models.rst +0 -0
  27. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.parsers.rst +0 -0
  28. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.rst +0 -0
  29. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/__init__.py +0 -0
  30. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/__main__.py +0 -0
  31. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/cli.py +0 -0
  32. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/exceptions.py +0 -0
  33. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/__init__.py +0 -0
  34. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/base.py +0 -0
  35. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/epub.py +0 -0
  36. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/gmi.py +0 -0
  37. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/md.py +0 -0
  38. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/pdf.py +0 -0
  39. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/__init__.py +0 -0
  40. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  41. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
  42. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
  43. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
  44. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/tex.py +0 -0
  45. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/txt.py +0 -0
  46. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/typ.py +0 -0
  47. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/helpers/__init__.py +0 -0
  48. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/__init__.py +0 -0
  49. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/en.py +0 -0
  50. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/zh_cn.py +0 -0
  51. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/zh_tw.py +0 -0
  52. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  53. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +0 -0
  54. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/txt2ebook.pot +0 -0
  55. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  56. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +0 -0
  57. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
  58. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +0 -0
  59. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/__init__.py +0 -0
  60. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/chapter.py +0 -0
  61. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/volume.py +0 -0
  62. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/parser.py +0 -0
  63. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/__init__.py +0 -0
  64. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/env.py +0 -0
  65. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/epub.py +0 -0
  66. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/gmi.py +0 -0
  67. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/md.py +0 -0
  68. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/parse.py +0 -0
  69. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/pdf.py +0 -0
  70. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/tex.py +0 -0
  71. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/typ.py +0 -0
  72. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/tokenizer.py +0 -0
  73. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/zh_utils.py +0 -0
  74. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/__init__.py +0 -0
  75. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/conftest.py +0 -0
  76. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/empty_file.txt +0 -0
  77. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/missing_chapters.txt +0 -0
  78. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample.txt +0 -0
  79. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_all_headers.txt +0 -0
  80. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_long_headers.txt +0 -0
  81. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_remove_wrapping.txt +0 -0
  82. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_unsorted_headers.txt +0 -0
  83. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_with_issues.txt +0 -0
  84. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_with_metadata.txt +0 -0
  85. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_epub_writer.py +0 -0
  86. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_filename_format_flag.py +0 -0
  87. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_format_option.py +0 -0
  88. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_header_number_flag.py +0 -0
  89. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_input_file_arg.py +0 -0
  90. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_language_option.py +0 -0
  91. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_output_file_arg.py +0 -0
  92. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_overwrite_flag.py +0 -0
  93. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_parser.py +0 -0
  94. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_purge_flag.py +0 -0
  95. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_quiet_flag.py +0 -0
  96. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_raise_warnings.py +0 -0
  97. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_sort_volume_and_chapter_flag.py +0 -0
  98. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_split_volume_and_chapter_flag.py +0 -0
  99. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_env.py +0 -0
  100. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_epub.py +0 -0
  101. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_massage.py +0 -0
  102. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_test_parsing_flag.py +0 -0
  103. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_tokenizer.py +0 -0
  104. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_translator_option.py +0 -0
  105. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_txt2ebook.py +0 -0
  106. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_verbose_flag.py +0 -0
  107. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_volume_page_flag.py +0 -0
  108. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_halfwidth_to_fullwidth.py +0 -0
  109. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_numeric.py +0 -0
  110. {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_words_to_numbers.py +0 -0
@@ -46,7 +46,7 @@ repos:
46
46
  - --py=312
47
47
 
48
48
  - repo: https://github.com/astral-sh/ruff-pre-commit
49
- rev: v0.11.12
49
+ rev: v0.11.13
50
50
  hooks:
51
51
  - id: ruff-check
52
52
  args: [--fix]
@@ -7,6 +7,15 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.1.144 (2025-06-15)
11
+
12
+ - Bump deps
13
+ - Bump `pre-commit` hook for `ruff`
14
+ - Fix deps upgrade and relax deps requirements
15
+ - Fix incorrect type in args
16
+ - Fix missing langconf to parser class
17
+ - Resolve `uv` not using nox's `venv` warning
18
+
10
19
  ## v0.1.143 (2025-06-08)
11
20
 
12
21
  - Add `ruff` to `pre-commit` hook
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txt2ebook
3
- Version: 0.1.143
3
+ Version: 0.1.144
4
4
  Summary: CLI tool to convert txt file to ebook format
5
5
  Project-URL: Homepage, https://github.com/kianmeng/txt2ebook
6
6
  Project-URL: Repository, https://github.com/kianmeng/txt2ebook
@@ -25,11 +25,10 @@ nox.options.default_venv_backend = "uv"
25
25
  @nox.session(python="3.9")
26
26
  def deps(session: nox.Session) -> None:
27
27
  """Update pre-commit hooks and deps."""
28
- session.run("uv", "sync", "-U", "--active")
28
+ _uv_install(session)
29
29
  session.run("pre-commit", "autoupdate", *session.posargs)
30
30
 
31
31
 
32
- @nox.session()
33
32
  @nox.session(python="3.13")
34
33
  def lint(session: nox.Session) -> None:
35
34
  """Run pre-commit tasks.
@@ -216,10 +215,6 @@ def release(session: nox.Session) -> None:
216
215
  session.run("uv", "publish")
217
216
 
218
217
 
219
- def _uv_install(session: nox.Session) -> None:
220
- session.run("uv", "sync", "--active")
221
-
222
-
223
218
  def _search_and_replace(file, search, replace) -> None:
224
219
  with open(file, "r+", encoding="utf8") as f:
225
220
  content = f.read()
@@ -227,3 +222,22 @@ def _search_and_replace(file, search, replace) -> None:
227
222
  f.seek(0)
228
223
  f.write(content)
229
224
  f.truncate()
225
+
226
+
227
+ def _uv_install(session: nox.Session) -> None:
228
+ """Install the project and its development dependencies using uv.
229
+
230
+ This also resolves the following error:
231
+ warning: `VIRTUAL_ENV=.nox/lint` does not match the project environment
232
+ path `.venv` and will be ignored
233
+
234
+ See https://nox.thea.codes/en/stable/cookbook.html#using-a-lockfile
235
+ """
236
+ session.run_install(
237
+ "uv",
238
+ "sync",
239
+ "--upgrade",
240
+ "--all-packages",
241
+ f"--python={session.virtualenv.location}",
242
+ env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
243
+ )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "txt2ebook"
3
- version = "0.1.143"
3
+ version = "0.1.144"
4
4
  description = "CLI tool to convert txt file to ebook format"
5
5
  authors = [{ name = "Kian-Meng Ang", email = "kianmeng@cpan.org" }]
6
6
  requires-python = "~=3.9"
@@ -57,26 +57,25 @@ tte = "txt2ebook.cli:main"
57
57
 
58
58
  [dependency-groups]
59
59
  dev = [
60
- "babel>=2.17.0",
61
- "bandit~=1.7.1",
62
- "flake8-simplify>=0.21.0,<0.22",
63
- "mypy>=1.10.0,<2",
64
- "myst-parser>=3.0.1,<4",
65
- "nox-poetry>=1.0.3,<2",
66
- "nox>=2024.4.15,<2025",
67
- "pep8-naming>=0.13.3,<0.14",
68
- "pre-commit>=4.2.0",
69
- "pylint>=3.2.0,<4",
70
- "pytest-cov>=5.0.0,<6",
71
- "pytest-randomly>=3.15.0,<4",
72
- "pytest-xdist>=3.6.1,<4",
73
- "pytest>=8.2.0,<9",
74
- "ruff>=0.11.12",
75
- "scripttest~=1.3",
76
- "sphinx-autodoc-typehints>=2.2.2,<3",
77
- "sphinx-copybutton>=0.5.2,<0.6",
78
- "sphinx>=7.3.7,<8",
79
- "vulture~=2.11",
60
+ "babel",
61
+ "bandit",
62
+ "flake8-simplify",
63
+ "mypy",
64
+ "myst-parser",
65
+ "nox",
66
+ "pep8-naming",
67
+ "pre-commit",
68
+ "pylint",
69
+ "pytest-cov",
70
+ "pytest-randomly",
71
+ "pytest-xdist",
72
+ "pytest",
73
+ "ruff",
74
+ "scripttest",
75
+ "sphinx-autodoc-typehints",
76
+ "sphinx-copybutton",
77
+ "sphinx",
78
+ "vulture",
80
79
  ]
81
80
 
82
81
  [build-system]
@@ -20,8 +20,6 @@ from collections import Counter
20
20
  from dataclasses import dataclass, field
21
21
  from typing import List, Union
22
22
 
23
- from typing_extensions import Literal
24
-
25
23
  from txt2ebook.models.chapter import Chapter
26
24
  from txt2ebook.models.volume import Volume
27
25
 
@@ -52,7 +50,7 @@ class Book:
52
50
  logger.debug("Book stats: %s", repr(stats))
53
51
  return stats
54
52
 
55
- def filename_format(self, filename_format: Union[str, Literal[True]]) -> str:
53
+ def filename_format(self, filename_format: int) -> str:
56
54
  """Generate the filename format based on the available selection."""
57
55
  authors = ", ".join(self.authors)
58
56
  format_options = {
@@ -202,8 +202,10 @@ def run(args: argparse.Namespace) -> None:
202
202
  """
203
203
  massaged_txt = massage_txt(args)
204
204
  args.language = detect_and_expect_language(massaged_txt, args.language)
205
+ config_lang = args.language.replace("-", "_")
206
+ langconf = import_module(f"txt2ebook.languages.{config_lang}")
205
207
  args.with_toc = False
206
- parser = Parser(massaged_txt, args)
208
+ parser = Parser(massaged_txt, args, langconf)
207
209
  book = parser.parse()
208
210
 
209
211
  if args.debug: