/
pyproject.toml
243 lines (198 loc) · 6.96 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
[build-system]
requires = ["hatchling~=1.14.0"]
build-backend = "hatchling.build"
[project]
name = "metricflow"
version = "0.206.0.dev2"
description = "Translates a simple metric definition into reusable SQL and executes it against the SQL engine of your choice."
readme = "README.md"
requires-python = ">=3.8,<3.12"
license = "BUSL-1.1"
keywords = []
authors = [
{name = "dbt Labs"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"Jinja2>=3.1.3",
"PyYAML>=6.0, <7.0.0",
"dbt-semantic-interfaces>=0.5.1, <0.6.0",
"graphviz>=0.18.2, <0.21",
"more-itertools>=8.10.0, <10.2.0",
"pandas>=1.5.0, <1.6.0",
"pydantic>=1.10.0, <1.11.0",
"python-dateutil>=2.8.2, <2.9.0",
"rapidfuzz>=3.0, <4.0",
"ruamel.yaml>=0.17.21, <0.18.0",
"tabulate>=0.8.9",
"typing_extensions>=4.4, <5.0",
]
[project.urls]
Documentation = "https://docs.getdbt.com/docs/build/about-metricflow"
"Source Code" = "https://github.com/dbt-labs/metricflow"
[project.optional-dependencies]
dev-packages = [
# 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",
# Test and CLI development dependencies.
# These should generally match what's in dbt-metricflow/pyproject.toml, but may
# diverge during upgrade phases or for other reasons
#
# Note we do not currently depend on dbt-core because updates across minor version
# boundaries cause problems with tests against future versions of dbt-semantic-interfaces.
# In future we will refine this packaging to depend on stable dbt-adapter interfaces in
# the development builds, but those packages do not yet support all of our needs so we
# hack around the problem with editable pre-installs in the various dev environments.
# Note this only works because we don't use the dbt packages for anything other than
# managing warehouse connections and dispatching queries, so this is not a pattern
# anyone else should be emulating even as a short-term hack.
"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",
]
# These are currently separate for ease of removal, but due to the way Python
# handles import statements they are required in all test environments
sql-client-packages = [
"SQLAlchemy>=1.4.42, <1.5.0",
"sqlalchemy2-stubs>=0.0.2a21, <0.0.3",
]
trino-sql-client-packages = [
"trino>=0.327.0, <0.328.0",
]
# There are files that hatch will always include as well (e.g. the LICENSE file).
# See hatch build docs for more details.
[tool.hatch.build.targets.sdist]
packages = ["metricflow", "metricflow-semantics/metricflow_semantics"]
# include doesn't seem to work with packages, so using force include.
[tool.hatch.build.targets.sdist.force-include]
"ATTRIBUTION.md" = "ATTRIBUTION.md"
[tool.hatch.build.targets.wheel]
packages = ["metricflow", "metricflow-semantics/metricflow_semantics"]
[tool.hatch.build.targets.wheel.force-include]
"ATTRIBUTION.md" = "ATTRIBUTION.md"
# Environment setup
# Due to our current wonky package organization, we need to do an editable install
# of dbt-metricflow in every test running environment in order for the tests to work.
# In theory we can install the adapter extra for dbt-metricflow and rely on that, but
# for ease of managing versioning through upgrade phases we retain the explicit
# dependencies on the specific adapter versions defined here.
[tool.hatch.envs.dev-env]
description = "Environment for development. Includes a DuckDB-backed client."
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[duckdb]",
]
features = [
"dev-packages",
"sql-client-packages",
]
[tool.hatch.envs.dev-env.env-vars]
MF_TEST_ADAPTER_TYPE="duckdb"
MF_SQL_ENGINE_URL="duckdb://"
[tool.hatch.envs.postgres-env.env-vars]
MF_SQL_ENGINE_URL="postgresql://metricflow@localhost:5432/metricflow"
MF_SQL_ENGINE_PASSWORD="metricflowing"
MF_TEST_ADAPTER_TYPE="postgres"
[tool.hatch.envs.postgres-env]
description = "Dev environment for working with Postgres adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[postgres]"
]
features = [
"dev-packages",
"sql-client-packages",
]
# NOTE: All of the below should have their authentication credentials
# configured independently of the hatch env construction
[tool.hatch.envs.bigquery-env.env-vars]
MF_TEST_ADAPTER_TYPE="bigquery"
[tool.hatch.envs.bigquery-env]
description = "Dev environment for working with the BigQuery adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[bigquery]"
]
features = [
"dev-packages",
"sql-client-packages",
]
[tool.hatch.envs.databricks-env.env-vars]
MF_TEST_ADAPTER_TYPE="databricks"
[tool.hatch.envs.databricks-env]
description = "Dev environment for working with the Databricks adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[databricks]"
]
features = [
"dev-packages",
"sql-client-packages",
]
[tool.hatch.envs.redshift-env.env-vars]
MF_TEST_ADAPTER_TYPE="redshift"
[tool.hatch.envs.redshift-env]
description = "Dev environment for working with the Redshift adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[redshift]"
]
features = [
"dev-packages",
"sql-client-packages",
]
[tool.hatch.envs.snowflake-env.env-vars]
MF_TEST_ADAPTER_TYPE="snowflake"
[tool.hatch.envs.snowflake-env]
description = "Dev environment for working with Snowflake adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[snowflake]"
]
features = [
"dev-packages",
"sql-client-packages",
]
[tool.hatch.envs.trino-env.env-vars]
MF_TEST_ADAPTER_TYPE = "trino"
MF_SQL_ENGINE_URL = "trino://trino@localhost:8080/"
DBT_ENV_SECRET_CATALOG="memory"
[tool.hatch.envs.trino-env]
description = "Dev environment for working with the Trino adapter"
pre-install-commands = [
"pip install -e ./metricflow-semantics",
"pip install -e ./dbt-metricflow[trino]"
]
features = [
"dev-packages",
"sql-client-packages",
"trino-sql-client-packages",
]
[tool.black]
line-length = 120
# Many deprecation warnings come from 3rd-party libraries and make the
# output of pytest noisy. Since no action is going to be taken, hide those
# warnings.
[tool.pytest.ini_options]
filterwarnings = [
"ignore:Deprecated call to.*",
"ignore:pkg_resources is deprecated as an API"
]
python_functions = "test_* populate_source_schema"