mainsequence 2.0.4a0__py3-none-any.whl → 2.0.4rc0__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.
mainsequence/cli/api.py CHANGED
@@ -182,7 +182,7 @@ def get_project_token(project_id: int | str) -> str:
182
182
  if r.headers.get("content-type","").startswith("application/json"):
183
183
  data = r.json()
184
184
  token=data["development"][0]
185
- token = (r.text or "").strip()
185
+
186
186
  if not token:
187
187
  raise ApiError("Project token response did not include a token.")
188
188
  return token
mainsequence/cli/cli.py CHANGED
@@ -366,12 +366,22 @@ def project_set_up_locally(
366
366
  if env_text and not env_text.endswith("\n"): env_text += "\n"
367
367
  env_text += f"MAINSEQUENCE_TOKEN={project_token}\n"
368
368
 
369
- # write final .env with both vars present
370
- (target_dir / ".env").write_text(env_text, encoding="utf-8")
371
-
369
+ # --- ensure TDAG_ENDPOINT points at the current backend URL ---
370
+ backend = cfg.backend_url()
371
+ lines = env_text.splitlines()
372
+ if any(line.startswith("TDAG_ENDPOINT=") for line in lines):
373
+ env_text = "\n".join(
374
+ (f"TDAG_ENDPOINT={backend}" if line.startswith("TDAG_ENDPOINT=") else line)
375
+ for line in lines
376
+ )
377
+ else:
378
+ if env_text and not env_text.endswith("\n"): env_text += "\n"
379
+ env_text += f"TDAG_ENDPOINT={backend}\n"
372
380
 
373
381
 
374
382
 
383
+ # write final .env with both vars present
384
+ (target_dir / ".env").write_text(env_text, encoding="utf-8")
375
385
  cfg.set_link(project_id, str(target_dir))
376
386
 
377
387
  typer.secho(f"Local folder: {target_dir}", fg=typer.colors.GREEN)