jerry-thomas 1.0.0__py3-none-any.whl → 1.0.2__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.
datapipeline/cli/app.py CHANGED
@@ -490,7 +490,10 @@ def main() -> None:
490
490
  args = parser.parse_args()
491
491
 
492
492
  # Resolve dataset/project selection for commands that use a project.
493
- if hasattr(args, "project") or hasattr(args, "dataset"):
493
+ needs_project_resolution = args.cmd in {"serve", "build", "inspect"}
494
+ if needs_project_resolution and (
495
+ hasattr(args, "project") or hasattr(args, "dataset")
496
+ ):
494
497
  raw_project = getattr(args, "project", None)
495
498
  raw_dataset = getattr(args, "dataset", None)
496
499
  resolved_project, resolved_dataset = _resolve_project_from_args(
@@ -1,10 +1,14 @@
1
+ import logging
1
2
  from pathlib import Path
2
3
  from datapipeline.services.scaffold.plugin import scaffold_plugin
3
4
 
4
5
 
6
+ logger = logging.getLogger(__name__)
7
+
8
+
5
9
  def bar(subcmd: str, name: str | None, out: str) -> None:
6
10
  if subcmd == "init":
7
11
  if not name:
8
- print("[error] Plugin name is required. Use 'jerry plugin init <name>' or pass -n/--name.")
12
+ logger.error("Plugin name is required. Use 'jerry plugin init <name>' or pass -n/--name.")
9
13
  raise SystemExit(2)
10
14
  scaffold_plugin(name, Path(out))
@@ -1,23 +1,29 @@
1
1
  from importlib.resources import as_file, files
2
2
  from pathlib import Path
3
+ import logging
4
+ import os
5
+
6
+ import yaml
7
+
8
+ from datapipeline.utils.load import load_yaml
3
9
 
4
10
  from ..constants import DEFAULT_IO_LOADER_EP
5
11
 
12
+ logger = logging.getLogger(__name__)
13
+
6
14
  _RESERVED_PACKAGE_NAMES = {"datapipeline"}
7
15
 
8
16
 
9
17
  def _normalized_package_name(dist_name: str) -> str:
10
18
  package_name = dist_name.replace("-", "_")
11
19
  if package_name in _RESERVED_PACKAGE_NAMES:
12
- print(
13
- "[error] `datapipeline` is reserved for the core package. "
14
- "Choose a different plugin name."
20
+ logger.error(
21
+ "`datapipeline` is reserved for the core package. Choose a different plugin name."
15
22
  )
16
23
  raise SystemExit(1)
17
24
  if not package_name.isidentifier():
18
- print(
19
- "[error] Plugin names must be valid Python identifiers once hyphens are replaced "
20
- "with underscores."
25
+ logger.error(
26
+ "Plugin names must be valid Python identifiers once hyphens are replaced with underscores."
21
27
  )
22
28
  raise SystemExit(1)
23
29
  return package_name
@@ -26,7 +32,7 @@ def _normalized_package_name(dist_name: str) -> str:
26
32
  def scaffold_plugin(name: str, outdir: Path) -> None:
27
33
  target = (outdir / name).absolute()
28
34
  if target.exists():
29
- print(f"[error] `{target}` already exists")
35
+ logger.error("`%s` already exists", target)
30
36
  raise SystemExit(1)
31
37
  import shutil
32
38
 
@@ -46,4 +52,42 @@ def scaffold_plugin(name: str, outdir: Path) -> None:
46
52
  for placeholder, value in replacements.items():
47
53
  text = text.replace(placeholder, value)
48
54
  p.write_text(text)
49
- print(f"[new] plugin skeleton at {target}")
55
+
56
+ # Move jerry.yaml up to the workspace root (current working directory) so
57
+ # users can run the CLI from the workspace without cd'ing into the plugin.
58
+ # We adjust plugin_root and dataset paths to point at the plugin directory
59
+ # relative to the workspace. Do not overwrite an existing workspace
60
+ # jerry.yaml.
61
+ plugin_jerry = target / "jerry.yaml"
62
+ workspace_root = Path.cwd().resolve()
63
+ workspace_jerry = workspace_root / "jerry.yaml"
64
+ if plugin_jerry.exists() and not workspace_jerry.exists():
65
+ try:
66
+ plugin_root_rel = target.relative_to(workspace_root)
67
+ except ValueError:
68
+ # Fall back to a relative path between arbitrary directories; this
69
+ # may include ".." segments.
70
+ try:
71
+ plugin_root_rel = Path(os.path.relpath(target, workspace_root))
72
+ except Exception:
73
+ plugin_root_rel = target
74
+
75
+ data = load_yaml(plugin_jerry)
76
+ data["plugin_root"] = plugin_root_rel.as_posix()
77
+ datasets = data.get("datasets") or {}
78
+ updated_datasets = {}
79
+ for alias, path in datasets.items():
80
+ p = Path(path)
81
+ if p.is_absolute():
82
+ updated_datasets[alias] = p.as_posix()
83
+ else:
84
+ updated_datasets[alias] = (plugin_root_rel / p).as_posix()
85
+ data["datasets"] = updated_datasets
86
+
87
+ workspace_jerry.write_text(
88
+ yaml.safe_dump(data, sort_keys=False), encoding="utf-8"
89
+ )
90
+ plugin_jerry.unlink()
91
+ logger.info("workspace jerry.yaml created at %s", workspace_jerry)
92
+
93
+ logger.info("plugin skeleton created at %s", target)
@@ -10,6 +10,8 @@ Quick start
10
10
  - HTTP data: `jerry source add <provider>.<dataset> -t http -f <json|json-lines|csv>`
11
11
  - Synthetic: `jerry source add -p <provider> -d <dataset> -t synthetic`
12
12
  - Edit the generated `config/sources/*.yaml` to fill in the `path`, delimiter, etc.
13
+ - `jerry.yaml` is placed in your workspace root (alongside the plugin folder) so
14
+ you can run CLI commands from there; `plugin_root` points back to this plugin.
13
15
  - Reinstall after EP changes (pyproject.toml) and restart Python processes:
14
16
  - Core: `cd lib/datapipeline && python -m pip install -e .`
15
17
  - This plugin: `python -m pip install -e .`
@@ -1,28 +1,34 @@
1
- # Workspace defaults. Move this file to the root of your workspace if you serve
2
- # configs outside the plugin repo; the CLI searches upward from cwd for jerry.yaml.
1
+ # Workspace defaults. The scaffolder copies this to your workspace root (where
2
+ # you ran `jerry plugin init`). CLI commands walk upward from cwd to find it.
3
3
 
4
- plugin_root: . # relative path to the plugin repo root
4
+ # Relative path from this workspace file back to the plugin root.
5
+ plugin_root: . # e.g., "lib/myplugin" if your plugin lives under lib/
5
6
 
7
+ # Dataset aliases for `--dataset`; values may be dirs (auto-append project.yaml).
6
8
  datasets:
7
9
  example: example/project.yaml
8
10
  your-second-example-dataset: your-dataset/project.yaml
9
11
 
12
+ # Default dataset alias when --dataset/--project are omitted.
10
13
  default_dataset: example
11
14
 
15
+ # Shared fallbacks used by all commands (unless overridden).
12
16
  shared:
13
17
  visuals: AUTO # AUTO | TQDM | RICH | OFF
14
18
  progress: BARS # AUTO | SPINNER | BARS | OFF
15
- log_level: INFO
19
+ log_level: INFO # Default log level when not set elsewhere
16
20
 
21
+ # Defaults for `jerry serve` (run-time options).
17
22
  serve:
18
- # log_level: INFO
19
- limit: null
20
- stage: null
23
+ # log_level: INFO # Uncomment to force INFO for serve runs
24
+ limit: null # Cap vectors; null means unlimited
25
+ stage: null # Preview a specific stage; null runs the full pipeline
21
26
  output:
22
27
  transport: stdout
23
- format: print # set to fs + directory for file outputs
24
- # directory: artifacts/serve
28
+ format: print # stdout: print|json-lines|json|csv|pickle
29
+ # directory: artifacts/serve # Required when transport=fs
25
30
 
31
+ # Defaults for `jerry build` (artifact materialization).
26
32
  build:
27
- # log_level: INFO
33
+ # log_level: INFO # Uncomment to set build log level
28
34
  mode: AUTO # AUTO | FORCE | OFF
@@ -7,5 +7,5 @@ name = "{{DIST_NAME}}"
7
7
  version = "0.0.1"
8
8
  description = "A DataPipeline plugin for the {{DIST_NAME}} domain"
9
9
  dependencies = [
10
- "jerry-thomas>=0.2.0",
10
+ "jerry-thomas>=1.0.2",
11
11
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jerry-thomas
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Jerry-Thomas: a stream-first, plugin-friendly data pipeline (mixology-themed CLI)
5
5
  Author: Anders Skott Lind
6
6
  License: MIT
@@ -14,14 +14,14 @@ datapipeline/build/tasks/metadata.py,sha256=3eHI1vBRwm-fT342gu1wgj7oXNXKZ94D30wk
14
14
  datapipeline/build/tasks/scaler.py,sha256=knJbdeGdDvYZ4O15ra4mnVkmLZbRZbCdJdjfELe_LnU,2554
15
15
  datapipeline/build/tasks/schema.py,sha256=kJnAlD_Z8Pd_c9kJH5bDVixB_Vi_mBkKWpjW7eZru1s,2163
16
16
  datapipeline/build/tasks/utils.py,sha256=iFMJ8hWk1iRnQ1bUz0huiKlWyevt3x0g8Vh6PNzlMU8,6335
17
- datapipeline/cli/app.py,sha256=yjaKjEbQbDUAvigU5D8Q2UPbKFRs9l8bHVIG-56Nrsc,24056
17
+ datapipeline/cli/app.py,sha256=KZDTdig3IvSZBq4M3kcxz-RkbOTBEu2sdBUDdS-QWSg,24174
18
18
  datapipeline/cli/commands/build.py,sha256=OPJ-r3WWAzWwa1wHK0zxnQhuM_1h1mSfNpPRl_Bqrf8,8979
19
19
  datapipeline/cli/commands/contract.py,sha256=bPWhWZgdnkk_Ajlm9zUJrvZ3SlyXVqBxx-IJV1zZ5kM,14953
20
20
  datapipeline/cli/commands/domain.py,sha256=JdOMlfpZP996kuNGePdjCGMKrqezo-cX8lhlOfd9F44,479
21
21
  datapipeline/cli/commands/filter.py,sha256=vhoCIETJNUJmiI37ZdBNaeJAm6O4AU_tveJxVj47S8A,307
22
22
  datapipeline/cli/commands/inspect.py,sha256=aatn_olRcFaLyya6r2QMlzzAzlbguEtQ7mKRxoEOFAA,16066
23
23
  datapipeline/cli/commands/list_.py,sha256=m9o_exiiC_aiQXsR4lZv_QmN1hfpSNq4ICvYLgiS2e8,1605
24
- datapipeline/cli/commands/plugin.py,sha256=RER1aBiiITYyvCtWxaqAiEqUGJGzKhw6oWSeajtd5ns,374
24
+ datapipeline/cli/commands/plugin.py,sha256=jUMBrxLw0QX61a2wf7rRGAWFg42xLZkI-C-HyUHiob4,427
25
25
  datapipeline/cli/commands/run.py,sha256=TmbyggYOlF972oxwLhh-r27ggeWARg0_WfCMQJAudS8,8348
26
26
  datapipeline/cli/commands/run_config.py,sha256=zeXCuDz1ez6Zd6Tq2N0S-YIPs1ZQ8U3fN3lvvd56108,3194
27
27
  datapipeline/cli/commands/serve_pipeline.py,sha256=7i1HbuFIbYKkM-aQ2BrDN57K1kFv6NJ4EAN6NOz4aFE,5036
@@ -104,7 +104,7 @@ datapipeline/services/scaffold/__init__.py,sha256=PaQNtYki9Kc7mQPnUtKDPU-rKohLHo
104
104
  datapipeline/services/scaffold/domain.py,sha256=mww7HhZ1ZepNvn2tHczpLZH0y3Ej7vgDGVLepFkTgIY,946
105
105
  datapipeline/services/scaffold/filter.py,sha256=EwLFeI3cRoHw-hYE3jlLfqV0DKk9Z8EnWyVymJmOppA,1084
106
106
  datapipeline/services/scaffold/mappers.py,sha256=kkkJ-UB51B2yawRoUst3CGExn3gRYPm5d_3kbujPVMQ,1960
107
- datapipeline/services/scaffold/plugin.py,sha256=bocH4Z1k3ReqnfLSzdXLiQP4SG9R97kZ5hj14_7GYFM,1699
107
+ datapipeline/services/scaffold/plugin.py,sha256=Eecb-OUJsn-upsq2vC88JYOyYTRbrIxsPu4yYorziqs,3407
108
108
  datapipeline/services/scaffold/source.py,sha256=w0w-oID9x48eMV6c0FhqW1myAWh_ELYmFojsdfVlaTk,6649
109
109
  datapipeline/services/scaffold/templates.py,sha256=B3YnZpFUZLynijJosTNxZQLXnPP_Y_t1RHqfI1lGOxU,634
110
110
  datapipeline/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -124,9 +124,9 @@ datapipeline/sources/synthetic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
124
124
  datapipeline/sources/synthetic/time/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  datapipeline/sources/synthetic/time/loader.py,sha256=X_NQJFAHL8wHV5TxbLhRwqGfFJPOw6qVToBkKFD3r_k,2003
126
126
  datapipeline/sources/synthetic/time/parser.py,sha256=d3GZMQ7L1Qi4LeEm7U3y0_pk0RdhskioQukYyqyoqic,343
127
- datapipeline/templates/plugin_skeleton/README.md,sha256=lRaDeFPK-r1qPUYmPkTztfHptVfbxlKmCOgKaAJJaHc,7490
128
- datapipeline/templates/plugin_skeleton/jerry.yaml,sha256=ubM5REHH5gEqbCBuUIBXRsSx6iuJjQ96yzn7RQBDMpk,705
129
- datapipeline/templates/plugin_skeleton/pyproject.toml,sha256=0lmO5Aia9tB81Ez4SxP56DGisekx-palMmGCUzmAl4E,259
127
+ datapipeline/templates/plugin_skeleton/README.md,sha256=L1FvFQrubqbnHbK8qB_Hz38JeYKlTQu5rjqDfhIVANw,7652
128
+ datapipeline/templates/plugin_skeleton/jerry.yaml,sha256=TYfZl0_HMnfj6F3oaSWq25Vb1BZlpILIIMU1N0U4L28,1343
129
+ datapipeline/templates/plugin_skeleton/pyproject.toml,sha256=gMSwoLK_Xv51ecQq5ufKpXj-Oi7JNRroK7cmP0nTsvY,259
130
130
  datapipeline/templates/plugin_skeleton/example/dataset.yaml,sha256=cSKk8IyoJebdc9b959Sw7gDfBXl2BT8hktyZ4Z43Nog,471
131
131
  datapipeline/templates/plugin_skeleton/example/postprocess.yaml,sha256=yUYr5c6YtBeF_rm_ENsOMkn_sOAChzbqhL98WKr0CRw,710
132
132
  datapipeline/templates/plugin_skeleton/example/project.yaml,sha256=4WyrlBCZZ47ceOw9nV8QgqU7_jH5Fu8-z4SJGKbPYK8,845
@@ -191,9 +191,9 @@ datapipeline/utils/placeholders.py,sha256=epZQ7NifUWI7_7hZKGEkCBDOaMnN9LiqJdI2gv
191
191
  datapipeline/utils/rich_compat.py,sha256=4ZfR82gG1vAVUiILVINqcRReqoUiRPmQOlLLBXz-pC0,1166
192
192
  datapipeline/utils/time.py,sha256=vOqa2arqwEqbDo-JWEhOFPMnI1E4Ib3i1L-Rt-cGH8c,1072
193
193
  datapipeline/utils/window.py,sha256=J5CkEIdY5iZd1QY9wawmHpBXpCp2FzHOHXhjYTCZWl8,2576
194
- jerry_thomas-1.0.0.dist-info/licenses/LICENSE,sha256=pkBMylAJF5yChHAkdxwFhEptLGx13i-XFEKh-Sh6DkM,1073
195
- jerry_thomas-1.0.0.dist-info/METADATA,sha256=lcnvJMQUbZ_cECGZhmkZz0zOvGZlVOtym3A1X_SaVNw,33507
196
- jerry_thomas-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
197
- jerry_thomas-1.0.0.dist-info/entry_points.txt,sha256=jsJFp_2aEEhKkL2I3Yc4yPSODy9ggDZmLeV75KPjb9A,1672
198
- jerry_thomas-1.0.0.dist-info/top_level.txt,sha256=N8aoNPdPyHefODO4YAm7tqTaUcw0e8LDcqycFTf8TbM,13
199
- jerry_thomas-1.0.0.dist-info/RECORD,,
194
+ jerry_thomas-1.0.2.dist-info/licenses/LICENSE,sha256=pkBMylAJF5yChHAkdxwFhEptLGx13i-XFEKh-Sh6DkM,1073
195
+ jerry_thomas-1.0.2.dist-info/METADATA,sha256=LaFPs7mVS4d-9j2SHSkU0RGlPSUMvYD6EJAEaqU_Bp8,33507
196
+ jerry_thomas-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
197
+ jerry_thomas-1.0.2.dist-info/entry_points.txt,sha256=jsJFp_2aEEhKkL2I3Yc4yPSODy9ggDZmLeV75KPjb9A,1672
198
+ jerry_thomas-1.0.2.dist-info/top_level.txt,sha256=N8aoNPdPyHefODO4YAm7tqTaUcw0e8LDcqycFTf8TbM,13
199
+ jerry_thomas-1.0.2.dist-info/RECORD,,