ocrd 3.6.0__tar.gz → 3.7.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.
Files changed (155) hide show
  1. {ocrd-3.6.0/src/ocrd.egg-info → ocrd-3.7.0}/PKG-INFO +2 -8
  2. {ocrd-3.6.0 → ocrd-3.7.0}/README.md +0 -6
  3. ocrd-3.7.0/VERSION +1 -0
  4. {ocrd-3.6.0 → ocrd-3.7.0}/requirements.txt +1 -1
  5. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/__init__.py +2 -4
  6. ocrd-3.7.0/src/ocrd/cli/bashlib.py +42 -0
  7. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/mets_server.py +5 -5
  8. {ocrd-3.6.0 → ocrd-3.7.0/src/ocrd.egg-info}/PKG-INFO +2 -8
  9. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd.egg-info/SOURCES.txt +0 -3
  10. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd.egg-info/requires.txt +1 -1
  11. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/models/job.py +29 -28
  12. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/models/messages.py +3 -2
  13. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/models/workspace.py +4 -4
  14. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/logging.py +3 -0
  15. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/os.py +1 -1
  16. ocrd-3.6.0/README_bashlib.md +0 -177
  17. ocrd-3.6.0/VERSION +0 -1
  18. ocrd-3.6.0/src/ocrd/cli/bashlib.py +0 -153
  19. ocrd-3.6.0/src/ocrd/cli/log.py +0 -56
  20. ocrd-3.6.0/src/ocrd/lib.bash +0 -310
  21. {ocrd-3.6.0 → ocrd-3.7.0}/LICENSE +0 -0
  22. {ocrd-3.6.0 → ocrd-3.7.0}/MANIFEST.in +0 -0
  23. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd.md +0 -0
  24. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd_modelfactory.md +0 -0
  25. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd_models.md +0 -0
  26. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd_network.md +0 -0
  27. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd_utils.md +0 -0
  28. {ocrd-3.6.0 → ocrd-3.7.0}/README_ocrd_validators.md +0 -0
  29. {ocrd-3.6.0 → ocrd-3.7.0}/pyproject.toml +0 -0
  30. {ocrd-3.6.0 → ocrd-3.7.0}/setup.cfg +0 -0
  31. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/__init__.py +0 -0
  32. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/network.py +0 -0
  33. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/ocrd_tool.py +0 -0
  34. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/process.py +0 -0
  35. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/resmgr.py +0 -0
  36. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/validate.py +0 -0
  37. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/workspace.py +0 -0
  38. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/cli/zip.py +0 -0
  39. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/constants.py +0 -0
  40. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/decorators/__init__.py +0 -0
  41. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/decorators/loglevel_option.py +0 -0
  42. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/decorators/mets_find_options.py +0 -0
  43. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/decorators/ocrd_cli_options.py +0 -0
  44. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/decorators/parameter_option.py +0 -0
  45. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/ocrd-all-tool.json +0 -0
  46. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/__init__.py +0 -0
  47. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/base.py +0 -0
  48. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/builtin/__init__.py +0 -0
  49. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/builtin/dummy/__init__.py +0 -0
  50. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/builtin/dummy/ocrd-tool.json +0 -0
  51. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/builtin/dummy_processor.py +0 -0
  52. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/builtin/filter_processor.py +0 -0
  53. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/helpers.py +0 -0
  54. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/processor/ocrd_page_result.py +0 -0
  55. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/resolver.py +0 -0
  56. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/resource_list.yml +0 -0
  57. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/resource_manager.py +0 -0
  58. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/task_sequence.py +0 -0
  59. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/workspace.py +0 -0
  60. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/workspace_backup.py +0 -0
  61. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd/workspace_bagger.py +0 -0
  62. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd.egg-info/dependency_links.txt +0 -0
  63. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd.egg-info/entry_points.txt +0 -0
  64. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd.egg-info/top_level.txt +0 -0
  65. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_modelfactory/__init__.py +0 -0
  66. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/__init__.py +0 -0
  67. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/constants.py +0 -0
  68. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/mets-empty.xml +0 -0
  69. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_agent.py +0 -0
  70. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_exif.py +0 -0
  71. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_file.py +0 -0
  72. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_mets.py +0 -0
  73. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_page.py +0 -0
  74. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_page_generateds.py +0 -0
  75. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/ocrd_xml_base.py +0 -0
  76. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/report.py +0 -0
  77. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/utils.py +0 -0
  78. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_models/xpath_functions.py +0 -0
  79. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/__init__.py +0 -0
  80. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/cli/__init__.py +0 -0
  81. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/cli/client.py +0 -0
  82. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/cli/processing_server.py +0 -0
  83. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/cli/processing_worker.py +0 -0
  84. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/client.py +0 -0
  85. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/client_utils.py +0 -0
  86. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/constants.py +0 -0
  87. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/database.py +0 -0
  88. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/logging_utils.py +0 -0
  89. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/models/__init__.py +0 -0
  90. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/models/workflow.py +0 -0
  91. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/param_validators.py +0 -0
  92. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/process_helpers.py +0 -0
  93. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/processing_server.py +0 -0
  94. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/processing_worker.py +0 -0
  95. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/__init__.py +0 -0
  96. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/connector.py +0 -0
  97. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/constants.py +0 -0
  98. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/consumer.py +0 -0
  99. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/helpers.py +0 -0
  100. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/ocrd_messages.py +0 -0
  101. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/rabbitmq_utils/publisher.py +0 -0
  102. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/__init__.py +0 -0
  103. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/config_parser.py +0 -0
  104. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/connection_clients.py +0 -0
  105. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/deployer.py +0 -0
  106. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/hosts.py +0 -0
  107. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/network_agents.py +0 -0
  108. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/runtime_data/network_services.py +0 -0
  109. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/server_cache.py +0 -0
  110. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/server_utils.py +0 -0
  111. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/tcp_to_uds_mets_proxy.py +0 -0
  112. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_network/utils.py +0 -0
  113. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/__init__.py +0 -0
  114. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/config.py +0 -0
  115. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/constants.py +0 -0
  116. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/deprecate.py +0 -0
  117. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/image.py +0 -0
  118. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/introspect.py +0 -0
  119. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/ocrd_logging.conf +0 -0
  120. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_utils/str.py +0 -0
  121. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/__init__.py +0 -0
  122. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/bagit-profile.yml +0 -0
  123. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/constants.py +0 -0
  124. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/json_validator.py +0 -0
  125. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/message_processing.schema.yml +0 -0
  126. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/message_result.schema.yml +0 -0
  127. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/mets.xsd +0 -0
  128. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/ocrd_network_message_validator.py +0 -0
  129. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/ocrd_tool.schema.yml +0 -0
  130. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/ocrd_tool_validator.py +0 -0
  131. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/ocrd_zip_validator.py +0 -0
  132. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/page.xsd +0 -0
  133. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/page_validator.py +0 -0
  134. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/parameter_validator.py +0 -0
  135. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/processing_server_config.schema.yml +0 -0
  136. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/processing_server_config_validator.py +0 -0
  137. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/resource_list_validator.py +0 -0
  138. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/workspace_validator.py +0 -0
  139. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/xlink.xsd +0 -0
  140. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/xsd_mets_validator.py +0 -0
  141. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/xsd_page_validator.py +0 -0
  142. {ocrd-3.6.0 → ocrd-3.7.0}/src/ocrd_validators/xsd_validator.py +0 -0
  143. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_decorators.py +0 -0
  144. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_logging.py +0 -0
  145. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_logging_conf.py +0 -0
  146. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_mets_server.py +0 -0
  147. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_model_factory.py +0 -0
  148. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_resolver.py +0 -0
  149. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_resolver_oai.py +0 -0
  150. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_resource_manager.py +0 -0
  151. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_task_sequence.py +0 -0
  152. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_utils.py +0 -0
  153. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_version.py +0 -0
  154. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_workspace.py +0 -0
  155. {ocrd-3.6.0 → ocrd-3.7.0}/tests/test_workspace_remove.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ocrd
