Skip to content

Commit f212a6c

Browse files
authored
feat: add extra_pypi_dependencies (#120)
1 parent f8adf79 commit f212a6c

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

adbc_drivers_dev/generate.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,19 @@ class ValidationConfig(BaseModel):
130130
"description": """Additional dependencies to install for validation workflows. Specify as key-value pairs. Example:
131131
132132
[validation.extra-dependencies]
133-
pytest = "^7.0"
133+
pytest = ">=7,<8"
134+
black = "*\""""
135+
},
136+
)
137+
138+
extra_pypi_dependencies: dict[str, typing.Any] = Field(
139+
default_factory=dict,
140+
alias="extra-pypi-dependencies",
141+
json_schema_extra={
142+
"description": """Additional dependencies to install for validation workflows. Specify as key-value pairs. Example:
143+
144+
[validation.extra-pypi-dependencies]
145+
pytest = ">=7,<8"
134146
black = "*\""""
135147
},
136148
)
@@ -289,7 +301,10 @@ def to_dict(self) -> dict[str, typing.Any]:
289301
"permissions": self._permissions,
290302
"aws": self.aws.model_dump() if self.aws else None,
291303
"gcloud": self.gcloud,
292-
"validation": {"extra_dependencies": self.validation.extra_dependencies},
304+
"validation": {
305+
"extra_dependencies": self.validation.extra_dependencies,
306+
"extra_pypi_dependencies": self.validation.extra_pypi_dependencies,
307+
},
293308
}
294309

295310
def __eq__(self, other: object) -> bool:

adbc_drivers_dev/templates/pixi.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ python = ">=3.13.5,<3.14"
5151
[pypi-dependencies]
5252
adbc-drivers-dev = { git = "https://github.com/adbc-drivers/dev" }
5353
adbc-drivers-validation = { git = "https://github.com/adbc-drivers/validation" }
54+
<% for key, value in validation["extra_pypi_dependencies"].items() %>
55+
<{key}> = "<{value}>"
56+
<% endfor %>

tests/test_workflow.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_model_default() -> None:
3535
assert config.aws is None
3636
assert config.gcloud is False
3737
assert config.validation.extra_dependencies == {}
38+
assert config.validation.extra_pypi_dependencies == {}
3839

3940
assert config.to_dict() == {
4041
"driver": "(unknown)",
@@ -51,7 +52,10 @@ def test_model_default() -> None:
5152
"permissions": {},
5253
"aws": None,
5354
"gcloud": False,
54-
"validation": {"extra_dependencies": {}},
55+
"validation": {
56+
"extra_dependencies": {},
57+
"extra_pypi_dependencies": {},
58+
},
5559
}
5660

5761
assert config == GenerateConfig.model_validate({})
@@ -211,11 +215,19 @@ def test_validation_config_alias() -> None:
211215
{"validation": {"extra-dependencies": {"pytest": "^7.0", "black": "*"}}}
212216
)
213217
assert config.validation.extra_dependencies == {"pytest": "^7.0", "black": "*"}
218+
assert config.validation.extra_pypi_dependencies == {}
214219

215220
config = GenerateConfig.model_validate(
216221
{"validation": {"extra_dependencies": {"mypy": "^1.0"}}}
217222
)
218223
assert config.validation.extra_dependencies == {"mypy": "^1.0"}
224+
assert config.validation.extra_pypi_dependencies == {}
225+
226+
config = GenerateConfig.model_validate(
227+
{"validation": {"extra_pypi_dependencies": {"mypy": ">=1.0"}}}
228+
)
229+
assert config.validation.extra_dependencies == {}
230+
assert config.validation.extra_pypi_dependencies == {"mypy": ">=1.0"}
219231

220232

221233
def test_params_aws_and_gcloud() -> None:
@@ -254,7 +266,10 @@ def test_default_model() -> None:
254266
assert config["lang"] == {}
255267
assert config["secrets"] == {}
256268
assert config["gcloud"] is False
257-
assert config["validation"] == {"extra-dependencies": {}}
269+
assert config["validation"] == {
270+
"extra-dependencies": {},
271+
"extra-pypi-dependencies": {},
272+
}
258273

259274
# Should not include None values (environment, aws)
260275
assert "environment" not in config

0 commit comments

Comments
 (0)