Skip to content

Commit

Permalink
Add KPOps name convention
Browse files Browse the repository at this point in the history
  • Loading branch information
raminqaf committed May 24, 2024
1 parent 980f326 commit 07b06fe
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 56 deletions.
12 changes: 12 additions & 0 deletions kpops/api/kpops_resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from enum import Enum

FILE_PREFIX = ".yaml"


class KpopsResources(str, Enum):
PIPELINE = "pipeline"
DEFAULT = "default"
CONFIG = "config"

def as_yaml_file(self, suffix: str = "", prefix: str = "") -> str:
return suffix + self.value + prefix + FILE_PREFIX
7 changes: 4 additions & 3 deletions kpops/utils/cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pydantic.fields import FieldInfo
from pydantic_core import PydanticUndefined

from kpops.api.kpops_resources import KpopsResources
from kpops.config import KpopsConfig
from kpops.utils.docstring import describe_object
from kpops.utils.json import is_jsonable
Expand Down Expand Up @@ -72,6 +73,6 @@ def init_project(path: Path, conf_incl_opt: bool):
:param conf_incl_opt: Whether to include non-required settings
in the generated config file
"""
create_config("config", path, conf_incl_opt)
Path(path / "pipeline.yaml").touch(exist_ok=False)
Path(path / "defaults.yaml").touch(exist_ok=False)
create_config(KpopsResources.CONFIG.value, path, conf_incl_opt)
Path(path / KpopsResources.PIPELINE.as_yaml_file()).touch(exist_ok=False)
Path(path / KpopsResources.DEFAULT.as_yaml_file()).touch(exist_ok=False)
5 changes: 4 additions & 1 deletion tests/compiler/test_pipeline_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import pytest

from kpops.api.kpops_resources import KpopsResources
from kpops.pipeline import PipelineGenerator
from kpops.utils.environment import ENV

PIPELINE_PATH = Path("./some/random/path/for/testing/pipeline.yaml")
PIPELINE_PATH = Path(
f"./some/random/path/for/testing/{KpopsResources.PIPELINE.as_yaml_file()}"
)
PIPELINE_BASE_DIR = Path()


Expand Down
Loading

0 comments on commit 07b06fe

Please sign in to comment.