3
- Version: 3.6.0
3
+ Version: 3.7.0
4
4
  Summary: OCR-D framework
5
5
  Author-email: Konstantin Baierer <unixprog@gmail.com>
6
6
  License: Apache License 2.0
@@ -37,7 +37,7 @@ Requires-Dist: opencv-python-headless
37
37
  Requires-Dist: paramiko
38
38
  Requires-Dist: pika>=1.2.0
39
39
  Requires-Dist: Pillow>=7.2.0
40
- Requires-Dist: pydantic==1.*
40
+ Requires-Dist: pydantic>=2.0.0
41
41
  Requires-Dist: python-magic
42
42
  Requires-Dist: python-multipart
43
43
  Requires-Dist: pyyaml
@@ -220,12 +220,6 @@ Also contains the command line tool `ocrd`.
220
220
 
221
221
  See [README for `ocrd`](./README_ocrd.md) for further information.
222
222
 
223
- ## bash library
224
-
225
- Builds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.
226
-
227
- See [README for `bashlib`](./README_bashlib.md) for further information.
228
-
229
223
  ## Testing
230
224
 
231
225
  Download assets (`make assets`)
@@ -170,12 +170,6 @@ Also contains the command line tool `ocrd`.
170
170
 
171
171
  See [README for `ocrd`](./README_ocrd.md) for further information.
