dump-things-pyclient 0.1.2__py3-none-any.whl → 0.1.4__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.
@@ -64,6 +64,12 @@ def _main():
64
64
  default=[],
65
65
  help='exclude an inbox on the source collection (repeatable)',
66
66
  )
67
+ argument_parser.add_argument(
68
+ '-i', '--include',
69
+ action='append',
70
+ default=[],
71
+ help='process only the given inbox, all other inboxes are ignored (repeatable, -e/--exclude is applied after inclusion)',
72
+ )
67
73
  argument_parser.add_argument(
68
74
  '-l', '--list-labels',
69
75
  action='store_true',
@@ -79,6 +85,11 @@ def _main():
79
85
  action='append',
80
86
  help='if provided, process only records that match the given PIDs. NOTE: matching does not involve CURIE-resolution!',
81
87
  )
88
+ argument_parser.add_argument(
89
+ '-d', '--dry-run',
90
+ action='store_true',
91
+ help='if provided, do not alter any data, instead print what would be done',
92
+ )
82
93
  arguments = argument_parser.parse_args()
83
94
 
84
95
  curator_token = os.environ.get(token_name)
@@ -107,6 +118,10 @@ def _main():
107
118
  collection=arguments.collection,
108
119
  token=curator_token):
109
120
 
121
+ if arguments.include and label not in arguments.include:
122
+ logger.debug('ignoring non-included incoming label: %s', label)
123
+ continue
124
+
110
125
  if label in arguments.exclude:
111
126
  logger.debug('ignoring excluded incoming label: %s', label)
112
127
  continue
@@ -141,7 +156,7 @@ def _main():
141
156
  # `record_dir+stl`, or `sqlite+stl`.
142
157
  try:
143
158
  class_name = re.search('([_A-Za-z0-9]*$)', record['schema_type']).group(0)
144
- except IndexError:
159
+ except (IndexError, KeyError):
145
160
  global stl_info
146
161
  if not stl_info:
147
162
  print(
@@ -159,6 +174,11 @@ def _main():
159
174
  flush=True)
160
175
  continue
161
176
 
177
+ if arguments.dry_run:
178
+ print(f'WRITE record "{record["pid"]}" of class "{class_name}" to "{destination_collection}@{destination_url}"')
179
+ print(f'DELETE record "{record["pid"]}" from inbox "{label}" of "{arguments.collection}@{arguments.service_url}"')
180
+ continue
181
+
162
182
  # Store record in destination collection
