Warn about unknown labels in --include and --exclude options of dtc auto-curate. #42

Merged
cmo merged 3 commits from warn_on_non_existing_label into master 2026-06-16 08:34:54 +00:00
4 changed files with 20 additions and 3 deletions

View file

@ -1,3 +1,10 @@
# 0.2.18 (2026-06-16)
# Improvements
- Warn about unknown labels in `--include` and `--exclude` options of `dtc auto-curate`.
# 0.2.17 (2026-03-31) # 0.2.17 (2026-03-31)
## New features ## New features
@ -7,7 +14,7 @@
curated areas, if a matching records does not already exist. If curated areas, if a matching records does not already exist. If
`--jsonpath-spec JSONPATH_SPEC` is provided two records match if they are `--jsonpath-spec JSONPATH_SPEC` is provided two records match if they are
identical after all elements that match `JSONPATH_SPEC` are removed. If identical after all elements that match `JSONPATH_SPEC` are removed. If
`--jsonpath-spec` is not povided, two records match if they are identical. `--jsonpath-spec` is not provided, two records match if they are identical.
## Improvements ## Improvements

View file

@ -332,7 +332,9 @@ def auto_curate(
session=session, session=session,
) )
processed_labels = set()
for label in all_labels: for label in all_labels:
processed_labels.add(label)
if include and label not in include: if include and label not in include:
logger.debug('ignoring non-included incoming label: %s', label) logger.debug('ignoring non-included incoming label: %s', label)
continue continue
@ -445,6 +447,14 @@ def auto_curate(
if result != 0: if result != 0:
return result return result
for label_set, option_name in ((set(include), 'include'), (set(exclude), 'exclude')):
unknown_labels = label_set - processed_labels
if unknown_labels:
console.print(
f'[yellow]Warning[/yellow]: non-existing labels in --{option_name}: '
+ ', '.join(f'"{label}"' for label in unknown_labels)
)
if create_change_set: if create_change_set:
click.echo(str(create_change_set)) click.echo(str(create_change_set))
elif output is not None: elif output is not None:

View file

@ -1,6 +1,6 @@
[project] [project]
name = "dump-things-pyclient" name = "dump-things-pyclient"
version = "0.2.17" version = "0.2.18"
description = "A client library and CLI commands for dump-things-services" description = "A client library and CLI commands for dump-things-services"
readme = "README.md" readme = "README.md"
requires-python = ">=3.11" requires-python = ">=3.11"

2
uv.lock generated
View file

@ -417,7 +417,7 @@ wheels = [
[[package]] [[package]]
name = "dump-things-pyclient" name = "dump-things-pyclient"
version = "0.2.17" version = "0.2.18"
source = { virtual = "." } source = { virtual = "." }
dependencies = [ dependencies = [
{ name = "click" }, { name = "click" },