172
172
 
173
- ## bash library
174
-
175
- Builds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.
176
-
177
- See [README for `bashlib`](./README_bashlib.md) for further information.
178
-
179
173
  ## Testing
180
174
 
181
175
  Download assets (`make assets`)
ocrd-3.7.0/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.7.0
@@ -26,7 +26,7 @@ opencv-python-headless
26
26
  paramiko
27
27
  pika>=1.2.0
28
28
  Pillow >= 7.2.0
29
- pydantic==1.*
29
+ pydantic >= 2.0.0
30
30
  python-magic
31
31
  python-multipart
32
32
  pyyaml
@@ -32,12 +32,11 @@ from ..decorators import ocrd_loglevel
32
32
  from .ocrd_tool import ocrd_tool_cli
33
33
  from .workspace import workspace_cli
34
34
  from .process import process_cli
35
- from .bashlib import bashlib_cli
36
35
  from .validate import validate_cli
37
36
  from .resmgr import resmgr_cli
38
37
  from .zip import zip_cli
39
- from .log import log_cli
40
38
  from .network import network_cli
39
+ from .bashlib import bashlib_cli
41
40
 
42
41
 
43
42
  __all__ = ['cli']
@@ -117,9 +116,8 @@ def cli(**kwargs): # pylint: disable=unused-argument
117
116
  cli.add_command(ocrd_tool_cli)
118
117
  cli.add_command(workspace_cli)
119
118
  cli.add_command(process_cli)
120
- cli.add_command(bashlib_cli)
121
119
  cli.add_command(zip_cli)
122
120
  cli.add_command(validate_cli)
123
- cli.add_command(log_cli)
124
121
  cli.add_command(resmgr_cli)
125
122
  cli.add_command(network_cli)
123
+ cli.add_command(bashlib_cli)
@@ -0,0 +1,42 @@
1
+ """
2
+ OCR-D CLI: bash library
3
+
4
+ .. click:: ocrd.cli.bashlib:bashlib_cli
5
+ :prog: ocrd bashlib
6
+ :nested: full
7
+
8
+ """
9
+
10
+ # WARNING: bashlib processors have been deprecated as of v3 of the OCR-D/core API
11
+ # and will be removed in v3.7.0. We retain the `ocrd bashlib` CLI only
12
+ # to not break the `ocrd bashlib filename` command, which is used in CD
13
+ # scripts to get the `share` directory of the core installation.
14
+
15
+ import click
16
+ from ocrd.constants import BASHLIB_FILENAME
17
+
18
+ # ----------------------------------------------------------------------
19
+ # ocrd bashlib
20
+ # ----------------------------------------------------------------------
21
+
22
+
23
+ @click.group('bashlib')
24
+ def bashlib_cli():
25
+ """
26
+ Work with bash library
27
+ """
28
+
29
+ # ----------------------------------------------------------------------
30
+ # ocrd bashlib filename
31
+ # ----------------------------------------------------------------------
32
+
33
+
34
+ @bashlib_cli.command('filename')
35
+ def bashlib_filename():
36
+ """
37
+ Dump the bash library filename for sourcing by shell scripts
38
+
39
+ For functions exported by bashlib, see `<../../README.md>`_
40
+ """
41
+ print(BASHLIB_FILENAME)
42
+
@@ -258,12 +258,12 @@ class ClientSideOcrdMets:
258
258
 
