dagster-cloud-cli 1.12.16rc1__py2.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.
Files changed (71) hide show
  1. dagster_cloud_cli/__init__.py +5 -0
  2. dagster_cloud_cli/commands/__init__.py +0 -0
  3. dagster_cloud_cli/commands/branch_deployment/__init__.py +154 -0
  4. dagster_cloud_cli/commands/ci/__init__.py +1207 -0
  5. dagster_cloud_cli/commands/ci/checks.py +135 -0
  6. dagster_cloud_cli/commands/ci/report.py +49 -0
  7. dagster_cloud_cli/commands/ci/state.py +129 -0
  8. dagster_cloud_cli/commands/ci/utils.py +22 -0
  9. dagster_cloud_cli/commands/config.py +250 -0
  10. dagster_cloud_cli/commands/deployment/__init__.py +108 -0
  11. dagster_cloud_cli/commands/deployment/alert_policies/__init__.py +0 -0
  12. dagster_cloud_cli/commands/deployment/alert_policies/commands.py +52 -0
  13. dagster_cloud_cli/commands/integration/__init__.py +6 -0
  14. dagster_cloud_cli/commands/integration/atlan/__init__.py +94 -0
  15. dagster_cloud_cli/commands/job/__init__.py +117 -0
  16. dagster_cloud_cli/commands/metrics.py +114 -0
  17. dagster_cloud_cli/commands/organization/__init__.py +134 -0
  18. dagster_cloud_cli/commands/organization/saml/__init__.py +0 -0
  19. dagster_cloud_cli/commands/organization/saml/commands.py +85 -0
  20. dagster_cloud_cli/commands/run/__init__.py +27 -0
  21. dagster_cloud_cli/commands/serverless/Dockerfile +38 -0
  22. dagster_cloud_cli/commands/serverless/Dockerfile.dagster-cloud-cli +20 -0
  23. dagster_cloud_cli/commands/serverless/__init__.py +560 -0
  24. dagster_cloud_cli/commands/workspace/__init__.py +358 -0
  25. dagster_cloud_cli/config/__init__.py +6 -0
  26. dagster_cloud_cli/config/jinja_template_loader.py +45 -0
  27. dagster_cloud_cli/config/list_merge_strategies.py +77 -0
  28. dagster_cloud_cli/config/loader.py +23 -0
  29. dagster_cloud_cli/config/merger.py +92 -0
  30. dagster_cloud_cli/config/models.py +76 -0
  31. dagster_cloud_cli/config_utils.py +506 -0
  32. dagster_cloud_cli/core/__init__.py +0 -0
  33. dagster_cloud_cli/core/agent_queue.py +3 -0
  34. dagster_cloud_cli/core/alert_types.py +26 -0
  35. dagster_cloud_cli/core/artifacts.py +192 -0
  36. dagster_cloud_cli/core/docker_runner.py +57 -0
  37. dagster_cloud_cli/core/errors.py +32 -0
  38. dagster_cloud_cli/core/graphql_client.py +420 -0
  39. dagster_cloud_cli/core/headers/__init__.py +0 -0
  40. dagster_cloud_cli/core/headers/auth.py +16 -0
  41. dagster_cloud_cli/core/headers/impl.py +31 -0
  42. dagster_cloud_cli/core/headers/versioning/__init__.py +0 -0
  43. dagster_cloud_cli/core/headers/versioning/constants.py +2 -0
  44. dagster_cloud_cli/core/pex_builder/__init__.py +8 -0
  45. dagster_cloud_cli/core/pex_builder/code_location.py +126 -0
  46. dagster_cloud_cli/core/pex_builder/deploy.py +255 -0
  47. dagster_cloud_cli/core/pex_builder/deps.py +495 -0
  48. dagster_cloud_cli/core/pex_builder/git_context.py +29 -0
  49. dagster_cloud_cli/core/pex_builder/github_context.py +178 -0
  50. dagster_cloud_cli/core/pex_builder/gitlab_context.py +30 -0
  51. dagster_cloud_cli/core/pex_builder/parse_workspace.py +39 -0
  52. dagster_cloud_cli/core/pex_builder/pex_registry.py +148 -0
  53. dagster_cloud_cli/core/pex_builder/platforms.py +6105 -0
  54. dagster_cloud_cli/core/pex_builder/selftest.py +14 -0
  55. dagster_cloud_cli/core/pex_builder/source.py +166 -0
  56. dagster_cloud_cli/core/pex_builder/util.py +165 -0
  57. dagster_cloud_cli/core/workspace.py +145 -0
  58. dagster_cloud_cli/docker_utils.py +98 -0
  59. dagster_cloud_cli/entrypoint.py +209 -0
  60. dagster_cloud_cli/gql.py +1025 -0
  61. dagster_cloud_cli/pex_utils.py +180 -0
  62. dagster_cloud_cli/py.typed +0 -0
  63. dagster_cloud_cli/types.py +78 -0
  64. dagster_cloud_cli/ui.py +101 -0
  65. dagster_cloud_cli/utils.py +107 -0
  66. dagster_cloud_cli/version.py +1 -0
  67. dagster_cloud_cli-1.12.16rc1.dist-info/METADATA +31 -0
  68. dagster_cloud_cli-1.12.16rc1.dist-info/RECORD +71 -0
  69. dagster_cloud_cli-1.12.16rc1.dist-info/WHEEL +5 -0
  70. dagster_cloud_cli-1.12.16rc1.dist-info/entry_points.txt +3 -0
  71. dagster_cloud_cli-1.12.16rc1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,5 @@
