bookget 0.3.0__tar.gz → 0.3.2__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 (78) hide show
  1. {bookget-0.3.0 → bookget-0.3.2}/PKG-INFO +1 -1
  2. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/registry.py +22 -45
  3. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/PKG-INFO +1 -1
  4. {bookget-0.3.0 → bookget-0.3.2}/pyproject.toml +1 -1
  5. {bookget-0.3.0 → bookget-0.3.2}/README.md +0 -0
  6. {bookget-0.3.0 → bookget-0.3.2}/bookget/__init__.py +0 -0
  7. {bookget-0.3.0 → bookget-0.3.2}/bookget/__main__.py +0 -0
  8. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/__init__.py +0 -0
  9. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/base.py +0 -0
  10. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/__init__.py +0 -0
  11. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/base_iiif.py +0 -0
  12. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/harvard.py +0 -0
  13. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/kyoto.py +0 -0
  14. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/ndl.py +0 -0
  15. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/princeton.py +0 -0
  16. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/iiif/stanford.py +0 -0
  17. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/__init__.py +0 -0
  18. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/archive_org.py +0 -0
  19. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/ctext.py +0 -0
  20. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/european.py +0 -0
  21. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/hanchi.py +0 -0
  22. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/nlc_guji.py +0 -0
  23. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/shidianguji.py +0 -0
  24. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/taiwan.py +0 -0
  25. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/wikimedia_commons.py +0 -0
  26. {bookget-0.3.0 → bookget-0.3.2}/bookget/adapters/other/wikisource.py +0 -0
  27. {bookget-0.3.0 → bookget-0.3.2}/bookget/config.py +0 -0
  28. {bookget-0.3.0 → bookget-0.3.2}/bookget/core/__init__.py +0 -0
  29. {bookget-0.3.0 → bookget-0.3.2}/bookget/core/resource_manager.py +0 -0
  30. {bookget-0.3.0 → bookget-0.3.2}/bookget/downloaders/__init__.py +0 -0
  31. {bookget-0.3.0 → bookget-0.3.2}/bookget/downloaders/base.py +0 -0
  32. {bookget-0.3.0 → bookget-0.3.2}/bookget/downloaders/iiif.py +0 -0
  33. {bookget-0.3.0 → bookget-0.3.2}/bookget/exceptions.py +0 -0
  34. {bookget-0.3.0 → bookget-0.3.2}/bookget/logger.py +0 -0
  35. {bookget-0.3.0 → bookget-0.3.2}/bookget/main.py +0 -0
  36. {bookget-0.3.0 → bookget-0.3.2}/bookget/models/__init__.py +0 -0
  37. {bookget-0.3.0 → bookget-0.3.2}/bookget/models/book.py +0 -0
  38. {bookget-0.3.0 → bookget-0.3.2}/bookget/models/manifest.py +0 -0
  39. {bookget-0.3.0 → bookget-0.3.2}/bookget/models/search.py +0 -0
  40. {bookget-0.3.0 → bookget-0.3.2}/bookget/scripts/__init__.py +0 -0
  41. {bookget-0.3.0 → bookget-0.3.2}/bookget/scripts/images_to_pdf.py +0 -0
  42. {bookget-0.3.0 → bookget-0.3.2}/bookget/scripts/siku_catalog_parser.py +0 -0
  43. {bookget-0.3.0 → bookget-0.3.2}/bookget/scripts/strip_tu_marker.py +0 -0
  44. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/__init__.py +0 -0
  45. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/app.py +0 -0
  46. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/routes.py +0 -0
  47. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/sse.py +0 -0
  48. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/static.py +0 -0
  49. {bookget-0.3.0 → bookget-0.3.2}/bookget/server/tasks.py +0 -0
  50. {bookget-0.3.0 → bookget-0.3.2}/bookget/storage/__init__.py +0 -0
  51. {bookget-0.3.0 → bookget-0.3.2}/bookget/storage/file_storage.py +0 -0
  52. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_converters/__init__.py +0 -0
  53. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_converters/markdown_converter.py +0 -0
  54. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_converters/plaintext_converter.py +0 -0
  55. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/__init__.py +0 -0
  56. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/base.py +0 -0
  57. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/ctext_parser.py +0 -0
  58. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/hanchi_parser.py +0 -0
  59. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/shidianguji_parser.py +0 -0
  60. {bookget-0.3.0 → bookget-0.3.2}/bookget/text_parsers/wikisource_parser.py +0 -0
  61. {bookget-0.3.0 → bookget-0.3.2}/bookget/utils.py +0 -0
  62. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/SOURCES.txt +0 -0
  63. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/dependency_links.txt +0 -0
  64. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/entry_points.txt +0 -0
  65. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/requires.txt +0 -0
  66. {bookget-0.3.0 → bookget-0.3.2}/bookget.egg-info/top_level.txt +0 -0
  67. {bookget-0.3.0 → bookget-0.3.2}/setup.cfg +0 -0
  68. {bookget-0.3.0 → bookget-0.3.2}/tests/test_adapters.py +0 -0
  69. {bookget-0.3.0 → bookget-0.3.2}/tests/test_config.py +0 -0
  70. {bookget-0.3.0 → bookget-0.3.2}/tests/test_downloaders.py +0 -0
  71. {bookget-0.3.0 → bookget-0.3.2}/tests/test_exceptions.py +0 -0
  72. {bookget-0.3.0 → bookget-0.3.2}/tests/test_file_storage.py +0 -0
  73. {bookget-0.3.0 → bookget-0.3.2}/tests/test_hanchi.py +0 -0
  74. {bookget-0.3.0 → bookget-0.3.2}/tests/test_manifest.py +0 -0
  75. {bookget-0.3.0 → bookget-0.3.2}/tests/test_models.py +0 -0
  76. {bookget-0.3.0 → bookget-0.3.2}/tests/test_resource_manager.py +0 -0
  77. {bookget-0.3.0 → bookget-0.3.2}/tests/test_text_parsers.py +0 -0
  78. {bookget-0.3.0 → bookget-0.3.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bookget
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Download and parse ancient Chinese book resources from digital libraries
5
5
  Keywords: ancient-books,digital-library,downloader,classical-chinese
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -83,60 +83,37 @@ class AdapterRegistry:
83
83
  cls._discover_adapters()
84
84
  cls._initialized = True
85
85
 
86
- # Explicit module list for PyInstaller frozen environments
87
- _ADAPTER_MODULES = [
88
- 'bookget.adapters.iiif.base_iiif',
89
- 'bookget.adapters.iiif.harvard',
90
- 'bookget.adapters.iiif.kyoto',
91
- 'bookget.adapters.iiif.ndl',
92
- 'bookget.adapters.iiif.princeton',
93
- 'bookget.adapters.iiif.stanford',
94
- 'bookget.adapters.other.archive_org',
95
- 'bookget.adapters.other.ctext',
96
- 'bookget.adapters.other.european',
97
- 'bookget.adapters.other.hanchi',
98
- 'bookget.adapters.other.nlc_guji',
99
- 'bookget.adapters.other.shidianguji',
100
- 'bookget.adapters.other.taiwan',
101
- 'bookget.adapters.other.wikisource',
102
- 'bookget.adapters.other.wikimedia_commons',
103
- ]
86
+ # Adapter sub-packages to scan. Add a new entry only when introducing
87
+ # a whole new category of adapters; individual modules are auto-discovered.
88
+ _ADAPTER_PACKAGES = ["bookget.adapters.iiif", "bookget.adapters.other"]
104
89
 
105
90
  @classmethod
106
91
  def _discover_adapters(cls):
107
92
  """
108
- Auto-discover and import adapter modules.
93
+ Auto-discover and import every adapter module under the configured
94
+ sub-packages.
109
95
 
110
- In frozen (PyInstaller) environments, uses an explicit module list.
111
- In normal environments, scans subdirectories.
96
+ Works in both normal and PyInstaller frozen environments because
97
+ ``pkgutil.iter_modules`` honours each package's ``__path__``,
98
+ which PyInstaller's FrozenImporter populates correctly when the
99
+ modules are bundled (the spec uses ``collect_submodules`` to
100
+ ensure that).
112
101
  """
113
- if getattr(sys, 'frozen', False):
114
- # PyInstaller: filesystem scan won't work, use explicit list
115
- for module_name in cls._ADAPTER_MODULES:
116
- try:
117
- importlib.import_module(module_name)
118
- logger.debug(f"Imported adapter module: {module_name}")
119
- except Exception as e:
120
- logger.warning(f"Failed to import {module_name}: {e}")
121
- else:
122
- # Normal: scan subdirectories
123
- adapters_path = Path(__file__).parent
124
- for subdir in ["iiif", "other"]:
125
- subdir_path = adapters_path / subdir
126
- if subdir_path.exists():
127
- cls._import_from_directory(subdir_path, f"bookget.adapters.{subdir}")
102
+ for pkg_name in cls._ADAPTER_PACKAGES:
103
+ try:
104
+ pkg = importlib.import_module(pkg_name)
105
+ except Exception as e:
106
+ logger.warning(f"Failed to import package {pkg_name}: {e}")
107
+ continue
128
108
 
129
- @classmethod
130
- def _import_from_directory(cls, directory: Path, package_prefix: str):
131
- """Import all Python modules from a directory."""
132
- for item in directory.iterdir():
133
- if item.suffix == ".py" and not item.name.startswith("_"):
134
- module_name = f"{package_prefix}.{item.stem}"
109
+ for mod_info in pkgutil.iter_modules(pkg.__path__, prefix=pkg.__name__ + "."):
110
+ if mod_info.name.rsplit(".", 1)[-1].startswith("_"):
111
+ continue
135
112
  try:
136
- importlib.import_module(module_name)
137
- logger.debug(f"Imported adapter module: {module_name}")
113
+ importlib.import_module(mod_info.name)
114
+ logger.debug(f"Imported adapter module: {mod_info.name}")
138
115
  except Exception as e:
139
- logger.warning(f"Failed to import {module_name}: {e}")
116
+ logger.warning(f"Failed to import {mod_info.name}: {e}")
140
117
 
141
118
 
142
119
  def get_adapter(url: str, config=None) -> Optional[BaseSiteAdapter]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bookget
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Download and parse ancient Chinese book resources from digital libraries
5
5
  Keywords: ancient-books,digital-library,downloader,classical-chinese
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bookget"
7
- version = "0.3.0"
7
+ version = "0.3.2"
8
8
  description = "Download and parse ancient Chinese book resources from digital libraries"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes