pipeline-eds 0.2.12__py3-none-any.whl → 0.2.14__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.
pipeline/cli.py CHANGED
@@ -1,9 +1,4 @@
1
1
  '''
2
- import typer
3
- from pathlib import Path
4
-
5
- app = typer.Typer()
6
-
7
2
  @app.command()
8
3
  def list_workspaces(workspaces_dir: Path = Path("workspaces")):
9
4
  """List valid mulch workspaces in the given directory."""
@@ -14,37 +9,52 @@ def list_workspaces(workspaces_dir: Path = Path("workspaces")):
14
9
  if path.is_dir() and (path / ".mulch").is_dir():
15
10
  typer.echo(f"🪴 {path.name}")
16
11
 
17
- @app.command()
18
- def list_mulch_folders(start: Path = Path(".")):
19
- """Recursively find folders containing a .mulch/ directory."""
20
- for path in start.rglob(".mulch"):
21
- typer.echo(f"📁 {path.parent}")
22
-
23
- @app.command()
24
- def inspect(workspace: Path):
25
- """Show scaffold or metadata info from a workspace."""
26
- metadata = workspace / ".mulch" / "mulch-scaffold.json"
27
- if metadata.exists():
28
- typer.echo(f"🔍 {workspace.name}: {metadata}")
29
- typer.echo(metadata.read_text())
30
- else:
31
- typer.echo(f"No scaffold found in {workspace}")
32
12
  '''
33
- # src/pipeline/cli.py
34
-
35
13
  import typer
36
14
  import importlib
37
15
  from pathlib import Path
16
+ from importlib.metadata import version, PackageNotFoundError
38
17
 
39
18
  from pipeline.env import SecretConfig
40
19
  #from pipeline.helpers import setup_logging
41
20
  from pipeline.workspace_manager import WorkspaceManager
42
21
 
22
+ ### Versioning
23
+ CLI_APP_NAME = "pipeline"
24
+ def print_version(value: bool):
25
+ if value:
26
+ try:
27
+ typer.secho(f"{CLI_APP_NAME} {PIPELINE_VERSION}",fg=typer.colors.GREEN, bold=True)
28
+ except PackageNotFoundError:
29
+ typer.echo("Version info not found")
30
+ raise typer.Exit()
31
+ try:
32
+ PIPELINE_VERSION = version(CLI_APP_NAME)
33
+ __version__ = version({CLI_APP_NAME})
34
+ except PackageNotFoundError:
35
+ PIPELINE_VERSION = "unknown"
36
+
37
+ try:
38
+ from importlib.metadata import version
39
+ __version__ = version({CLI_APP_NAME})
40
+ except PackageNotFoundError:
41
+ # fallback if running from source
42
+ try:
43
+ with open(Path(__file__).parent / "VERSION") as f:
44
+ __version__ = f.read().strip()
45
+ except FileNotFoundError:
46
+ __version__ = "dev"
47
+
48
+ ### Pipeline CLI
49
+
43
50
  app = typer.Typer(help="CLI for running pipeline workspaces.")
44
51
 
45
52
 
46
53
  @app.callback(invoke_without_command=True)
47
- def main(ctx: typer.Context):
54
+ def main(
55
+ ctx: typer.Context,
56
+ version: bool = typer.Option(None, "--version", callback=lambda v: print_version(v), is_eager=True, help="Show the version and exit.")
57
+ ):
48
58
  """
49
59
  Pipeline CLI – run workspaces built on the pipeline framework.
50
60
  """
@@ -52,6 +62,7 @@ def main(ctx: typer.Context):
52
62
  typer.echo(ctx.get_help())
53
63
  raise typer.Exit()
54
64
 
65
+
55
66
  @app.command()
