From 63fb9ae8b88f23a94bb3b02c4dd81df93101cb1b Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 4 Jun 2024 13:39:25 -0700 Subject: [PATCH] Share requiremnts between `metricflow` and `metricflow-semantics`. --- extra-hatch-configuration/requirements.txt | 6 ++++ .../requirements.txt | 3 ++ metricflow-semantics/pyproject.toml | 12 ++++--- pyproject.toml | 32 +++++++++---------- 4 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 extra-hatch-configuration/requirements.txt create mode 100644 metricflow-semantics/extra-hatch-configuration/requirements.txt diff --git a/extra-hatch-configuration/requirements.txt b/extra-hatch-configuration/requirements.txt new file mode 100644 index 0000000000..65237f8987 --- /dev/null +++ b/extra-hatch-configuration/requirements.txt @@ -0,0 +1,6 @@ +Jinja2>=3.1.3 +dbt-semantic-interfaces>=0.5.1, <0.6.0 +more-itertools>=8.10.0, <10.2.0 +pydantic>=1.10.0, <1.11.0 +tabulate>=0.8.9 +typing_extensions>=4.4, <5.0 diff --git a/metricflow-semantics/extra-hatch-configuration/requirements.txt b/metricflow-semantics/extra-hatch-configuration/requirements.txt new file mode 100644 index 0000000000..7b1d210bce --- /dev/null +++ b/metricflow-semantics/extra-hatch-configuration/requirements.txt @@ -0,0 +1,3 @@ +dbt-semantic-interfaces>=0.5.1, <0.6.0 +python-dateutil>=2.8.2, <2.9.0 +rapidfuzz>=3.0, <4.0 diff --git a/metricflow-semantics/pyproject.toml b/metricflow-semantics/pyproject.toml index cfaafc3163..e3f3e19ee0 100644 --- a/metricflow-semantics/pyproject.toml +++ b/metricflow-semantics/pyproject.toml @@ -1,5 +1,5 @@ [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] @@ -25,10 +25,12 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = [ - "dbt-semantic-interfaces>=0.5.1, <0.6.0", - "python-dateutil>=2.8.2, <2.9.0", - "rapidfuzz>=3.0, <4.0", +# Dependencies are specified through the `hatch-requirements-txt` plug-in. +dynamic = ["dependencies"] + +[tool.hatch.metadata.hooks.requirements_txt] +files = [ + "extra-hatch-configuration/requirements.txt", ] [project.optional-dependencies] diff --git a/pyproject.toml b/pyproject.toml index ae65129386..0f299b2b2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,17 +25,16 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = [ - "Jinja2>=3.1.3", - "dbt-semantic-interfaces>=0.5.1, <0.6.0", - "more-itertools>=8.10.0, <10.2.0", - "pydantic>=1.10.0, <1.11.0", - "tabulate>=0.8.9", - "typing_extensions>=4.4, <5.0", + +# Dependencies are specified through the `hatch-requirements-txt` plug-in. +dynamic = ["dependencies", "optional-dependencies"] + +[tool.hatch.metadata.hooks.requirements_txt] +files = [ + "metricflow-semantics/extra-hatch-configuration/requirements.txt", + "extra-hatch-configuration/requirements.txt", ] -# Optional dependencies are specified through the `hatch-requirements-txt` plug-in. -dynamic = ["optional-dependencies"] [project.urls] Documentation = "https://docs.getdbt.com/docs/build/about-metricflow" @@ -100,7 +99,6 @@ packages = ["metricflow", "metricflow-semantics/metricflow_semantics"] [tool.hatch.envs.dev-env] description = "Environment for development. Includes a DuckDB-backed client." run = "run-coverage --no-cov" -dependencies = ["metricflow-semantics @ {root:uri}/metricflow-semantics"] features = [ "dev-packages", @@ -113,11 +111,11 @@ MF_TEST_ADAPTER_TYPE="duckdb" MF_SQL_ENGINE_URL="duckdb://" # This allows us to use the classes in the `dbt-metricflow` package for tests without installing the package. # `dbt-metricflow` can't be installed as it has `metricflow` as a dependency. -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" [tool.hatch.envs.postgres-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_SQL_ENGINE_URL="postgresql://metricflow@localhost:5432/metricflow" MF_SQL_ENGINE_PASSWORD="metricflowing" MF_TEST_ADAPTER_TYPE="postgres" @@ -136,7 +134,7 @@ features = [ # configured independently of the hatch env construction [tool.hatch.envs.bigquery-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="bigquery" [tool.hatch.envs.bigquery-env] @@ -150,7 +148,7 @@ features = [ [tool.hatch.envs.databricks-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="databricks" @@ -165,7 +163,7 @@ features = [ [tool.hatch.envs.redshift-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="redshift" [tool.hatch.envs.redshift-env] @@ -179,7 +177,7 @@ features = [ [tool.hatch.envs.snowflake-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="snowflake" [tool.hatch.envs.snowflake-env] @@ -193,7 +191,7 @@ features = [ [tool.hatch.envs.trino-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE = "trino" MF_SQL_ENGINE_URL = "trino://trino@localhost:8080/" DBT_ENV_SECRET_CATALOG="memory"