Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import uuid
from collections.abc import Sequence
from pathlib import Path
from typing import Optional
Expand Down Expand Up @@ -129,6 +130,7 @@ def scaffold_project(
os.path.join(os.path.dirname(__file__), "templates", "PROJECT_NAME_PLACEHOLDER")
),
excludes=project_excludes,
project_id=str(uuid.uuid4()),
**get_dependencies_template_params(
use_editable_dagster,
scaffold_project_options,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
project_id: {{ project_id }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
import subprocess
import sys
import uuid
from pathlib import Path
from typing import Literal, Optional, TypeAlias, get_args

import create_dagster.version_check
import dagster_shared.check as check
import pytest
import tomlkit
import yaml
from create_dagster.scaffold import _get_editable_dagster_from_env
from dagster_dg_core.shared_options import DEFAULT_EDITABLE_DAGSTER_PROJECTS_ENV_VAR
from dagster_dg_core.utils import (
Expand Down Expand Up @@ -169,6 +171,11 @@ def test_scaffold_project_success(
# Standalone projects should have README.md and .gitignore
assert Path("foo-bar/README.md").exists()
assert Path("foo-bar/.gitignore").exists()
# Verify .dg/telemetry.yaml exists and contains a valid UUID
assert Path("foo-bar/.dg/telemetry.yaml").exists()
telemetry_content = yaml.safe_load(Path("foo-bar/.dg/telemetry.yaml").read_text())
assert "project_id" in telemetry_content
uuid.UUID(telemetry_content["project_id"]) # Raises if invalid UUID

# Verify README.md contains the project name
readme_content = Path("foo-bar/README.md").read_text()
Expand Down Expand Up @@ -209,6 +216,11 @@ def test_scaffold_project_inside_workspace_success(monkeypatch) -> None:
# Workspace projects should NOT have README.md and .gitignore
assert not Path("projects/foo-bar/README.md").exists()
assert not Path("projects/foo-bar/.gitignore").exists()
# Verify .dg/telemetry.yaml exists and contains a valid UUID
assert Path("projects/foo-bar/.dg/telemetry.yaml").exists()
telemetry_content = yaml.safe_load(Path("projects/foo-bar/.dg/telemetry.yaml").read_text())
assert "project_id" in telemetry_content
uuid.UUID(telemetry_content["project_id"]) # Raises if invalid UUID

# Check project TOML content
toml = tomlkit.parse(Path("projects/foo-bar/pyproject.toml").read_text())
Expand Down