Skip to content

Commit 2b02c5b

Browse files
committed
Merge pull request #251
2 parents 059ce2d + 71c1736 commit 2b02c5b

File tree

7 files changed

+59
-23
lines changed

7 files changed

+59
-23
lines changed

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
# Maintain dependencies for GitHub Actions
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
- package-ecosystem: "pip" # See documentation for possible values
14+
directory: "/" # Location of package manifests
15+
schedule:
16+
interval: "daily"
17+
ignore:
18+
- dependency-name: "*"
19+
# patch and minor updates don't matter for libraries as consumers of this library build
20+
# with their own lockfile, rather than the version specified in this library's lockfile
21+
# remove this ignore rule if your package has binaries to ensure that the binaries are
22+
# built with the exact set of dependencies and those are up to date.
23+
update-types:
24+
- "version-update:semver-patch"
25+
- "version-update:semver-minor"

.github/workflows/backend-checks.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ on:
77
tags-ignore:
88
- v*
99
paths:
10-
- 'karp-backend/**'
11-
- '!karp-backend/README.md'
10+
- 'karp/**'
11+
- 'tests/**'
12+
- 'grammars/**'
13+
- 'assets/**'
14+
- '*.toml'
1215
pull_request:
1316
branches:
1417
- '**/*'
1518
paths:
16-
- 'karp-backend/**'
19+
- 'karp/**'
20+
- 'tests/**'
21+
- 'grammars/**'
22+
- 'assets/**'
23+
- '*.toml'
1724
workflow_dispatch:
1825

1926
env:

.github/workflows/backend-tests.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ on:
55
branches:
66
- "**/*"
77
paths:
8-
- 'karp-backend/**/*.py'
9-
- 'karp-backend/pyproject.toml'
10-
- 'karp-lex-core/**/*.py'
8+
- 'karp/**'
9+
- 'tests/**'
10+
- 'grammars/**'
11+
- 'assets/**'
12+
- '*.toml'
1113
pull_request:
1214
branches:
1315
- "**/*"
1416
paths:
15-
- 'karp-backend/**/*.py'
16-
- 'karp-backend/pyproject.toml'
17-
- 'karp-lex-core/**/*.py'
17+
- 'karp/**'
18+
- 'tests/**'
19+
- 'grammars/**'
20+
- 'assets/**'
21+
- '*.toml'
1822
workflow_dispatch:
1923

2024
env:

karp/cliapp/subapps/entries_subapp.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from typing import Iterable, Optional
66

77

8-
import json_streams
9-
import json_streams.jsonlib
8+
import json_arrays
9+
import json_arrays.jsonlib
1010
from sb_json_tools import jt_val
1111
import typer
1212

@@ -40,7 +40,7 @@ def add_entries_to_resource(
4040
entry_commands = inject_from_ctx(EntryCommands, ctx)
4141
user = user or "local admin"
4242
message = message or "imported through cli"
43-
entries = tqdm(json_streams.load_from_file(data), desc="Adding", unit=" entries")
43+
entries = tqdm(json_arrays.load_from_file(data), desc="Adding", unit=" entries")
4444
if chunked:
4545
entry_commands.add_entries_in_chunks(
4646
resource_id=resource_id,
@@ -74,7 +74,7 @@ def import_entries_to_resource(
7474
entry_commands = inject_from_ctx(EntryCommands, ctx)
7575
user = user or "local admin"
7676
message = message or "imported through cli"
77-
entries = tqdm(json_streams.load_from_file(data), desc="Importing", unit=" entries")
77+
entries = tqdm(json_arrays.load_from_file(data), desc="Importing", unit=" entries")
7878
if chunked:
7979
entry_commands.import_entries_in_chunks(
8080
resource_id=resource_id,
@@ -114,7 +114,7 @@ def export_entries(
114114
"exporting entries",
115115
extra={"resource_id": resource_id, "type(all_entries)": type(all_entries)},
116116
)
117-
json_streams.dump(
117+
json_arrays.dump(
118118
(entry.dict() for entry in all_entries),
119119
output,
120120
)
@@ -138,7 +138,7 @@ def batch_entries(
138138
"""
139139
logger.info("run entries command in batch")
140140
entry_commands = inject_from_ctx(EntryCommands, ctx) # type: ignore[type-abstract]
141-
for cmd_outer in json_streams.load_from_file(data):
141+
for cmd_outer in json_arrays.load_from_file(data):
142142
cmd = cmd_outer["cmd"]
143143
command_type = cmd["cmdtype"]
144144
del cmd["cmdtype"]
@@ -206,7 +206,7 @@ def validate_entries(
206206
raise typer.Exit(301)
207207

208208
if config_path:
209-
config = json_streams.jsonlib.load_from_file(config_path)
209+
config = json_arrays.jsonlib.load_from_file(config_path)
210210
elif resource_id_raw:
211211
repo = inject_from_ctx(ResourceQueries, ctx=ctx)
212212
if resource := repo.by_resource_id(resource_id_raw):
@@ -223,12 +223,12 @@ def validate_entries(
223223

224224
error_code = 0
225225

226-
entries: Iterable[dict] = json_streams.load_from_file(path, use_stdin_as_default=True)
226+
entries: Iterable[dict] = json_arrays.load_from_file(path, use_stdin_as_default=True)
227227
if as_import:
228228
entries = (import_entry["entry"] for import_entry in entries)
229-
with json_streams.sink_from_file(
229+
with json_arrays.sink_from_file(
230230
err_output, use_stderr_as_default=True
231-
) as error_sink, json_streams.sink_from_file(
231+
) as error_sink, json_arrays.sink_from_file(
232232
output, use_stdout_as_default=True
233233
) as correct_sink:
234234
error_counter = Counter(error_sink)

karp/cliapp/subapps/query_subapp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path # noqa: I001
22
from typing import Optional
33

4-
import json_streams
4+
import json_arrays
55
import typer
66

77
from karp import search
@@ -20,7 +20,7 @@ def resource(
2020
):
2121
search_service = inject_from_ctx(EsSearchService, ctx)
2222
query_request = search.QueryRequest(resource_ids=[resource_id])
23-
json_streams.dump_to_file(
23+
json_arrays.dump_to_file(
2424
search_service.query(query_request),
2525
output,
2626
use_stdout_as_default=True,

karp/cliapp/subapps/resource_subapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Callable, List, Optional, TypeVar
44

55
import typer
6-
from json_streams import jsonlib
6+
from json_arrays import jsonlib
77
from tabulate import tabulate
88

99
from karp.foundation.value_objects import UniqueIdStr, unique_id

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ elasticsearch-dsl = "^8"
4444
environs = "^9.3.4"
4545
fastapi = "^0.89.0"
4646
injector = "^0.20.1"
47-
json-streams = "^0.12.0"
4847
mysqlclient = { version = "^2.1.1", optional = true }
4948
pydantic = "^1.10.2"
5049
pyjwt = { version = "^2.6.0", extras = ["crypto"] }
@@ -60,6 +59,7 @@ ulid-py = "^1.1.0"
6059
urllib3 = "^1.26.13"
6160
asgi-matomo = "^0.4.1"
6261
frozendict = "^2.4"
62+
json-arrays = "^0.14.1"
6363

6464
[tool.poetry.extras]
6565
mysql = ["mysqlclient", "PyMySQL", "aiomysql"]

0 commit comments

Comments
 (0)