259
259
  def add_agent(self, **kwargs):
260
260
  if not self.multiplexing_mode:
261
- return self.session.request("POST", f"{self.url}/agent", json=OcrdAgentModel.create(**kwargs).dict())
261
+ return self.session.request("POST", f"{self.url}/agent", json=OcrdAgentModel.create(**kwargs).model_dump())
262
262
  else:
263
263
  self.session.request(
264
264
  "POST",
265
265
  self.url,
266
- json=MpxReq.add_agent(self.ws_dir_path, OcrdAgentModel.create(**kwargs).dict())
266
+ json=MpxReq.add_agent(self.ws_dir_path, OcrdAgentModel.create(**kwargs).model_dump())
267
267
  ).json()
268
268
  return OcrdAgentModel.create(**kwargs)
269
269
 
@@ -305,7 +305,7 @@ class ClientSideOcrdMets:
305
305
  mimetype=mimetype, url=url, local_filename=local_filename
306
306
  )
307
307
  # add force+ignore
308
- kwargs = {**kwargs, **data.dict()}
308
+ kwargs = {**kwargs, **data.model_dump()}
309
309
 
310
310
  if not self.multiplexing_mode:
311
311
  r = self.session.request("POST", f"{self.url}/file", data=kwargs)
@@ -530,7 +530,7 @@ class OcrdMetsServer:
530
530
 
531
531
  @app.post(path='/agent', response_model=OcrdAgentModel)
532
532
  async def add_agent(agent: OcrdAgentModel):
533
- kwargs = agent.dict()
533
+ kwargs = agent.model_dump()
534
534
  kwargs['_type'] = kwargs.pop('type')
535
535
  workspace.mets.add_agent(**kwargs)
536
536
  response = agent
@@ -575,7 +575,7 @@ class OcrdMetsServer:
575
575
  local_filename=local_filename
576
576
  )
577
577
  # Add to workspace
578
- kwargs = file_resource.dict()
578
+ kwargs = file_resource.model_dump()
579
579
  workspace.add_file(**kwargs, force=force)
580
580
  response = file_resource