56
67
  def run(
57
68
  workspace: str = typer.Option(None, help="Workspace to run"),
@@ -104,6 +115,8 @@ def trend(
104
115
  from pipeline.plotbuffer import PlotBuffer
105
116
  from pipeline import gui_fastapi_plotly_live
106
117
  from pipeline import environment
118
+ from pipeline.workspace_manager import WorkspaceManager
119
+ ws_dir = WorkspaceManager.ensure_workspace()
107
120
 
108
121
  # must set up %appdata for pip/x installation. Use mulch or yeoman for this. And have a secrets filler.
109
122
  if workspace is None:
@@ -0,0 +1,84 @@
1
+ # install_appdata.py
2
+ import typer
3
+ from pathlib import Path
4
+ import sys
5
+ import os
6
+ import shutil
7
+
8
+ app = typer.Typer(help="Manage mulch-like pipeline workspace installation")
9
+
10
+ def setup():
11
+ platform = sys.platform
12
+ if platform.startswith("win"):
13
+ from mulch import reg_winreg
14
+ # Always build LocalAppData mulch folder first
15
+
16
+ # Copy files
17
+ source_dir = Path(__file__).parent # this is src/mulch/scripts/install
18
+ target_dir = Path(os.environ['LOCALAPPDATA']) / "pipeline"
19
+ target_dir.mkdir(parents=True, exist_ok=True)
20
+
21
+ copy_mulch_installation_files(source_dir, target_dir)
22
+
23
+ # Registry
24
+ reg_winreg.call()
25
+ reg_winreg.verify_registry() # deterministic check
26
+
27
+ print("Mulch context menu installed successfully.")
28
+
29
+ elif platform.startswith("linux"):
30
+ thunar_action_dir = Path.home() / ".local/share/file-manager/actions"
31
+ thunar_action_dir.mkdir(parents=True, exist_ok=True)
32
+
33
+ menu_items = [
34
+ ("mulch-workspace.desktop", "mulch workspace"),
35
+ ("mulch-seed.desktop", "mulch seed"),
36
+ ]
37
+
38
+ for filename, label in menu_items:
39
+ src = Path(__file__).parent / filename
40
+ dest = thunar_action_dir / filename
41
+ if src.exists():
42
+ # Use copy2 to preserve metadata
43
+ shutil.copy2(src, dest)
44
+ os.chmod(dest, 0o755)
45
+ print(f"Installed `{label}` context menu item to {dest}")
46
+ else:
47
+ print(f"Skipping `{label}` context menu installation (no .desktop file found).")
48
+
49
+ elif platform == "darwin":
50
+ print("macOS detected: please implement context menu setup via Automator or Finder Service")
51
+ # You can extend this with AppleScript or Automator commands here
52
+ else:
53
+ raise RuntimeError(f"Unsupported platform for setup: {platform}")
54
+
55
+ def copy_mulch_installation_files(source_dir, target_dir):
56
+ required_files = [
57
+ "call-mulch-workspace.ps1",
58
+ "mulch-workspace.ps1",
59
+ "call-mulch-seed.ps1",
60
+ "mulch-seed.ps1",
61
+ "mulch-icon.ico",
62
+ ".mulchvision"
63
+ ]
64
+ missing_files = []
65
+ for f in required_files:
66
+ src = source_dir / f
67
+ if src.exists():
68
+ shutil.copy2(src, target_dir)
69
+ print(f"Copied {f} to {target_dir}")
70
+ else:
71
+ missing_files.append(f)
72
+
73
+ if missing_files:
74
+ raise FileNotFoundError(
75
+ f"Missing required files in {source_dir}: {', '.join(missing_files)}"
76
+ )
77
+
78
+ @app.command()
79
+ def install_appdata():
80
+ """Install the mulch workspace and mulch seed right-click context menu items."""
81
+ setup()
82
+
83
+ if __name__ == "__main__":
84
+ app()
@@ -26,6 +26,8 @@ class WorkspaceManager:
26
26
  SECRETS_YAML_FILE_NAME ='secrets.yaml'
27
27
  SECRETS_EXAMPLE_YAML_FILE_NAME ='secrets-example.yaml'
28
28
  DEFAULT_WORKSPACE_TOML_FILE_NAME = 'default-workspace.toml'
29
+ APP_NAME = "pipeline"
30
+
29
31
  TIMESTAMPS_JSON_FILE_NAME = 'timestamps_success.json'
30
32
  ROOT_DIR = Path(__file__).resolve().parents[2] # root directory
31
33
 
@@ -230,6 +232,29 @@ class WorkspaceManager:
230
232
  def name(self):
231
233
  return self.workspace_name
232
234
 
235
+ @classmethod
236
+ def get_appdata_dir(cls) -> Path:
237
+ """Return platform-appropriate appdata folder."""
238
+ if os.name == "nt": # Windows
239
+ base = Path(os.getenv("APPDATA", Path.home() / "AppData" / "Roaming"))
240
+ elif os.name == "posix" and "ANDROID_ROOT" in os.environ: # Termux
241
+ base = Path.home() / ".local" / "share"
242
+ else: # macOS/Linux
243
+ base = Path(os.getenv("XDG_DATA_HOME", Path.home() / ".local" / "share"))
244
+ return base / cls.APP_NAME
245
+
246
+ @classmethod
247
+ def ensure_workspace(cls) -> Path:
248
+ """Create workspace folder and default toml if missing."""
249
+ workspaces_dir = cls.get_appdata_dir() / "workspaces"
250
+ workspaces_dir.mkdir(parents=True, exist_ok=True)
251
+
252
+ default_file = workspaces_dir / cls.DEFAULT_WORKSPACE_TOML_FILE_NAME
253
+ if not default_file.exists():
254
+ default_file.write_text("# Default workspace config\n")
255
+ return workspaces_dir
256
+
257
+
233
258
  def establish_default_workspace():
234
259
  workspace_name = WorkspaceManager.identify_default_workspace_name()
235
260
  logging.info(f"workspace_name = {workspace_name}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pipeline-eds
3
- Version: 0.2.12
3
+ Version: 0.2.14
4
4
  Summary: The official API pipeline library for mulch-based projects. Key target: Emerson Ovation EDS REST API.
5
5
  License: BSD-3
6
6
  Author: George Clayton Bennett
@@ -5,7 +5,7 @@ pipeline/api/eds.py,sha256=M7XkSwDKb2wGs5j69yaAS8-5JwGbLfs6uVz70RjG6WQ,43714
5
5
  pipeline/api/rjn.py,sha256=Fhbc3tE_WgUywVJimnLzhWnxyMzGiIUu54hRFR3sdUA,7102
6
6
  pipeline/api/status_api.py,sha256=KJG7e4GXmTjqQxK3LFUcdAxj1jqzvNLJ0f9-tuisk00,202
7
7
  pipeline/calls.py,sha256=FexXJK0_fwgQMPx9dy5eFai_6xqVOsOGoEUw8yP3eSU,4187
8
- pipeline/cli.py,sha256=72UDPcGxiZfyiIVz1D1fGlL8Z9slH0OsbZG-TsbSFnQ,10221
8
+ pipeline/cli.py,sha256=NYBHPC7Wk3hbSN1RxsGXjfnseBI1Napn70LBDF1Lduc,10713
9
9
  pipeline/configrationmanager.py,sha256=UPqa91117jNm59vvTBE7sET1ThisqRf6B2Dhtk7x9tM,624
10
10
  pipeline/decorators.py,sha256=5fIIVqxSvQFaSI4ZkqPd3yqajzDxaRhgYwlC1jD2k5A,411
11
11
  pipeline/env.py,sha256=Ibs0K_wluUTJXCcBjUofZ1jexks-UmJ0dvbXhWPLdJ0,1922
@@ -13,6 +13,7 @@ pipeline/environment.py,sha256=nr-3rPsxjnuu6G0gri8X0AZhAI0h8thsdfbt34OWmzY,1454
13
13
  pipeline/gui_fastapi_plotly_live.py,sha256=JpRtA6qbCJ9XPJkd_YKAbLKUJRwiJexULkYONbJlriA,2383
14
14
  pipeline/gui_mpl_live.py,sha256=rDswqbN_JEq9rFoRCFVMlijThcB_oJqMiZvCfZGaFRw,3613
15
15
  pipeline/helpers.py,sha256=-GGFz5t22wlFfHwtEDwWOBslzguLXXSYNzxxRBvclLI,4457
16
+ pipeline/install_appdata.py,sha256=DGemGRogMVAmFzqSKladfxgLQOslIHyul2Xxq34do8A,2814
16
17
  pipeline/logging_setup.py,sha256=CAqWfchscCdzJ63Wf1dC3QGRnFnQqBELxyTmPZxsxgs,1674
17
18
  pipeline/pastehelpers.py,sha256=pkmtULW5Zk_-ffUDDp_VsGzruIjsNB1xAIPbb9jtofE,265
18
19
  pipeline/philosophy.py,sha256=QskLEpY3uZn46oyH7rHekOXiC55JqW3raThxwxaiM5U,1919
@@ -20,7 +21,7 @@ pipeline/plotbuffer.py,sha256=jCsFbT47TdR8Sq5tjj2JdhVELjRiebLPN7O4r2LjPeY,625
20
21
  pipeline/points_loader.py,sha256=4OCGLiatbP3D5hixVnYcFGThvBRYt_bf5DhNGdGw_9k,519
21
22
  pipeline/queriesmanager.py,sha256=QwPhDV39Z8mdAVDRXTF4ZPgc6JliMgLzucGaGZSlDac,5001
22
23
  pipeline/time_manager.py,sha256=gSK430SyHvhgUWLRg_z2nBiyad01v7ByyKafB138IkU,8351
23
- pipeline/workspace_manager.py,sha256=rrK0bUlQI8nB21SSWNVXUoC7HxHnrCbi7GAjaW2zF8M,11028
24
+ pipeline/workspace_manager.py,sha256=Xk-hO1pHE8VznUc6JDwe5uBTuUFWKUDlbJBa5U1PhIs,12057
24
25
  workspaces/default-workspace.toml,sha256=dI8y2l2WlEbIck6IZpbuQUP8-Bf48bBE1CKKsnVMc8w,300
25
26
  workspaces/eds_to_rjn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
27
  workspaces/eds_to_rjn/code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -55,8 +56,8 @@ workspaces/eds_to_rjn/scripts/daemon_runner.py,sha256=gBCYrJ-FYPCTt_l5O07_YNrrGj
55
56
  workspaces/eds_to_rjn/secrets/README.md,sha256=tWf2bhopA0C08C8ImtHNZoPde9ub-sLMjX6EMe7lyJw,600
56
57
  workspaces/eds_to_rjn/secrets/secrets-example.yaml,sha256=qKGrKsKBC0ulDQRVbr1zkfNlr8WPWK4lg5GAvTqZ-T4,365
57
58
  workspaces/eds_to_termux/..txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- pipeline_eds-0.2.12.dist-info/entry_points.txt,sha256=t1hTaepU6pSowdqa8OSzohoTbmDRLA3Jnp8MfqagwEs,103
59
- pipeline_eds-0.2.12.dist-info/LICENSE,sha256=LKdx0wS1t9vFZpbRhDg_iLQ6ny-XsXRwhKAoCfrF6iA,1501
60
- pipeline_eds-0.2.12.dist-info/METADATA,sha256=HFKEtFItZoyZXuw1Uk5cPX-IAr3ze1ekpO48vXiWs5Y,9974
61
- pipeline_eds-0.2.12.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
62
- pipeline_eds-0.2.12.dist-info/RECORD,,
59
+ pipeline_eds-0.2.14.dist-info/entry_points.txt,sha256=jmU0FQ7-2AHXhKcj4TXPn61xLbHlycHA2lkDlRZT-pg,124
60
+ pipeline_eds-0.2.14.dist-info/LICENSE,sha256=LKdx0wS1t9vFZpbRhDg_iLQ6ny-XsXRwhKAoCfrF6iA,1501
61
+ pipeline_eds-0.2.14.dist-info/METADATA,sha256=pTVOUltpX9wKH12UZKp5K0i1P-laAIw9hqmhBA8Jk5k,9974
62
+ pipeline_eds-0.2.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
+ pipeline_eds-0.2.14.dist-info/RECORD,,
@@ -1,4 +1,5 @@
1
1
  [console_scripts]
2
+ eds=pipeline.cli:app
2
3
  pipeline=pipeline.cli:app
3
4
 
4
5
  [scripts]