1
+ from dagster_shared.libraries import DagsterLibraryRegistry
2
+
3
+ from dagster_cloud_cli.version import __version__
4
+
5
+ DagsterLibraryRegistry.register("dagster-cloud-cli", __version__)
File without changes
@@ -0,0 +1,154 @@
1
+ import subprocess
2
+
3
+ import typer
4
+ from typer import Typer
5
+
6
+ from dagster_cloud_cli import gql, ui
7
+ from dagster_cloud_cli.config_utils import dagster_cloud_options
8
+ from dagster_cloud_cli.types import SnapshotBaseDeploymentCondition
9
+
10
+ app = Typer(help="Manage branch deployments for your organization.")
11
+
12
+ # https://git-scm.com/docs/git-log#Documentation/git-log.txt-emHem
13
+ HASH_PLACEHOLDER = "%H"
14
+ AUTHOR_EMAIL_PLACEHOLDER = "%ae"
15
+ AUTHOR_NAME_PLACEHOLDER = "%an"
16
+ TIMESTAMP_PLACEHOLDER = "%cd"
17
+ COMMIT_MESSAGE_PLACEHOLDER = "%s"
18
+
19
+ NEWLINE_PLACEHOLDER = "%n"
20
+
21
+ FORMAT_STRING = (
22
+ f"{HASH_PLACEHOLDER}{NEWLINE_PLACEHOLDER}{AUTHOR_EMAIL_PLACEHOLDER}{NEWLINE_PLACEHOLDER}"
23
+ f"{AUTHOR_NAME_PLACEHOLDER}{NEWLINE_PLACEHOLDER}{TIMESTAMP_PLACEHOLDER}{NEWLINE_PLACEHOLDER}{COMMIT_MESSAGE_PLACEHOLDER}"
24
+ )
25
+
26
+
27
+ def _read_git_state() -> str:
28
+ try:
29
+ return subprocess.check_output(
30
+ ["git", "log", "-1", f"--format={FORMAT_STRING}", "--date=unix"]
31
+ ).decode("utf-8")
32
+ except subprocess.CalledProcessError:
33
+ raise ui.error(
34
+ "Could not read git state, ensure you are in a valid git repository if passing"
35
+ " `--read-git-state`."
36
+ )
37
+
38
+
39
+ @app.command(name="create-or-update")
40
+ @dagster_cloud_options(allow_empty=True)
41
+ def create_or_update(
42
+ organization: str,
43
+ api_token: str,
44
+ url: str = typer.Option(
45
+ None,
46
+ "--url",
47
+ help=(
48
+ "[DEPRECATED] Your Dagster Cloud url, in the form of"
49
+ " 'https://{ORGANIZATION_NAME}.dagster.cloud'."
50
+ ),
51
+ hidden=True,
52
+ ),
53
+ repo_name: str = typer.Option(
54
+ ..., "--git-repo-name", "--repo-name", help="The name of the git repository."
55
+ ),
56
+ branch_name: str = typer.Option(
57
+ ..., "--branch-name", help="The name of the version control branch."
58
+ ),
59
+ commit_hash: str = typer.Option(None, help="The latest commit hash."),
60
+ timestamp: float = typer.Option(
61
+ None, help="The latest commit timestamp, in unix time (seconds since epoch)."
62
+ ),
63
+ branch_url: str = typer.Option(None, help="The URL of the version control branch."),
64
+ pull_request_url: str = typer.Option(
65
+ None,
66
+ "--code-review-url",
67
+ "--pull-request-url",
68
+ help="The URL to review this code, e.g. a Pull Request or Merge Request.",
69
+ ),
70
+ pull_request_status: str = typer.Option(None, help="The status of the pull request"),
71
+ pull_request_number: str = typer.Option(
72
+ None,
73
+ "--code-review-id",
74
+ "--pull-request-id",
75
+ help="An identifier for the code review for this branch, e.g. a Pull Request number.",
76
+ ),
77
+ commit_message: str = typer.Option(None, help="The commit message for the latest commit."),
78
+ author_name: str = typer.Option(None, help="The author name for the latest commit."),
79
+ author_email: str = typer.Option(None, help="The author email for the latest commit."),
80
+ author_avatar_url: str = typer.Option(
81
+ None, help="The URL for the avatar of the author for the latest commit, if any."
82
+ ),
83
+ read_git_state: bool = typer.Option(
84
+ False,
85
+ is_flag=True,
86
+ help="Whether to commit data (timestamp, hash, author info) from Git state.",
87
+ ),
88
+ base_deployment_name: str = typer.Option(
89
+ None,
90
+ help="The name of the deployment to use as the base deployment for the branch deployment.",
91
+ ),
92
+ snapshot_base_condition: SnapshotBaseDeploymentCondition | None = typer.Option(
93
+ None,
94
+ help="""
95
+ If and when to snapshot the definitions in the base deployment for highlighting changes in the branch:
96
+
97
+ \b
98
+ * None (default): No snapshots, branch is always compared to the live base deployment.
99
+ * on-create: Compare against a snapshot of the base deployment taken when the branch is first created.
100
+ * on-update: Compare against a snapshot that is updated every time the branch deployment is updated.
101
+ """,
102
+ show_default=False,
103
+ ),
104
+ ) -> None:
105
+ """Sets up or updates the branch deployment for the given git branch."""
106
+ if not url and not organization:
107
+ raise ui.error("Must provide either organization name or URL.")
108
+ if not url:
109
+ url = gql.url_from_config(organization=organization)
110
+
111
+ if read_git_state:
112
+ # Prints the following, separated by newlines:
113
+ # full commit hash, author email, author name, timestamp, message
114
+ git_out = _read_git_state()
115
+
116
+ commit_hash, author_email, author_name, timestamp_str, commit_message = git_out.split(
117
+ "\n", 4
118
+ )
119
+ timestamp = float(timestamp_str)
120
+
121
+ if not commit_hash or not timestamp:
122
+ raise ui.error(
123
+ "Must provide `--commit-hash` and `--timestamp` parameters, or pass `--read-git-state`"
124
+ " flag."
125
+ )
126
+
127
+ with gql.graphql_client_from_url(url, api_token) as client:
128
+ ui.print(
129
+ gql.create_or_update_branch_deployment(
130
+ client,
131
+ repo_name=repo_name,
132
+ branch_name=branch_name,
133
+ commit_hash=commit_hash,
134
+ timestamp=timestamp,
135
+ branch_url=branch_url,
136
+ pull_request_url=pull_request_url,
137
+ pull_request_status=pull_request_status,
138
+ pull_request_number=pull_request_number,
139
+ commit_message=commit_message,
140
+ author_name=author_name,
141
+ author_email=author_email,
142
+ author_avatar_url=author_avatar_url,
143
+ base_deployment_name=base_deployment_name,
144
+ snapshot_base_condition=snapshot_base_condition,
145
+ )
146
+ )
147
+
148
+
149
+ @app.command(name="delete")
150
+ @dagster_cloud_options(allow_empty=True, requires_url=True)
151
+ def delete(url: str, api_token: str, deployment: str):
152
+ """Allows deletion of a branch deployment by name."""
153
+ with gql.graphql_client_from_url(url, api_token) as client:
154
+ gql.delete_branch_deployment(client, deployment=deployment)