Skip to content

Commit 2e335a5

Browse files
authored
Merge pull request #47 from getindata/release-0.10.0
Release 0.10.0
2 parents 81559ff + 313ba05 commit 2e335a5

File tree

9 files changed

+38
-18
lines changed

9 files changed

+38
-18
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## [Unreleased]
44

5+
## [0.10.0] - 2022-01-12
6+
7+
### Changed
8+
9+
- Run `dbt deps` at the end of `dp prepare-env`.
10+
11+
### Fixed
12+
13+
- `dp run` and `dp test` are no longer pointing to `profiles.yml` instead of the directory containing it.
14+
515
## [0.9.0] - 2022-01-03
616

717
### Added
@@ -121,7 +131,9 @@
121131
- Draft of `dp init`, `dp create`, `dp template new`, `dp template list` and `dp dbt`
122132
- Draft of `dp compile` and `dp deploy`
123133

124-
[Unreleased]: https://github.com/getindata/data-pipelines-cli/compare/0.9.0...HEAD
134+
[Unreleased]: https://github.com/getindata/data-pipelines-cli/compare/0.10.0...HEAD
135+
136+
[0.10.0]: https://github.com/getindata/data-pipelines-cli/compare/0.9.0...0.10.0
125137

126138
[0.9.0]: https://github.com/getindata/data-pipelines-cli/compare/0.8.0...0.9.0
127139

data_pipelines_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "0.9.0"
1+
version = "0.10.0"

data_pipelines_cli/cli_commands/prepare_env.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from data_pipelines_cli.cli_utils import echo_subinfo
1111
from data_pipelines_cli.config_generation import DbtProfile, generate_profiles_dict
12-
from data_pipelines_cli.dbt_utils import read_dbt_vars_from_configs
12+
from data_pipelines_cli.dbt_utils import read_dbt_vars_from_configs, run_dbt_command
1313
from data_pipelines_cli.errors import JinjaVarKeyError
1414

1515

@@ -84,7 +84,8 @@ def prepare_env(env: str) -> None:
8484
with open(home_profiles_path, "w") as profiles:
8585
yaml.dump(profile, profiles, default_flow_style=False)
8686

87-
echo_subinfo(f"Saved profiles.yml in {home_profiles_path}")
87+
echo_subinfo(f"Saved profiles.yml in {home_profiles_path.parent}")
88+
run_dbt_command(("deps",), env, home_profiles_path.parent)
8889

8990

