Skip to content

Commit

Permalink
fix: fix type hints for _parse_requirement() (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
difyrrwrzd authored May 14, 2024
1 parent f4a0f1f commit 5a96946
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rapids_dependency_file_generator/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get_extras():
)


def _parse_requirement(requirement: typing.Union[str, dict[str, str]]) -> typing.Union[str, PipRequirements]:
def _parse_requirement(requirement: typing.Union[str, dict[str, list[str]]]) -> typing.Union[str, PipRequirements]:
if isinstance(requirement, str):
return requirement

Expand Down
18 changes: 18 additions & 0 deletions tests/examples/invalid/pip-no-list/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# tests that dfg rejects a config where 'pip:' in a conda requirements is a single string
# (it should always be an array of packages)
files:
build:
output: conda
includes:
- build
channels:
- rapidsai
- conda-forge
dependencies:
build:
common:
- output_types: [conda]
packages:
- beep-boop=1.2.3
- pip
- pip: pandas
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_parse_outputs(input, output):
["input", "output"],
[
("package", "package"),
({"pip": "package"}, _config.PipRequirements(pip="package")),
({"pip": ["package", "other-package"]}, _config.PipRequirements(pip=["package", "other-package"])),
({"other": "invalid"}, KeyError),
],
)
Expand Down

0 comments on commit 5a96946

Please sign in to comment.