Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix type hints for _parse_requirement() #92

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading