dagster-shared 1.11.8__tar.gz → 1.11.9__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.
- {dagster_shared-1.11.8/dagster_shared.egg-info → dagster_shared-1.11.9}/PKG-INFO +1 -1
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/plus/config.py +58 -0
- dagster_shared-1.11.9/dagster_shared/plus/config_utils.py +186 -0
- dagster_shared-1.11.9/dagster_shared/version.py +1 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9/dagster_shared.egg-info}/PKG-INFO +1 -1
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/SOURCES.txt +1 -0
- dagster_shared-1.11.8/dagster_shared/version.py +0 -1
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/LICENSE +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/MANIFEST.in +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/README.md +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/README.md +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/builder.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/decorator.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/functions.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/check/record.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/cli/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/dagster_model/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/dagster_model/pydantic_compat_layer.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/error.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/ipc.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/libraries/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/match.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/merger.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/modules.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/plus/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/plus/login_server.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/py.typed +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/record/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/scaffold/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/errors.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/definition_metadata.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/defs_state_info.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/package_entry.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/serdes.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/utils.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/seven/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/seven/abc.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/seven/compat/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/seven/json.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/seven/temp_dir.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/telemetry/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/cached_method.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/config.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/hash.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/test.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/timing.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/utils/warnings.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/yaml_utils/__init__.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/yaml_utils/sample_yaml.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/yaml_utils/source_position.py +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/dependency_links.txt +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/not-zip-safe +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/requires.txt +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/top_level.txt +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/setup.cfg +0 -0
- {dagster_shared-1.11.8 → dagster_shared-1.11.9}/setup.py +0 -0
|
@@ -67,6 +67,64 @@ class DagsterPlusCliConfig:
|
|
|
67
67
|
_, _, raw_plus_config, _ = result
|
|
68
68
|
return cls(**raw_plus_config)
|
|
69
69
|
|
|
70
|
+
@classmethod
|
|
71
|
+
def create_for_deployment(
|
|
72
|
+
cls,
|
|
73
|
+
deployment: Optional[str],
|
|
74
|
+
organization: Optional[str] = None,
|
|
75
|
+
user_token: Optional[str] = None,
|
|
76
|
+
) -> "DagsterPlusCliConfig":
|
|
77
|
+
"""Create a DagsterPlusCliConfig instance for deployment-scoped operations.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
deployment: The deployment name to target
|
|
81
|
+
organization: Organization name (if None, will try to load from existing config)
|
|
82
|
+
user_token: User token (if None, will try to load from existing config)
|
|
83
|
+
"""
|
|
84
|
+
# Try to get base config if it exists, but don't require it
|
|
85
|
+
base_config = {}
|
|
86
|
+
if cls.exists():
|
|
87
|
+
try:
|
|
88
|
+
base_config = cls.get().__dict__
|
|
89
|
+
except Exception:
|
|
90
|
+
# If config exists but is invalid, start with empty base
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
return cls(
|
|
94
|
+
url=base_config.get("url"),
|
|
95
|
+
organization=organization or base_config.get("organization"),
|
|
96
|
+
default_deployment=deployment, # Override with specific deployment
|
|
97
|
+
user_token=user_token or base_config.get("user_token"),
|
|
98
|
+
agent_timeout=base_config.get("agent_timeout"),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def create_for_organization(
|
|
103
|
+
cls, organization: Optional[str] = None, user_token: Optional[str] = None
|
|
104
|
+
) -> "DagsterPlusCliConfig":
|
|
105
|
+
"""Create a DagsterPlusCliConfig instance for organization-scoped operations.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
organization: Organization name (if None, will try to load from existing config)
|
|
109
|
+
user_token: User token (if None, will try to load from existing config)
|
|
110
|
+
"""
|
|
111
|
+
# Try to get base config if it exists, but don't require it
|
|
112
|
+
base_config = {}
|
|
113
|
+
if cls.exists():
|
|
114
|
+
try:
|
|
115
|
+
base_config = cls.get().__dict__
|
|
116
|
+
except Exception:
|
|
117
|
+
# If config exists but is invalid, start with empty base
|
|
118
|
+
pass
|
|
119
|
+
|
|
120
|
+
return cls(
|
|
121
|
+
url=base_config.get("url"),
|
|
122
|
+
organization=organization or base_config.get("organization"),
|
|
123
|
+
default_deployment=None, # No deployment for organization-scoped operations
|
|
124
|
+
user_token=user_token or base_config.get("user_token"),
|
|
125
|
+
agent_timeout=base_config.get("agent_timeout"),
|
|
126
|
+
)
|
|
127
|
+
|
|
70
128
|
def write(self):
|
|
71
129
|
existing_config = _get_dagster_plus_config_path_and_raw_config()
|
|
72
130
|
if existing_config is None:
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
import os
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from dagster_shared.plus.config import DagsterPlusCliConfig
|
|
8
|
+
|
|
9
|
+
# Constants for CLI arguments and environment variables
|
|
10
|
+
DEPLOYMENT_CLI_ARGUMENT = "deployment"
|
|
11
|
+
DEPLOYMENT_ENV_VAR_NAME = "DAGSTER_CLOUD_DEPLOYMENT"
|
|
12
|
+
|
|
13
|
+
ORGANIZATION_CLI_ARGUMENT = "organization"
|
|
14
|
+
ORGANIZATION_ENV_VAR_NAME = "DAGSTER_CLOUD_ORGANIZATION"
|
|
15
|
+
|
|
16
|
+
TOKEN_CLI_ARGUMENT = "api_token"
|
|
17
|
+
TOKEN_ENV_VAR_NAME = "DAGSTER_CLOUD_API_TOKEN"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_deployment(ctx: Optional[click.Context] = None) -> Optional[str]:
|
|
21
|
+
"""Gets the configured deployment to target.
|
|
22
|
+
Highest precedence is a deployment argument, then `DAGSTER_CLOUD_DEPLOYMENT` env var, then config file default.
|
|
23
|
+
"""
|
|
24
|
+
if ctx and ctx.params.get(DEPLOYMENT_CLI_ARGUMENT):
|
|
25
|
+
return ctx.params[DEPLOYMENT_CLI_ARGUMENT]
|
|
26
|
+
|
|
27
|
+
env_value = os.getenv(DEPLOYMENT_ENV_VAR_NAME)
|
|
28
|
+
if env_value:
|
|
29
|
+
return env_value
|
|
30
|
+
|
|
31
|
+
# Fall back to config file
|
|
32
|
+
if DagsterPlusCliConfig.exists():
|
|
33
|
+
try:
|
|
34
|
+
config = DagsterPlusCliConfig.get()
|
|
35
|
+
return config.default_deployment
|
|
36
|
+
except Exception:
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def get_organization(ctx: Optional[click.Context] = None) -> Optional[str]:
|
|
43
|
+
"""Gets the configured organization to target.
|
|
44
|
+
Highest precedence is an organization argument, then `DAGSTER_CLOUD_ORGANIZATION` env var, then config file.
|
|
45
|
+
"""
|
|
46
|
+
if ctx and ctx.params.get(ORGANIZATION_CLI_ARGUMENT):
|
|
47
|
+
return ctx.params[ORGANIZATION_CLI_ARGUMENT]
|
|
48
|
+
|
|
49
|
+
env_value = os.getenv(ORGANIZATION_ENV_VAR_NAME)
|
|
50
|
+
if env_value:
|
|
51
|
+
return env_value
|
|
52
|
+
|
|
53
|
+
# Fall back to config file
|
|
54
|
+
if DagsterPlusCliConfig.exists():
|
|
55
|
+
try:
|
|
56
|
+
config = DagsterPlusCliConfig.get()
|
|
57
|
+
return config.organization
|
|
58
|
+
except Exception:
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_user_token(ctx: Optional[click.Context] = None) -> Optional[str]:
|
|
65
|
+
"""Gets the configured user token to use.
|
|
66
|
+
Highest precedence is an api-token argument, then `DAGSTER_CLOUD_API_TOKEN` env var, then config file.
|
|
67
|
+
"""
|
|
68
|
+
if ctx and ctx.params.get(TOKEN_CLI_ARGUMENT):
|
|
69
|
+
return ctx.params[TOKEN_CLI_ARGUMENT]
|
|
70
|
+
|
|
71
|
+
env_value = os.getenv(TOKEN_ENV_VAR_NAME)
|
|
72
|
+
if env_value:
|
|
73
|
+
return env_value
|
|
74
|
+
|
|
75
|
+
# Fall back to config file
|
|
76
|
+
if DagsterPlusCliConfig.exists():
|
|
77
|
+
try:
|
|
78
|
+
config = DagsterPlusCliConfig.get()
|
|
79
|
+
return config.user_token
|
|
80
|
+
except Exception:
|
|
81
|
+
pass
|
|
82
|
+
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Click option definitions for reuse across commands
|
|
87
|
+
DEPLOYMENT_OPTION = click.option(
|
|
88
|
+
"--deployment",
|
|
89
|
+
"-d",
|
|
90
|
+
help="Deployment to target.",
|
|
91
|
+
envvar=DEPLOYMENT_ENV_VAR_NAME,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
ORGANIZATION_OPTION = click.option(
|
|
95
|
+
"--organization",
|
|
96
|
+
"-o",
|
|
97
|
+
help="Organization to target.",
|
|
98
|
+
envvar=ORGANIZATION_ENV_VAR_NAME,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
TOKEN_OPTION = click.option(
|
|
102
|
+
"--api-token",
|
|
103
|
+
help="Dagster Cloud API token.",
|
|
104
|
+
envvar=TOKEN_ENV_VAR_NAME,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
VIEW_GRAPHQL_OPTION = click.option(
|
|
108
|
+
"--view-graphql",
|
|
109
|
+
is_flag=True,
|
|
110
|
+
help="Print GraphQL queries and responses to stderr for debugging.",
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def dg_api_options(
|
|
115
|
+
deployment_scoped: bool = False,
|
|
116
|
+
organization_scoped: bool = False,
|
|
117
|
+
):
|
|
118
|
+
"""Apply this decorator to Click commands to add organization, deployment, and token options.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
deployment_scoped: If True, requires deployment to be specified and validates it
|
|
122
|
+
organization_scoped: If True, only requires organization (deployment is optional)
|
|
123
|
+
"""
|
|
124
|
+
if deployment_scoped and organization_scoped:
|
|
125
|
+
raise ValueError("Cannot specify both deployment_scoped and organization_scoped")
|
|
126
|
+
|
|
127
|
+
if not deployment_scoped and not organization_scoped:
|
|
128
|
+
raise ValueError("Must specify either deployment_scoped or organization_scoped")
|
|
129
|
+
|
|
130
|
+
def decorator(func):
|
|
131
|
+
# Add options in reverse order (Click applies them in reverse)
|
|
132
|
+
func = VIEW_GRAPHQL_OPTION(func)
|
|
133
|
+
func = TOKEN_OPTION(func)
|
|
134
|
+
func = ORGANIZATION_OPTION(func)
|
|
135
|
+
|
|
136
|
+
if deployment_scoped:
|
|
137
|
+
func = DEPLOYMENT_OPTION(func)
|
|
138
|
+
|
|
139
|
+
@functools.wraps(func)
|
|
140
|
+
def wrapper(*args, **kwargs):
|
|
141
|
+
ctx = click.get_current_context()
|
|
142
|
+
|
|
143
|
+
# Check if we're in test mode with DgApiTestContext
|
|
144
|
+
# Import here to avoid circular imports
|
|
145
|
+
from dagster_dg_cli.cli.api.client import DgApiTestContext
|
|
146
|
+
|
|
147
|
+
if ctx.obj and isinstance(ctx.obj, DgApiTestContext):
|
|
148
|
+
organization = ctx.obj.organization
|
|
149
|
+
deployment = ctx.obj.deployment if deployment_scoped else None
|
|
150
|
+
api_token = None
|
|
151
|
+
view_graphql = False # Default to False in test mode
|
|
152
|
+
else:
|
|
153
|
+
# Get resolved values using precedence chain
|
|
154
|
+
organization = get_organization(ctx)
|
|
155
|
+
deployment = get_deployment(ctx) if deployment_scoped else None
|
|
156
|
+
api_token = get_user_token(ctx)
|
|
157
|
+
view_graphql = kwargs.get("view_graphql", False)
|
|
158
|
+
|
|
159
|
+
if not organization:
|
|
160
|
+
raise click.UsageError(
|
|
161
|
+
"A Dagster Cloud organization must be specified.\n\n"
|
|
162
|
+
"You may specify an organization by:\n"
|
|
163
|
+
f"- Providing the --organization parameter\n"
|
|
164
|
+
f"- Setting the {ORGANIZATION_ENV_VAR_NAME} environment variable"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
if deployment_scoped and not deployment:
|
|
168
|
+
raise click.UsageError(
|
|
169
|
+
"A Dagster Cloud deployment must be specified for this command.\n\n"
|
|
170
|
+
"You may specify a deployment by:\n"
|
|
171
|
+
f"- Providing the --deployment parameter\n"
|
|
172
|
+
f"- Setting the {DEPLOYMENT_ENV_VAR_NAME} environment variable"
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Update kwargs with resolved values
|
|
176
|
+
kwargs["organization"] = organization
|
|
177
|
+
kwargs["api_token"] = api_token
|
|
178
|
+
kwargs["view_graphql"] = view_graphql
|
|
179
|
+
if deployment_scoped:
|
|
180
|
+
kwargs["deployment"] = deployment
|
|
181
|
+
|
|
182
|
+
return func(*args, **kwargs)
|
|
183
|
+
|
|
184
|
+
return wrapper
|
|
185
|
+
|
|
186
|
+
return decorator
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.11.9"
|
|
@@ -29,6 +29,7 @@ dagster_shared/dagster_model/pydantic_compat_layer.py
|
|
|
29
29
|
dagster_shared/libraries/__init__.py
|
|
30
30
|
dagster_shared/plus/__init__.py
|
|
31
31
|
dagster_shared/plus/config.py
|
|
32
|
+
dagster_shared/plus/config_utils.py
|
|
32
33
|
dagster_shared/plus/login_server.py
|
|
33
34
|
dagster_shared/record/__init__.py
|
|
34
35
|
dagster_shared/scaffold/__init__.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.11.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/definition_metadata.py
RENAMED
|
File without changes
|
{dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/defs_state_info.py
RENAMED
|
File without changes
|
{dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/serdes/objects/package_entry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared/yaml_utils/source_position.py
RENAMED
|
File without changes
|
{dagster_shared-1.11.8 → dagster_shared-1.11.9}/dagster_shared.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|