581
581
  self.log.debug(f"POST /file -> {response.__dict__}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ocrd
3
- Version: 3.6.0
3
+ Version: 3.7.0
4
4
  Summary: OCR-D framework
5
5
  Author-email: Konstantin Baierer <unixprog@gmail.com>
6
6
  License: Apache License 2.0
@@ -37,7 +37,7 @@ Requires-Dist: opencv-python-headless
37
37
  Requires-Dist: paramiko
38
38
  Requires-Dist: pika>=1.2.0
39
39
  Requires-Dist: Pillow>=7.2.0
40
- Requires-Dist: pydantic==1.*
40
+ Requires-Dist: pydantic>=2.0.0
41
41
  Requires-Dist: python-magic
42
42
  Requires-Dist: python-multipart
43
43
  Requires-Dist: pyyaml
@@ -220,12 +220,6 @@ Also contains the command line tool `ocrd`.
220
220
 
221
221
  See [README for `ocrd`](./README_ocrd.md) for further information.
222
222
 
223
- ## bash library
224
-
225
- Builds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.
226
-
227
- See [README for `bashlib`](./README_bashlib.md) for further information.
228
-
229
223
  ## Testing
230
224
 
231
225
  Download assets (`make assets`)
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
- README_bashlib.md
5
4
  README_ocrd.md
6
5
  README_ocrd_modelfactory.md
7
6
  README_ocrd_models.md
@@ -13,7 +12,6 @@ pyproject.toml
13
12
  requirements.txt
14
13
  src/ocrd/__init__.py
15
14
  src/ocrd/constants.py
16
- src/ocrd/lib.bash
17
15
  src/ocrd/mets_server.py
18
16
  src/ocrd/ocrd-all-tool.json
19
17
  src/ocrd/resolver.py
@@ -31,7 +29,6 @@ src/ocrd.egg-info/requires.txt
31
29
  src/ocrd.egg-info/top_level.txt
32
30
  src/ocrd/cli/__init__.py
33
31
  src/ocrd/cli/bashlib.py
34
- src/ocrd/cli/log.py
35
32
  src/ocrd/cli/network.py
36
33
  src/ocrd/cli/ocrd_tool.py
37
34
  src/ocrd/cli/process.py
@@ -22,7 +22,7 @@ opencv-python-headless
22
22
  paramiko
23
23
  pika>=1.2.0
24
24
  Pillow>=7.2.0
25
- pydantic==1.*
25
+ pydantic>=2.0.0
26
26
  python-magic
27
27
  python-multipart
28
28
  pyyaml
@@ -13,7 +13,7 @@ class PYJobInput(BaseModel):
13
13
  workspace_id: Optional[str] = None
14
14
  description: Optional[str] = None
15
15
  input_file_grps: List[str]
16
- output_file_grps: Optional[List[str]]
16
+ output_file_grps: Optional[List[str]] = None
17
17
  page_id: Optional[str] = None
18
18
  parameters: dict = {} # Always set to empty dict when None, otherwise it fails ocr-d-validation
19
19
  result_queue_name: Optional[str] = None
@@ -23,8 +23,8 @@ class PYJobInput(BaseModel):
23
23
  # If set, specifies a list of job ids this job depends on
24
24
  depends_on: Optional[List[str]] = None
25
25
 
26
- class Config:
27
- schema_extra = {
26
+ model_config = {
27
+ 'json_schema_extra': {
28
28
  'example': {
29
29
  'path_to_mets': '/path/to/mets.xml',
30
30
  'description': 'The description of this execution',
@@ -34,6 +34,7 @@ class PYJobInput(BaseModel):
34
34
  'parameters': {}
35
35
  }
36
36
  }
37
+ }
37
38
 
38
39
 
39
40
  class PYJobOutput(BaseModel):
@@ -42,12 +43,12 @@ class PYJobOutput(BaseModel):
42
43
  job_id: str
43
44
  processor_name: str
44
45
  state: JobState = JobState.unset
45
- path_to_mets: Optional[str]
46
- workspace_id: Optional[str]
46
+ path_to_mets: Optional[str] = None
47
+ workspace_id: Optional[str] = None
47
48
  input_file_grps: List[str]
48
- output_file_grps: Optional[List[str]]
49
+ output_file_grps: Optional[List[str]] = None
49
50
  page_id: Optional[str] = None
50
- log_file_path: Optional[str]
51
+ log_file_path: Optional[str] = None
51
52
 
52
53
 
53
54
  class DBProcessorJob(Document):
@@ -55,22 +56,22 @@ class DBProcessorJob(Document):
55
56
  """
56
57
  job_id: str
57
58
  processor_name: str
58
- path_to_mets: Optional[str]
59
- workspace_id: Optional[str]
60
- description: Optional[str]
59
+ path_to_mets: Optional[str] = None
60
+ workspace_id: Optional[str] = None
61
+ description: Optional[str] = None
61
62
  state: JobState = JobState.unset
62
63
  input_file_grps: List[str]
63
- output_file_grps: Optional[List[str]]
64
- page_id: Optional[str]
65
- parameters: Optional[dict]
66
- depends_on: Optional[List[str]]
67
- result_queue_name: Optional[str]
68
- callback_url: Optional[str]
69
- internal_callback_url: Optional[str]
70
- start_time: Optional[datetime]
71
- end_time: Optional[datetime]
72
- exec_time: Optional[str]
73
- log_file_path: Optional[str]
64
+ output_file_grps: Optional[List[str]] = None
65
+ page_id: Optional[str] = None
66
+ parameters: Optional[dict] = None
67
+ depends_on: Optional[List[str]] = None
68
+ result_queue_name: Optional[str] = None
69
+ callback_url: Optional[str] = None
70
+ internal_callback_url: Optional[str] = None
71
+ start_time: Optional[datetime] = None
72
+ end_time: Optional[datetime] = None
73
+ exec_time: Optional[str] = None
74
+ log_file_path: Optional[str] = None
74
75
 
75
76
  class Settings:
76
77
  use_enum_values = True
@@ -99,9 +100,9 @@ class PYWorkflowJobOutput(BaseModel):
99
100
  page_id: str
100
101
  page_wise: bool = False
101
102
  job_id: str
102
- path_to_mets: Optional[str]
103
- workspace_id: Optional[str]
104
- description: Optional[str]
103
+ path_to_mets: Optional[str] = None
104
+ workspace_id: Optional[str] = None
105
+ description: Optional[str] = None
105
106
 
106
107
 
107
108
  class DBWorkflowJob(Document):
@@ -114,10 +115,10 @@ class DBWorkflowJob(Document):
114
115
  # key: page_id
115
116
  # value: List of and processing job ids sorted in dependency order
116
117
  processing_job_ids: Dict
117
- path_to_mets: Optional[str]
118
- workspace_id: Optional[str]
119
- description: Optional[str]
120
- workflow_callback_url: Optional[str]
118
+ path_to_mets: Optional[str] = None
119
+ workspace_id: Optional[str] = None
120
+ description: Optional[str] = None
121
+ workflow_callback_url: Optional[str] = None
121
122
 
122
123
  class Settings:
123
124
  use_enum_values = True
@@ -11,8 +11,8 @@ class PYResultMessage(BaseModel):
11
11
  path_to_mets: Optional[str] = None
12
12
  workspace_id: Optional[str] = None
13
13
 
14
- class Config:
15
- schema_extra = {
14
+ model_config = {
15
+ "json_schema_extra": {
16
16
  "example": {
17
17
  "job_id": "d8e36726-ed28-5476-b83c-bc31d2eecf1f",
18
18
  "state": JobState.success,
@@ -20,3 +20,4 @@ class PYResultMessage(BaseModel):
20
20
  "workspace_id": "c7f25615-fc17-4365-a74d-ad20e1ddbd0e"
21
21
  }
22
22
  }
23
+ }
@@ -25,10 +25,10 @@ class DBWorkspace(Document):
25
25
  workspace_mets_path: str
26
26
  ocrd_identifier: str
27
27
  bagit_profile_identifier: str
28
- ocrd_base_version_checksum: Optional[str]
29
- ocrd_mets: Optional[str]
30
- bag_info_adds: Optional[dict]
31
- mets_server_url: Optional[str]
28
+ ocrd_base_version_checksum: Optional[str] = None
29
+ ocrd_mets: Optional[str] = None
30
+ bag_info_adds: Optional[dict] = None
31
+ mets_server_url: Optional[str] = None
32
32
  deleted: bool = False
33
33
 
34
34
  class Settings:
@@ -75,6 +75,9 @@ _ocrdLevel2pythonLevel = {
75
75
 
76
76
 
77
77
  def tf_disable_interactive_logs():
78
+ """
79
+ Disable the interactive logging of tf/keras and set the log level to error or higher
80
+ """
78
81
  try:
79
82
  from os import environ # pylint: disable=import-outside-toplevel
80
83
  # This env variable must be set before importing from Keras
@@ -171,7 +171,7 @@ def list_all_resources(executable, moduled=None, xdg_data_home=None):
171
171
  # files over directories; but we want data files only
172
172
  # todo: more code and cache exclusion patterns!
173
173
  ['*.py', '*.py[cod]', '*~', 'ocrd-tool.json',
174
- 'environment.pickle', 'resource_list.yml', 'lib.bash']):
174
+ 'environment.pickle', 'resource_list.yml']):
175
175
  continue
176
176
  candidates.append(resource)
177
177
  # recurse once
@@ -1,177 +0,0 @@
1
- # bashlib
2
-
3
- > Builds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.
4
-
5
- For example:
6
-
7
- source `ocrd bashlib filename`
8
- declare -A NAMESPACES MIMETYPES
9
- eval NAMESPACES=( `ocrd bashlib constants NAMESPACES` )
10
- echo ${NAMESPACES[page]}
11
- eval MIMETYPE_PAGE=( `ocrd bashlib constants MIMETYPE_PAGE` )
12
- echo $MIMETYPE_PAGE
13
- eval MIMETYPES=( `ocrd bashlib constants EXT_TO_MIME` )
14
- echo ${MIMETYPES[.jpg]}
15
-
16
-
17
- <!-- BEGIN-MARKDOWN-TOC -->
18
- * [bashlib CLI](#bashlib-cli)
19
- * [bashlib API](#bashlib-api)
20
- * [`ocrd__raise`](#ocrd__raise)
21
- * [`ocrd__log`](#ocrd__log)
22
- * [`ocrd__minversion`](#ocrd__minversion)
23
- * [`ocrd__dumpjson`](#ocrd__dumpjson)
24
- * [`ocrd__resolve_resource`](#ocrd__resolve_resource)
25
- * [`ocrd__show_resource`](#ocrd__show_resource)
26
- * [`ocrd__list_resources`](#ocrd__list_resources)
27
- * [`ocrd__usage`](#ocrd__usage)
28
- * [`ocrd__parse_argv`](#ocrd__parse_argv)
29
- <!-- END-MARKDOWN-TOC -->
30
-
31
- ## bashlib CLI
32
-
33
- See [CLI usage](https://ocr-d.de/core/api/ocrd/ocrd.cli.bashlib.html)
34
-
35
- ## bashlib API
36
-
37
- ### `ocrd__raise`
38
-
39
- Raise an error and exit.
40
-
41
- ### `ocrd__log`
42
-
43
- Delegate logging to [`ocrd log`](#ocrd-cli)
44
-
45
- ### `ocrd__minversion`
46
-
47
- Ensure minimum version
48
-
49
- ### `ocrd__dumpjson`
50
-
51
- Output ocrd-tool.json content verbatim.
52
-
53
- Requires `$OCRD_TOOL_JSON` and `$OCRD_TOOL_NAME` to be set:
54
-
55
- ```sh
56
- export OCRD_TOOL_JSON=/path/to/ocrd-tool.json
57
- export OCRD_TOOL_NAME=ocrd-foo-bar
58
- ```
59
-
60
- (Which you automatically get from [`ocrd__wrap`](#ocrd__wrap).)
61
-
62
- ### `ocrd__resolve_resource`
63
-
64
- Output given resource file's path.
65
-
66
- ### `ocrd__show_resource`
67
-
68
- Output given resource file's content.
69
-
70
- ### `ocrd__list_resources`
71
-
72
- Output all resource files' names.
73
-
74
- ### `ocrd__usage`
75
-
76
- Print help on CLI usage.
77
-
78
- ### `ocrd__parse_argv`
79
-
80
- Parses arguments according to [OCR-D CLI](https://ocr-d.de/en/spec/cli).
81
- In doing so, depending on the values passed to it, may delegate to …
82
- - [`ocrd__raise`](#ocrd__raise) and exit (if something went wrong)
83
- - [`ocrd__usage`](#ocrd__usage) and exit
84
- - [`ocrd__dumpjson`](#ocrd__dumpjson) and exit
85
- - [`ocrd__show_resource`](#ocrd__show_resource) and exit
86
- - [`ocrd__list_resources`](#ocrd__list_resources) and exit
87
- - [`ocrd validate tasks`](#ocrd-cli) and return
88
-
89
- Expects an associative array ("hash"/"dict") **`ocrd__argv`** to be predefined:
90
-
91
- declare -A ocrd__argv=()
92
-
93
- This will be filled by the parser along the following keys:
94
- - `overwrite`: whether `--overwrite` is enabled
95
- - `profile`: whether `--profile` is enabled
96
- - `profile_file`: the argument of `--profile-file`
97
- - `log_level`: the argument of `--log-level`
98
- - `mets_server_url`: the argument of `--mets-server-url` argument
99
- - `mets_file`: absolute path of the `--mets` argument
100
- - `working_dir`: absolute path of the `--working-dir` argument or the parent of `mets_file`
101
- - `page_id`: the argument of `--page-id`
102
- - `input_file_grp`: the argument of `--input-file-grp`
103
- - `output_file_grp`: the argument of `--output-file-grp`
104
-
105
- Moreover, there will be an associative array **`params`**
106
- with the fully validated and default-expanded runtime values of the `ocrd-tool.json` parameters.
107
-
108
- ### `ocrd__wrap`
109
-
110
- Parses an [ocrd-tool.json](https://ocr-d.de/en/spec/ocrd_tool) for a specific `tool` (i.e. processor `executable`).
111
-
112
- Delegates to …
113
- - [`ocrd__parse_argv`](#ocrd__parse_argv), creating the `ocrd__argv` associative array
114
- - [`ocrd bashlib input-files`](#ocrd-cli), creating the data structures used by [`ocrd__input_file`](#ocrd__input_file)
115
-
116
- Usage: `ocrd__wrap PATH/TO/OCRD-TOOL.JSON EXECUTABLE ARGS`
117
-
118
- For example:
119
-
120
- ocrd__wrap $SHAREDIR/ocrd-tool.json ocrd-olena-binarize "$@"
121
- ...
122
-
123
- ### `ocrd__input_file`
124
-
125
- (Requires [`ocrd__wrap`](#ocrd__wrap) to have been run first.)
126
-
127
- Access information on the input files according to the parsed CLI arguments:
128
- - their file `url` (or local file path)
129
- - their file `ID`
130
- - their `mimetype`
131
- - their `pageId`
132
- - their proposed corresponding `outputFileId` (generated from `${ocrd__argv[output__file_grp]}` and input file `ID`)
133
-
134
- Usage: `ocrd__input_file NR KEY`
135
-
136
- For example:
137
-
138
- pageId=`ocrd__input_file 3 pageId`
139
-
140
- To be used in a **loop over all selected pages**:
141
-
142
- for ((n=0; n<${#ocrd__files[*]}; n++)); do
143
- local in_fpath=($(ocrd__input_file $n url))
144
- local in_id=($(ocrd__input_file $n ID))
145
- local in_mimetype=($(ocrd__input_file $n mimetype))
146
- local in_pageId=($(ocrd__input_file $n pageId))
147
- local out_id=$(ocrd__input_file $n outputFileId)
148
- local out_fpath="${ocrd__argv[output_file_grp]}/${out_id}.xml
149
-
150
- # process $in_fpath to $out_fpath ...
151
-
152
- declare -a options
153
- if [ -n "$in_pageId" ]; then
154
- options=( -g $in_pageId )
155
- else
156
- options=()
157
- fi
158
- if [[ "${ocrd__argv[overwrite]}" == true ]];then
159
- options+=( --force )
160
- fi
161
- options+=( -G ${ocrd__argv[output_file_grp]}
162
- -m $MIMETYPE_PAGE -i "$out_id"
163
- "$out_fpath" )
164
- ocrd -l ${ocrd__argv[log_level]} workspace -d ${ocrd__argv[working_dir]} add "${options[@]}"
165
-
166
- > **Note**: If the `--input-file-grp` is **multi-valued** (N fileGrps separated by commas),
167
- > then usage is similar:
168
- > * The function `ocrd__input_file` can be used, but
169
- > its results will be **lists** (delimited by whitespace and surrounded by single quotes),
170
- > e.g. `[url]='file1.xml file2.xml' [ID]='id_file1 id_file2' [mimetype]='application/vnd.prima.page+xml image/tiff' ...`.
171
- > * Therefore its results should be encapsulated in a (non-associative) **array variable**
172
- > and without extra quotes, e.g. `in_file=($(ocrd__input_file 3 url))`, or as shown above.
173
- > * This will yield the first fileGrp's results on index 0,
174
- > which in bash will always be the same as if you referenced the array without index
175
- > (so code does not need to be changed much), e.g. `test -f $in_file` which equals `test -f ${in_file[0]}`.
176
- > * Additional fileGrps will have to be fetched from higher indexes, e.g. `test -f ${in_file[1]}`.
177
-
ocrd-3.6.0/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.6.0