deployml-core 0.0.54__tar.gz → 0.0.56__tar.gz

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.
Files changed (86) hide show
  1. {deployml_core-0.0.54 → deployml_core-0.0.56}/PKG-INFO +1 -1
  2. {deployml_core-0.0.54 → deployml_core-0.0.56}/pyproject.toml +1 -1
  3. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/cli/cli.py +155 -2
  4. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/constants.py +1 -0
  5. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/helpers.py +24 -0
  6. {deployml_core-0.0.54 → deployml_core-0.0.56}/LICENSE +0 -0
  7. {deployml_core-0.0.54 → deployml_core-0.0.56}/README.md +0 -0
  8. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/__init__.py +0 -0
  9. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/api.py +0 -0
  10. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/cli/__init__.py +0 -0
  11. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/diagnostics/__init__.py +0 -0
  12. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/diagnostics/doctor.py +0 -0
  13. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/enum/__init__.py +0 -0
  14. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/enum/cloud_provider.py +0 -0
  15. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/enum/deployment_type.py +0 -0
  16. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook/__init__.py +0 -0
  17. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook/deployment.py +0 -0
  18. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook/display.py +0 -0
  19. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook/stack.py +0 -0
  20. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook/urls.py +0 -0
  21. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/notebook.py +0 -0
  22. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/base_main.tf.j2 +0 -0
  23. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/main.tf.j2 +0 -0
  24. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/mlflow_main.tf.j2 +0 -0
  25. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/terraform.tfvars.j2 +0 -0
  26. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/variables.tf.j2 +0 -0
  27. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_run/wandb_main.tf.j2 +0 -0
  28. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_vm/main.tf.j2 +0 -0
  29. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_vm/terraform.tfvars.j2 +0 -0
  30. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/gcp/cloud_vm/variables.tf.j2 +0 -0
  31. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/kubernetes_local/deployment.yaml.j2 +0 -0
  32. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/kubernetes_local/mlflow-deployment.yaml.j2 +0 -0
  33. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/kubernetes_local/mlflow-service.yaml.j2 +0 -0
  34. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/templates/kubernetes_local/service.yaml.j2 +0 -0
  35. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cloud_sql_postgres/main.tf +0 -0
  36. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cloud_sql_postgres/outputs.tf +0 -0
  37. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cloud_sql_postgres/variables.tf +0 -0
  38. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cron/cloud/gcp/cloud_run/main.tf +0 -0
  39. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cron/cloud/gcp/cloud_run/outputs.tf +0 -0
  40. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/cron/cloud/gcp/cloud_run/variables.tf +0 -0
  41. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/explainability_monitoring/cloud/gcp/cloud_run/main.tf +0 -0
  42. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/explainability_monitoring/cloud/gcp/cloud_run/outputs.tf +0 -0
  43. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/explainability_monitoring/cloud/gcp/cloud_run/variables.tf +0 -0
  44. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fairness_monitoring/cloud/gcp/cloud_run/main.tf +0 -0
  45. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fairness_monitoring/cloud/gcp/cloud_run/outputs.tf +0 -0
  46. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fairness_monitoring/cloud/gcp/cloud_run/variables.tf +0 -0
  47. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fastapi/cloud/gcp/cloud_run/main.tf +0 -0
  48. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fastapi/cloud/gcp/cloud_run/outputs.tf +0 -0
  49. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/fastapi/cloud/gcp/cloud_run/variables.tf +0 -0
  50. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_run/main.tf +0 -0
  51. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_run/outputs.tf +0 -0
  52. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_run/variables.tf +0 -0
  53. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_vm/feast_env.tpl +0 -0
  54. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_vm/main.tf +0 -0
  55. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_vm/outputs.tf +0 -0
  56. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/feast/cloud/gcp/cloud_vm/variables.tf +0 -0
  57. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/grafana/cloud/gcp/cloud_run/main.tf +0 -0
  58. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/grafana/cloud/gcp/cloud_run/outputs.tf +0 -0
  59. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/grafana/cloud/gcp/cloud_run/variables.tf +0 -0
  60. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/mlflow/cloud/gcp/cloud_run/main.tf +0 -0
  61. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/mlflow/cloud/gcp/cloud_run/outputs.tf +0 -0
  62. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/mlflow/cloud/gcp/cloud_run/variables.tf +0 -0
  63. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/mlflow/cloud/gcp/cloud_vm/main.tf +0 -0
  64. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/mlflow/cloud/gcp/cloud_vm/variables.tf +0 -0
  65. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/offline_scoring/cloud/gcp/cloud_run/main.tf +0 -0
  66. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/offline_scoring/cloud/gcp/cloud_run/outputs.tf +0 -0
  67. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/offline_scoring/cloud/gcp/cloud_run/variables.tf +0 -0
  68. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/cloud_function/main.py +0 -0
  69. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/cloud_function/requirements.txt +0 -0
  70. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/cloudbuild.yaml +0 -0
  71. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/main.tf +0 -0
  72. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/outputs.tf +0 -0
  73. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/teardown_script.sh +0 -0
  74. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/teardown/cloud/gcp/variables.tf +0 -0
  75. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/wandb/cloud/gcp/cloud_run/main.tf +0 -0
  76. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/wandb/cloud/gcp/cloud_run/outputs.tf +0 -0
  77. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/wandb/cloud/gcp/cloud_run/variables.tf +0 -0
  78. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/wandb/cloud/gcp/cloud_vm/main.tf +0 -0
  79. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/terraform/modules/wandb/cloud/gcp/cloud_vm/variables.tf +0 -0
  80. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/__init__.py +0 -0
  81. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/banner.py +0 -0
  82. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/infracost.py +0 -0
  83. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/kubernetes_gke.py +0 -0
  84. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/kubernetes_local.py +0 -0
  85. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/menu.py +0 -0
  86. {deployml_core-0.0.54 → deployml_core-0.0.56}/src/deployml/utils/teardown.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deployml-core
