Skip to content

Commit

Permalink
Update dbt-metricflow dependencies to use dbt-* 1.8 packages (#1244)
Browse files Browse the repository at this point in the history
<!---
Include the number of the issue addressed by this PR above if
applicable.
  PRs for code changes without an associated issue *will not be merged*.
  See CONTRIBUTING.md for more information.
-->
Resolves #1243


### Description

This PR makes the following project configuration changes:

* Use `requirements.txt`-style files to share dependency definitions
between `metricflow` and `dbt-metricflow`.
* Remove the editable installs that are run when setting up the `hatch`
environment used for development. It seems to work with out them now.
* Update `dbt-metricflow` dependencies to use `dbt-*` 1.8 packages

<!--- 
  Before requesting review, please make sure you have:
1. read [the contributing
guide](https://github.com/dbt-labs/metricflow/blob/main/CONTRIBUTING.md),
2. signed the
[CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
3. run `changie new` to [create a changelog
entry](https://github.com/dbt-labs/metricflow/blob/main/CONTRIBUTING.md#adding-a-changelog-entry)
-->
  • Loading branch information
plypaul authored Jun 5, 2024
1 parent 6f67a5d commit dde021e
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 114 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240603-174544.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Update `dbt-metricflow` dependencies to use `dbt*` 1.8 packages
time: 2024-06-03T17:45:44.215307-07:00
custom:
Author: plypaul
Issue: "1243"
6 changes: 3 additions & 3 deletions .github/workflows/ci-metricflow-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
steps:
- name: Check-out the repo
uses: actions/checkout@v3
Expand Down Expand Up @@ -46,10 +46,10 @@ jobs:
- name: Check-out the repo
uses: actions/checkout@v3

- name: Test w/ Python 3.11
- name: Test w/ Python 3.12
uses: ./.github/actions/run-mf-tests
with:
python-version: "3.11"
python-version: "3.12"
make-target: "test-postgresql"

metricflow-unit-tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time

from dbt.adapters.base.impl import BaseAdapter
from dbt.exceptions import DbtDatabaseError
from dbt_common.exceptions.base import DbtDatabaseError
from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
from metricflow_semantics.errors.error_classes import SqlBindParametersNotSupportedError
from metricflow_semantics.mf_logging.formatting import indent
Expand Down Expand Up @@ -132,9 +132,8 @@ def query(
Args:
stmt: The SQL query statement to run. This should produce output via a SELECT
sql_bind_parameters: The parameter replacement mapping for filling in
concrete values for SQL query parameters.
extra_tags: An object containing JSON serialized tags meant for annotating queries.
sql_bind_parameters: The parameter replacement mapping for filling in concrete values for SQL query
parameters.
"""
start = time.time()
request_id = SqlRequestId(f"mf_rid__{random_id()}")
Expand Down
13 changes: 13 additions & 0 deletions dbt-metricflow/extra-hatch-configuration/requirements-cli.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Internal dependencies
dbt-core>=1.8.0, <1.9.0

# dsi version should be fixed by MetricFlow/dbt-core, not set here
dbt-semantic-interfaces

# CLI-related
Jinja2>=3.1.3
halo>=0.0.31, <0.1.0
update-checker>=0.18.0, <0.19.0

# Bug with mypy: https://github.com/pallets/click/issues/2558#issuecomment-1656546003
click>=8.1.6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-bigquery>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-databricks>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-duckdb>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-postgres>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-redshift>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-snowflake>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbt-trino>=1.8.0, <1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metricflow>=0.206.0.dev3, <0.207.0
52 changes: 24 additions & 28 deletions dbt-metricflow/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[build-system]
requires = ["hatchling~=1.14.0"]
requires = ["hatchling~=1.14.0", "hatch-requirements-txt >= 0.4.1, <0.5.0"]
build-backend = "hatchling.build"

[project]
name = "dbt-metricflow"
version = "0.6.0"
description = "Execute commands against the MetricFlow semantic layer with dbt."
readme = "README.md"
requires-python = ">=3.8,<3.12"
requires-python = ">=3.8,<3.13"
license = "BUSL-1.1"
authors = [
{ name = "dbt Labs", email = "[email protected]" },
Expand All @@ -20,22 +20,18 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
# cli dependencies
"Jinja2>=3.1.3",
"click>=7.1.2",
"halo>=0.0.31, <0.1.0",
"update-checker>=0.18.0, <0.19.0",

# Internal dependencies
"dbt-core>=1.7.4, <1.8.0",
"metricflow>=0.205.0, <0.206.0",
# Dependencies are specified through the `hatch-requirements-txt` plug-in.
dynamic = ["dependencies", "optional-dependencies"]

# dsi version should be fixed by MetricFlow/dbt-core, not set here
"dbt-semantic-interfaces",
[tool.hatch.metadata.hooks.requirements_txt]
files = [
"extra-hatch-configuration/requirements-cli.txt",
"extra-hatch-configuration/requirements-metricflow.txt",
]

[project.urls]
Expand All @@ -44,27 +40,27 @@ dependencies = [
[project.scripts]
mf = 'dbt_metricflow.cli.main:cli'

[project.optional-dependencies]
bigquery = [
"dbt-bigquery>=1.7.0, <1.8.0"
[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
dbt-bigquery = [
"extra-hatch-configuration/requirements-dbt-bigquery.txt"
]
databricks = [
"dbt-databricks>=1.7.0, <1.8.0"
dbt-databricks = [
"extra-hatch-configuration/requirements-dbt-databricks.txt"
]
duckdb = [
"dbt-duckdb>=1.7.0, <1.8.0"
dbt-duckdb = [
"extra-hatch-configuration/requirements-dbt-duckdb.txt"
]
postgres = [
"dbt-postgres>=1.7.0, <1.8.0"
dbt-postgres = [
"extra-hatch-configuration/requirements-dbt-postgres.txt"
]
redshift = [
"dbt-redshift>=1.7.0, <1.8.0"
dbt-redshift = [
"extra-hatch-configuration/requirements-dbt-redshift.txt"
]
snowflake = [
"dbt-snowflake>=1.7.0, <1.8.0"
dbt-snowflake = [
"extra-hatch-configuration/requirements-dbt-snowflake.txt"
]
trino = [
"dbt-trino>=1.7.0, <1.8.0"
dbt-trino = [
"extra-hatch-configuration/requirements-dbt-trino.txt"
]

[tool.hatch.build.targets.sdist]
Expand Down
9 changes: 9 additions & 0 deletions extra-hatch-configuration/requirements-dev-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Developer tools
mypy>=1.7.0, <1.8.0
pre-commit>=3.2.2, <3.3.0
pytest-mock>=3.7.0, <3.8.0
pytest-xdist>=3.2.1, <3.3.0
pytest>=7.1.1, < 7.2.0
types-PyYAML
types-python-dateutil
types-tabulate
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are currently separate for ease of removal, but due to the way Python
# handles import statements they are required in all test environments
SQLAlchemy>=1.4.42, <1.5.0
sqlalchemy2-stubs>=0.0.2a21, <0.0.3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trino>=0.328.0, <0.329.0
Loading

0 comments on commit dde021e

Please sign in to comment.