oarepo-runtime 1.5.124__py3-none-any.whl → 1.5.126__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.
@@ -24,7 +24,7 @@ def fixtures():
24
24
 
25
25
 
26
26
  @fixtures.command()
27
- @click.argument("fixture_dir", required=False)
27
+ @click.argument("fixture_dir_or_catalogue", required=False)
28
28
  @click.option("--include", multiple=True)
29
29
  @click.option("--exclude", multiple=True)
30
30
  @click.option("--system-fixtures/--no-system-fixtures", default=True, is_flag=True)
@@ -43,7 +43,7 @@ def fixtures():
43
43
  )
44
44
  @with_appcontext
45
45
  def load(
46
- fixture_dir=None,
46
+ fixture_dir_or_catalogue=None,
47
47
  include=None,
48
48
  exclude=None,
49
49
  system_fixtures=None,
@@ -61,7 +61,7 @@ def load(
61
61
  else:
62
62
  callback = fixtures_asynchronous_callback.s()
63
63
 
64
- if fixture_dir:
64
+ if fixture_dir_or_catalogue:
65
65
  system_fixtures = False
66
66
 
67
67
  if not identity:
@@ -84,7 +84,7 @@ def load(
84
84
 
85
85
  with current_app.wsgi_app.mounts["/api"].app_context():
86
86
  load_fixtures(
87
- fixture_dir,
87
+ fixture_dir_or_catalogue,
88
88
  _make_list(include),
89
89
  _make_list(exclude),
90
90
  system_fixtures=system_fixtures,
@@ -110,7 +110,12 @@ def dump(fixture_dir, include, exclude, verbose):
110
110
  callback = TQDMCallback(verbose=verbose)
111
111
 
112
112
  with current_app.wsgi_app.mounts["/api"].app_context():
113
- dump_fixtures(fixture_dir, _make_list(include), _make_list(exclude))
113
+ dump_fixtures(
114
+ fixture_dir,
115
+ _make_list(include),
116
+ _make_list(exclude),
117
+ callback=TQDMCallback(verbose=verbose),
118
+ )
114
119
  _show_stats(callback, "Dump fixtures")
115
120
 
116
121
 
@@ -28,7 +28,7 @@ class FixturesCallback(StatsKeepingDataStreamCallback):
28
28
 
29
29
 
30
30
  def load_fixtures(
31
- fixture_dir=None,
31
+ fixture_dir_or_catalogue=None,
32
32
  include=None,
33
33
  exclude=None,
34
34
  system_fixtures=True,
@@ -54,8 +54,13 @@ def load_fixtures(
54
54
  exclude = [re.compile(x) for x in (exclude or [])]
55
55
  fixtures = set()
56
56
 
57
- if fixture_dir:
58
- catalogue = DataStreamCatalogue(Path(fixture_dir) / "catalogue.yaml")
57
+ if fixture_dir_or_catalogue:
58
+ if Path(fixture_dir_or_catalogue).is_dir():
59
+ fixture_catalogue = Path(fixture_dir_or_catalogue) / "catalogue.yaml"
60
+ else:
61
+ fixture_catalogue = Path(fixture_dir_or_catalogue)
62
+
63
+ catalogue = DataStreamCatalogue(fixture_catalogue)
59
64
  _load_fixtures_from_catalogue(
60
65
  catalogue,
61
66
  fixtures,
@@ -201,7 +206,7 @@ def default_config_generator(service_id, use_files=False):
201
206
  ]
202
207
  if use_files:
203
208
  writers.append(
204
- {"writer": "attachments_file", "target": f"files"},
209
+ {"writer": "attachments_file", "target": "files"},
205
210
  )
206
211
 
207
212
  yield service_id, [
@@ -229,11 +234,11 @@ def fixtures_asynchronous_callback(*args, callback, **kwargs):
229
234
  )
230
235
  else:
231
236
  batch = None
232
- log.info(f"Fixtures progress: %s", callback)
237
+ log.info("Fixtures progress: %s", callback)
233
238
 
234
239
  if "error" in callback:
235
240
  log.error(
236
- f"Error in loading fixtures: %s\n%s\n%s",
241
+ "Error in loading fixtures: %s\n%s\n%s",
237
242
  callback,
238
243
  "\n".join(args),
239
244
  "\n".join(f"{kwarg}: {value}" for kwarg, value in kwargs.items()),
@@ -250,11 +255,11 @@ def fixtures_asynchronous_callback(*args, callback, **kwargs):
250
255
  for entry in batch.entries:
251
256
  if entry.errors:
252
257
  log.error(
253
- f"Errors in entry %s of batch %s:\npayload %s\n",
258
+ "Errors in entry %s of batch %s:\npayload %s\n",
254
259
  entry.seq,
255
260
  batch.seq,
256
261
  entry.entry,
257
262
  "\n".join(str(x) for x in entry.errors),
258
263
  )
259
- except Exception as e:
264
+ except Exception:
260
265
  print(f"Error in fixtures callback: {callback=}, {args=}, {kwargs=}")
@@ -2,6 +2,7 @@ from invenio_access.permissions import system_identity
2
2
  from invenio_pidstore.errors import PIDDoesNotExistError
3
3
  from invenio_records_resources.proxies import current_service_registry
4
4
  from invenio_records_resources.services.uow import UnitOfWork
5
+ from sqlalchemy.exc import NoResultFound
5
6
 
6
7
  from ...uow import BulkUnitOfWork
7
8
  from ..types import StreamBatch, StreamEntry, StreamEntryError
@@ -57,6 +58,9 @@ class ServiceWriter(BaseWriter):
57
58
  return self._service.read(self._identity, id_)
58
59
  except PIDDoesNotExistError:
59
60
  pass
61
+ except NoResultFound:
62
+ # vocabularies do not raise a PIDDoesNotExistError, they raise sql exception
63
+ pass
60
64
  return None
61
65
 
62
66
  def _get_stream_entry_id(self, entry: StreamEntry):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.124
3
+ Version: 1.5.126
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -11,7 +11,7 @@ oarepo_runtime/cli/base.py,sha256=94RBTa8TOSPxEyEUmYLGXaWen-XktP2-MIbTtZSlCZo,54
11
11
  oarepo_runtime/cli/cf.py,sha256=W0JEJK2JqKubQw8qtZJxohmADDRUBode4JZAqYLDGvc,339
12
12
  oarepo_runtime/cli/check.py,sha256=sCe2PeokSHvNOXHFZ8YHF8NMhsu5nYjyuZuvXHJ6X18,5092
13
13
  oarepo_runtime/cli/configuration.py,sha256=M_19zrS0vo-7uHi047a3i4rQsK6pmp4QS0IEBAxMLZ0,2039
14
- oarepo_runtime/cli/fixtures.py,sha256=l6zHpz1adjotrbFy_wcN2TOL8x20i-1jbQmaoEEo-UU,5419
14
+ oarepo_runtime/cli/fixtures.py,sha256=_aMQqPnspG0JuL5ewYTBa3HY1RaoOAI0V2R5q7e5frw,5570
15
15
  oarepo_runtime/cli/index.py,sha256=8Q2KZlAWjoMyZ9Ft9WIBJDws0ce15VF12o1tdYUP7AI,8936
16
16
  oarepo_runtime/cli/validate.py,sha256=HpSvHQCGHlrdgdpKix9cIlzlBoJEiT1vACZdMnOUGEY,2827
17
17
  oarepo_runtime/cli/permissions/__init__.py,sha256=2qufYdUoCb9kG7Zy0gKNW5lpRyqbVQSNsf7shLwrThM,198
@@ -25,7 +25,7 @@ oarepo_runtime/datastreams/catalogue.py,sha256=D6leq-FPT3RP3SniEAXPm66v3q8ZdQnaU
25
25
  oarepo_runtime/datastreams/datastreams.py,sha256=N9XXwIaBTADkPhE-XG6uotMwd-8Kn0vEZOoeV2BnMGI,4679
26
26
  oarepo_runtime/datastreams/errors.py,sha256=WyZLU53EdFJTLv6K2ooM_M6ISjLS-U1dDw6B7guOLSc,1540
27
27
  oarepo_runtime/datastreams/ext.py,sha256=ivugdVMCqwugK-5SeX14a-dMq6VaTt7DM2wFU357tR4,1406
28
- oarepo_runtime/datastreams/fixtures.py,sha256=LTzRLoS3hkdP7a7wX3fCNWplaxh0DQQjxGto3p1_Luk,8691
28
+ oarepo_runtime/datastreams/fixtures.py,sha256=oc3b1XP7gJmEXVskZTltZUasdeTux-wbgxox66OyIT8,8901
29
29
  oarepo_runtime/datastreams/json.py,sha256=OkIkGKUawtYoGelyS5V92DVk7Ei7SlkMMny2Ue2dDWc,132
30
30
  oarepo_runtime/datastreams/semi_asynchronous.py,sha256=kNc6BBnV6oFoY9kHgf5l8fd1wibRfI0dwyzLtu4fmUA,2940
31
31
  oarepo_runtime/datastreams/synchronous.py,sha256=t5lfnMkLqy3jK5zMl-nIuA0HlMPiHGjwCqZ8XQP-3GM,2595
@@ -42,7 +42,7 @@ oarepo_runtime/datastreams/writers/__init__.py,sha256=PWufWNrixFhXv5wSv3_pzmrimr
42
42
  oarepo_runtime/datastreams/writers/attachments_file.py,sha256=kV_IPAWawJ9PX-IfoncmLQXpdTbzRMsJie8uKX1vNp0,3161
43
43
  oarepo_runtime/datastreams/writers/attachments_service.py,sha256=g_tbjUA3YnTE5gP21zlG2kIxneZsn0q95EVjlxB8s1M,4152
44
44
  oarepo_runtime/datastreams/writers/publish.py,sha256=x_ipun8TQiYNvGokVnEppYw9ko1AyrSzHu3D8b3ZWzI,2126
45
- oarepo_runtime/datastreams/writers/service.py,sha256=GUnXVuRlJaBo19s7oeSG-vpFenah-NTursrX08UP-B4,6010
45
+ oarepo_runtime/datastreams/writers/service.py,sha256=PAMo0t_d-T4xGcO4VIIVaMOAqj7_tahXo-v-fTqKG8A,6199
46
46
  oarepo_runtime/datastreams/writers/utils.py,sha256=Lk_ZLNeXTLuFEn04lw1-6bJ7duG6kwA8X4wf9c_GiL4,1067
47
47
  oarepo_runtime/datastreams/writers/validation_errors.py,sha256=wOCXdniR6so_4ExpdFYYgBRyENp7_6kVFZM2L-Hy3G8,661
48
48
  oarepo_runtime/datastreams/writers/yaml.py,sha256=XchUJHQ58E2Mfgs8elImXbL38jFtI8Hfoye6yaR0gKI,1482
@@ -148,9 +148,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
148
148
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
149
149
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
150
150
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
151
- oarepo_runtime-1.5.124.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
152
- oarepo_runtime-1.5.124.dist-info/METADATA,sha256=t1V9nLySEgmPYmIiMh3qOxk9VpxOOc-GNg12ei7YHTA,4721
153
- oarepo_runtime-1.5.124.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
154
- oarepo_runtime-1.5.124.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
155
- oarepo_runtime-1.5.124.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
156
- oarepo_runtime-1.5.124.dist-info/RECORD,,
151
+ oarepo_runtime-1.5.126.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
152
+ oarepo_runtime-1.5.126.dist-info/METADATA,sha256=GURVSenQMBQuWZxCEi_eZgtoW8jNgbOXDvMKBc8EK-0,4721
153
+ oarepo_runtime-1.5.126.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
154
+ oarepo_runtime-1.5.126.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
155
+ oarepo_runtime-1.5.126.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
156
+ oarepo_runtime-1.5.126.dist-info/RECORD,,