3
- Version: 0.0.54
3
+ Version: 0.0.56
4
4
  Summary: Infra for academia
5
5
  License-File: LICENSE
6
6
  Author: Drew Hoang
@@ -1,7 +1,7 @@
1
1
 
2
2
  [project]
3
3
  name = "deployml-core"
4
- version = "0.0.54"
4
+ version = "0.0.56"
5
5
  description = "Infra for academia"
6
6
  authors = [
7
7
  {name = "Drew Hoang", email = "codentell@gmail.com"},
@@ -23,6 +23,8 @@ import string
23
23
  from google.cloud import storage
24
24
  import hashlib
25
25
 
26
+ from deployml.notebook.docker import build_images
27
+
26
28
  # Import refactored utility functions
27
29
  from deployml.utils.helpers import (
28
30
  check,
@@ -34,6 +36,7 @@ from deployml.utils.helpers import (
34
36
  cleanup_cloud_sql_resources,
35
37
  cleanup_terraform_files,
36
38
  run_terraform_with_loading_bar,
39
+ _create_docker_folder,
37
40
  )
38
41
  from deployml.utils.infracost import (
39
42
  check_infracost_available,
@@ -707,8 +710,22 @@ def generate():
707
710
  )
708
711
 
709
712
  # Write configuration to file
710
- config_filename = f"{name}.yaml"
711
- import yaml
713
+ config_filename = "config.yaml"
714
+
715
+ if not config_filename.exists():
716
+ typer.secho(
717
+ "config.yaml not found. Run 'mlops-infra init' first.",
718
+ fg=typer.colors.RED,
719
+ )
720
+ raise typer.Exit(code=1)
721
+
722
+ if not force:
723
+ confirm = typer.confirm(
724
+ "This will overwrite the existing config.yaml. Continue?"
725
+ )
726
+ if not confirm:
727
+ typer.echo("Aborted.")
728
+ raise typer.Exit()
712
729
 
713
730
  with open(config_filename, "w") as f:
714
731
  yaml.dump(config, f, default_flow_style=False, sort_keys=False)
@@ -1828,9 +1845,23 @@ def init(
1828
1845
  project_id: str = typer.Option(
1829
1846
  "", "--project-id", "-j", help="Project ID (for GCP)"
1830
1847
  ),
1848
+ path: Path = typer.Option(
1849
+ Path.cwd(),
1850
+ "--path",
1851
+ help="Directory where project should be initialized.",
1852
+ ),
1853
+ overwrite: bool = typer.Option(
1854
+ False,
1855
+ "--overwrite",
1856
+ help="Overwrite existing docker folder if it exists.",
1857
+ ),
1831
1858
  ):
1832
1859
  """
1833
1860
  Initialize cloud project by enabling required APIs/services before deployment.
1861
+
1862
+ This creates:
1863
+ - docker/ folder with Dockerfile templates
1864
+ - config.yaml template
1834
1865
  """
1835
1866
  if provider == "gcp":
1836
1867
  if not project_id:
@@ -1865,6 +1896,46 @@ def init(
1865
1896
  else:
1866
1897
  typer.echo(f" Unknown provider: {provider}")
1867
1898
  raise typer.Exit(code=1)
1899
+
1900
+ project_root = Path(path)
1901
+ try:
1902
+ project_root.mkdir(parents=True, exist_ok=True)
1903
+
1904
+ # ----------------------------------------
1905
+ # Create docker folder
1906
+ # ----------------------------------------
1907
+ _create_docker_folder(project_root, overwrite=overwrite)
1908
+
1909
+ # ----------------------------------------
1910
+ # Create config.yaml
1911
+ # ----------------------------------------
1912
+ config_path = project_root / "config.yaml"
1913
+
1914
+ if config_path.exists() and not overwrite:
1915
+ raise FileExistsError(
1916
+ f"{config_path} already exists. Use --overwrite to replace."
1917
+ )
1918
+
1919
+ config_template = {
1920
+ "# Run `mlops-infra generate` to create your config"
1921
+ }
1922
+
1923
+ with open(config_path, "w") as f:
1924
+ yaml.dump(config_template, f, sort_keys=False)
1925
+
1926
+ typer.secho("Project initialized successfully.", fg=typer.colors.GREEN)
1927
+ typer.echo()
1928
+ typer.echo("Created:")
1929
+ typer.echo(" - docker/")
1930
+ typer.echo(" - config.yaml")
1931
+ typer.echo()
1932
+ typer.echo("Next steps:")
1933
+ typer.echo(" 1. Edit config.yaml")
1934
+ typer.echo(" 2. Build images with: mlops-infra build-images --docker-root docker")
1935
+
1936
+ except Exception as e:
1937
+ typer.secho(f"Error: {e}", fg=typer.colors.RED)
1938
+ raise typer.Exit(code=1)
1868
1939
 
1869
1940
 
1870
1941
  @cli.command()
@@ -2215,6 +2286,88 @@ def gke_apply(
2215
2286
  typer.echo(f" Check: {manifests_dir}")
2216
2287
 
2217
2288
 
2289
+ @cli.command("build-images")
2290
+ def build_images_command(
2291
+ docker_root: Path = typer.Option(
2292
+ ...,
2293
+ "--docker-root",
2294
+ "-d",
2295
+ help="Path to folder containing subfolders with Dockerfiles.",
2296
+ exists=True,
2297
+ file_okay=False,
2298
+ dir_okay=True,
2299
+ resolve_path=True,
2300
+ ),
2301
+ gcp_project: Optional[str] = typer.Option(
2302
+ None,
2303
+ "--gcp-project",
2304
+ "-p",
2305
+ help="If provided, images will be built using Cloud Build in this GCP project.",
2306
+ ),
2307
+ region: str = typer.Option(
2308
+ "us-central1",
2309
+ "--region",
2310
+ help="GCP region for Artifact Registry.",
2311
+ ),
2312
+ repository: str = typer.Option(
2313
+ "mlops-images",
2314
+ "--repository",
2315
+ help="Artifact Registry repository name.",
2316
+ ),
2317
+ tag: str = typer.Option(
2318
+ "latest",
2319
+ "--tag",
2320
+ "-t",
2321
+ help="Image tag to apply.",
2322
+ ),
2323
+ create_repo: bool = typer.Option(
2324
+ False,
2325
+ "--create-repo",
2326
+ help="Create the Artifact Registry repository if it does not exist (GCP mode only).",
2327
+ ),
2328
+ dry_run: bool = typer.Option(
2329
+ False,
2330
+ "--dry-run",
2331
+ help="Show what would be built without executing Docker or gcloud commands.",
2332
+ ),
2333
+ ):
2334
+ """
2335
+ Build all Docker images found in subdirectories of the given folder.
2336
+
2337
+ Local mode:
2338
+ Builds using Docker.
2339
+
2340
+ GCP mode:
2341
+ Uses Cloud Build and pushes to Artifact Registry.
2342
+
2343
+ --dry-run prints commands without executing them.
2344
+ """
2345
+
2346
+ if create_repo and not gcp_project:
2347
+ typer.secho(
2348
+ "--create-repo can only be used with --gcp-project.",
2349
+ fg=typer.colors.RED,
2350
+ )
2351
+ raise typer.Exit(code=1)
2352
+
2353
+ try:
2354
+ build_images(
2355
+ docker_root=docker_root,
2356
+ gcp_project_id=gcp_project,
2357
+ region=region,
2358
+ repository=repository,
2359
+ tag=tag,
2360
+ create_repo=create_repo,
2361
+ dry_run=dry_run,
2362
+ )
2363
+
2364
+ if not dry_run:
2365
+ typer.secho("Image build completed successfully.", fg=typer.colors.GREEN)
2366
+
2367
+ except Exception as e:
2368
+ typer.secho(f"Error building images: {e}", fg=typer.colors.RED)
2369
+ raise typer.Exit(code=1)
2370
+
2218
2371
  def main():
2219
2372
  """
2220
2373
  Entry point for the DeployML CLI.
@@ -48,4 +48,5 @@ REQUIRED_GCP_APIS = [
48
48
  "monitoring.googleapis.com",
49
49
  "logging.googleapis.com",
50
50
  "artifactregistry.googleapis.com",
51
+ "cloudbuild.googleapis.com",
51
52
  ]
@@ -1,5 +1,6 @@
1
1
  import shutil
2
2
  import subprocess
3
+ import importlib.resources as pkg_resources
3
4
  from pathlib import Path
4
5
  from typing import Optional
5
6
  from google.cloud import storage
@@ -464,3 +465,26 @@ def run_terraform_with_loading_bar(cmd, cwd, estimated_minutes, stack=None):
464
465
  return returncode
465
466
  finally:
466
467
  f.close() # Always close the file
468
+
469
+
470
+ def _create_docker_folder(
471
+ project_root: Path,
472
+ overwrite: bool = False,
473
+ ) -> None:
474
+ docker_target = project_root / "docker"
475
+
476
+ if docker_target.exists() and not overwrite:
477
+ raise FileExistsError(
478
+ f"{docker_target} already exists. Use --overwrite to replace."
479
+ )
480
+
481
+ if docker_target.exists():
482
+ shutil.rmtree(docker_target)
483
+
484
+ docker_target.mkdir(parents=True, exist_ok=True)
485
+
486
+ templates = pkg_resources.files("deployml") / "docker"
487
+
488
+ for item in templates.iterdir():
489
+ if item.is_dir():
490
+ shutil.copytree(item, docker_target / item.name)
File without changes
File without changes