Skip to content

Commit a6e2020

Browse files
authored
Merge pull request #24 from brooklyn-data/markupsafe_fix
Fix MarkupSafe dbt dependency issue
2 parents 6c6a6be + f9c02aa commit a6e2020

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dbtenv/pip.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,23 @@ class ReleaseDateFilterPyPIRequestHandler(BaseDateFilterPyPIRequestHandler):
133133
pip_filter_port = pip_filter_server.socket.getsockname()[1]
134134
threading.Thread(target=pip_filter_server.serve_forever, daemon=True).start()
135135
pip_args.extend(['--index-url', f'http://localhost:{pip_filter_port}/simple'])
136-
elif self.version.pypi_version < '0.19.1':
136+
if self.version.pypi_version < '0.19.1':
137137
# Versions prior to 0.19.1 just specified agate>=1.6, but agate 1.6.2 introduced a dependency on PyICU
138138
# which causes installation problems, so exclude that like versions 0.19.1 and above do.
139139
pip_args.append('agate>=1.6,<1.6.2')
140+
if self.version.pypi_version >= '0.15.0' < '0.16.0':
141+
# Versions ~=0.15.0 just specified Jinja2>=2.10, but dbt versions ~=0.15.0 are not compatible with
142+
# Jinja >= 3.0.0. https://github.com/dbt-labs/dbt-core/issues/2147
143+
pip_args.append('Jinja2<3')
144+
if self.version.pypi_version >= '0.15.0' < '1.0.0':
145+
# Deprecation of soft_unicode in MarkupSafe==2.1.0 is not supported by Jinja2==2.11
146+
# https://github.com/dbt-labs/dbt-core/pull/4746
147+
pip_args.append('MarkupSafe==2.0.1')
140148

141149
pip_args.append(self.version.pip_specifier)
142150
logger.info(f"Installing {self.version.pip_specifier} from {package_source} into `{self.venv_directory}`.")
143151

144-
logger.debug(f"Running `{pip}` with arguments {pip_args}.")
152+
logger.info(f"Running `{pip}` with arguments {pip_args}.")
145153
pip_result = subprocess.run([pip, *pip_args])
146154
if pip_result.returncode != 0:
147155
raise DbtenvError(f"Failed to install dbt {self.version.pypi_version} from {package_source} into `{self.venv_directory}`.")

0 commit comments

Comments
 (0)