163
183
  curated_write_record(
164
184
  service_url=destination_url,
@@ -5,10 +5,17 @@ import json
5
5
  import re
6
6
  import sys
7
7
 
8
- from dump_things_service.converter import (
9
- Format,
10
- FormatConverter,
11
- )
8
+ # The try-except clause is required because marking scripts as optional does
9
+ # not work. That means, even scripts marked as optional are always installed
10
+ # (see <https://stackoverflow.com/questions/77501716/pyproject-toml-setuptools-how-can-i-specify-optional-scripts-and-modules>)
11
+ try:
12
+ from dump_things_service.converter import (
13
+ Format,
14
+ FormatConverter,
15
+ )
16
+ except ImportError:
17
+ print(f"Please install 'dump-things-pyclient[ttl]' to use this command.")
18
+ sys.exit(0)
12
19
 
13
20
 
14
21
  description = f"""Read JSON records from stdin and convert them to TTL
@@ -48,6 +48,7 @@ def _main():
48
48
 
49
49
  result = get_paginated(
50
50
  url=arguments.url,
51
+ token=token,
51
52
  first_page=arguments.first_page,
52
53
  page_size=arguments.page_size,
53
54
  last_page=arguments.last_page,
@@ -1,12 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dump-things-pyclient
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A client library and some CLI command for dump-things-services
5
5
  Author-email: Christian Mönch <christian.moench@web.de>
6
6
  Requires-Python: >=3.11
7
7
  Description-Content-Type: text/markdown
8
- Requires-Dist: dump-things-service>=5.3.0
9
8
  Requires-Dist: requests>=2.32.5
9
+ Provides-Extra: ttl
10
+ Requires-Dist: dump-things-service>=5.3.0; extra == "ttl"
11
+ Provides-Extra: tests
12
+ Requires-Dist: pytest>=9.0.1; extra == "tests"
10
13
 
11
14
  # Dump Things Python Client
12
15
 
@@ -0,0 +1,13 @@
1
+ dump_things_pyclient/__init__.py,sha256=cn-U3TRIalN6aYHp1cMBRkQm1x98XBwquLFbgFEIf_Q,113
2
+ dump_things_pyclient/communicate.py,sha256=CTkgEigu16BmLrlJScMQKhHLI_W4SywDb4HCwAICWzA,30523
3
+ dump_things_pyclient/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ dump_things_pyclient/commands/auto_curate.py,sha256=T2aUQ1NWWr9OMUw0vQveMen4d18y6-gY4xcyajX9ACY,7716
5
+ dump_things_pyclient/commands/get_records.py,sha256=ErNC75ukrMTlOmKz6y1yF9F7HqJ-KdzksH4qMDnXPBI,6969
6
+ dump_things_pyclient/commands/json2ttl.py,sha256=8BkvdjLWZ_H0L6fTmuR2M2MglKiMUiuNUcuWr_w6_dQ,2133
7
+ dump_things_pyclient/commands/post_records.py,sha256=3Q0aPMVtXG6azRzzVa0pBzZYJaAi3VqkLHjGwK0X6To,1503
8
+ dump_things_pyclient/commands/read_pages.py,sha256=YuJUJeM_YwGR6D2-YJg1HYY2uD6j27QEItFXs5TzvYQ,3214
9
+ dump_things_pyclient-0.1.4.dist-info/METADATA,sha256=PWlmmLd1zo0YKdiu7ZNjOzEVcCuaq8Q6GTT0CGRGSl8,942
10
+ dump_things_pyclient-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ dump_things_pyclient-0.1.4.dist-info/entry_points.txt,sha256=-LKTUNP6RJWBrzjXY8xdMhQsTS1zgvRsLJpsO7FipmQ,317
12
+ dump_things_pyclient-0.1.4.dist-info/top_level.txt,sha256=Asvruw-SyLoYhWis1CFOx89RGxpjXoTZVGoq4JSGt88,21
13
+ dump_things_pyclient-0.1.4.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- dump_things_pyclient/__init__.py,sha256=cn-U3TRIalN6aYHp1cMBRkQm1x98XBwquLFbgFEIf_Q,113
2
- dump_things_pyclient/communicate.py,sha256=CTkgEigu16BmLrlJScMQKhHLI_W4SywDb4HCwAICWzA,30523
3
- dump_things_pyclient/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- dump_things_pyclient/commands/auto_curate.py,sha256=nq3aM5Kyj4f_CPELxsS5PVBCPwc0RvrCbPUCpEOYZu8,6797
5
- dump_things_pyclient/commands/get_records.py,sha256=ErNC75ukrMTlOmKz6y1yF9F7HqJ-KdzksH4qMDnXPBI,6969
6
- dump_things_pyclient/commands/json2ttl.py,sha256=LDt-F0p3MpXjx9SRiRMyGJo1BrQnnt7U_BJfOLJz8xo,1716
7
- dump_things_pyclient/commands/post_records.py,sha256=3Q0aPMVtXG6azRzzVa0pBzZYJaAi3VqkLHjGwK0X6To,1503
8
- dump_things_pyclient/commands/read_pages.py,sha256=Td94LrXFucGhxfmew5gHieVGVVGfkNKeI-r5c3S15FU,3193
9
- dump_things_pyclient-0.1.2.dist-info/METADATA,sha256=dagb5n61DoNbMxtOVWlYjHf_Xapjx7TxF1YnXRWuXzY,837
10
- dump_things_pyclient-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- dump_things_pyclient-0.1.2.dist-info/entry_points.txt,sha256=-LKTUNP6RJWBrzjXY8xdMhQsTS1zgvRsLJpsO7FipmQ,317
12
- dump_things_pyclient-0.1.2.dist-info/top_level.txt,sha256=Asvruw-SyLoYhWis1CFOx89RGxpjXoTZVGoq4JSGt88,21
13
- dump_things_pyclient-0.1.2.dist-info/RECORD,,