9091
@click.command(

data_pipelines_cli/cli_commands/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import click
22

3-
from ..config_generation import get_profiles_yml_build_path
3+
from ..config_generation import get_profiles_dir_build_path
44
from ..dbt_utils import run_dbt_command
55
from .compile import compile_project
66

@@ -13,7 +13,7 @@ def run(env: str) -> None:
1313
:type env: str
1414
"""
1515
compile_project(env)
16-
profiles_path = get_profiles_yml_build_path(env)
16+
profiles_path = get_profiles_dir_build_path(env)
1717
run_dbt_command(("run",), env, profiles_path)
1818

1919

data_pipelines_cli/cli_commands/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import click
22

3-
from ..config_generation import get_profiles_yml_build_path
3+
from ..config_generation import get_profiles_dir_build_path
44
from ..dbt_utils import run_dbt_command
55
from .compile import compile_project
66

@@ -13,7 +13,7 @@ def test(env: str) -> None:
1313
:type env: str
1414
"""
1515
compile_project(env)
16-
profiles_path = get_profiles_yml_build_path(env)
16+
profiles_path = get_profiles_dir_build_path(env)
1717
run_dbt_command(("test",), env, profiles_path)
1818

1919

data_pipelines_cli/config_generation.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,17 @@ def generate_profiles_dict(env: str, copy_config_dir: bool) -> Dict[str, DbtProf
136136
}
137137

138138

139-
def get_profiles_yml_build_path(env: str) -> pathlib.Path:
139+
def get_profiles_dir_build_path(env: str) -> pathlib.Path:
140140
"""
141-
Returns path to ``build/profiles/<profile_name>/profiles.yml``,
142-
depending on `env` argument.
141+
Returns path to ``build/profiles/<profile_name>/``, depending on `env` argument.
143142
144143
:param env: Name of the environment
145144
:type env: str
146145
:return:
147146
:rtype: pathlib.Path
148147
"""
149148
profile_name = get_dbt_profiles_env_name(env)
150-
return BUILD_DIR.joinpath("profiles", profile_name, "profiles.yml")
149+
return BUILD_DIR.joinpath("profiles", profile_name)
151150

152151

153152
def generate_profiles_yml(env: str, copy_config_dir: bool = True) -> pathlib.Path:
@@ -166,10 +165,10 @@ def generate_profiles_yml(env: str, copy_config_dir: bool = True) -> pathlib.Pat
166165
echo_info("Generating profiles.yml")
167166
profile = generate_profiles_dict(env, copy_config_dir)
168167

169-
profiles_path = get_profiles_yml_build_path(env)
170-
profiles_path.parent.mkdir(parents=True, exist_ok=True)
171-
with open(profiles_path, "w") as profiles:
168+
profiles_path = get_profiles_dir_build_path(env)
169+
profiles_path.mkdir(parents=True, exist_ok=True)
170+
with open(profiles_path.joinpath("profiles.yml"), "w") as profiles:
172171
yaml.dump(profile, profiles, default_flow_style=False)
173172
echo_subinfo(f"Generated profiles.yml in {profiles_path}")
174173

175-
return profiles_path.parent
174+
return profiles_path

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.9.0
2+
current_version = 0.10.0
33

44
[bumpversion:file:setup.py]
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
setup(
5252
name="data_pipelines_cli",
53-
version="0.9.0",
53+
version="0.10.0",
5454
description="CLI for data platform",
5555
long_description=README,
5656
long_description_content_type="text/markdown",

tests/cli_commands/test_prepare_env.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def test_no_var_profiles_generation(self):
5151
"pathlib.Path.cwd", lambda: self.goldens_dir_path
5252
), tempfile.TemporaryDirectory() as tmp_dir2, patch(
5353
"pathlib.Path.home", lambda: pathlib.Path(tmp_dir2)
54+
), patch(
55+
"data_pipelines_cli.dbt_utils.subprocess_run", lambda _args: None
5456
):
5557
runner.invoke(_cli, ["prepare-env"])
5658
with open(
@@ -80,6 +82,8 @@ def test_vars_profiles_generation(self):
8082
"pathlib.Path.cwd", lambda: self.goldens_dir_path
8183
), tempfile.TemporaryDirectory() as tmp_dir2, patch(
8284
"pathlib.Path.home", lambda: pathlib.Path(tmp_dir2)
85+
), patch(
86+
"data_pipelines_cli.dbt_utils.subprocess_run", lambda _args: None
8387
):
8488
prepare_env("staging")
8589

@@ -105,6 +109,8 @@ def test_raise_missing_variable(self):
105109
"pathlib.Path.cwd", lambda: self.goldens_dir_path
106110
), tempfile.TemporaryDirectory() as tmp_dir2, patch(
107111
"pathlib.Path.home", lambda: pathlib.Path(tmp_dir2)
112+
), patch(
113+
"data_pipelines_cli.dbt_utils.subprocess_run", lambda _args: None
108114
):
109115
with self.assertRaises(JinjaVarKeyError):
110116
prepare_env("staging")
@@ -124,6 +130,8 @@ def test_raise_missing_environment_variable(self):
124130
"pathlib.Path.cwd", lambda: self.goldens_dir_path
125131
), tempfile.TemporaryDirectory() as tmp_dir2, patch(
126132
"pathlib.Path.home", lambda: pathlib.Path(tmp_dir2)
133+
), patch(
134+
"data_pipelines_cli.dbt_utils.subprocess_run", lambda _args: None
127135
):
128136
with self.assertRaises(JinjaVarKeyError):
129137
prepare_env("staging")

0 commit comments

Comments
 (0)