rapids-dependency-file-generator handles deduplicating the sets of dependencies provided to it, including pip: lists for conda environments.
This PR modifies the logic the function does that in the following ways:
fixes return type hint
refactors it so that:
only a single pass is done over the inputs to split requirements in to pip vs non-pip
assignments are done in a way that's a bit easier for a type checker to understand
This fixes these errors found by mypy:
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:65: error: Argument 1 to "append" of "list" has incompatible type "dict[str, list[str]]"; expected "str" [arg-type]
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:66: error: Incompatible return value type (got "list[str]", expected "list[str | dict[str, str]]") [return-value]
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:66: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:66: note: Consider using "Sequence" instead, which is covariant
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:66: note: Perhaps you need a type annotation for "deduped"? Suggestion: "list[str | dict[str, str]]"
src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py:425: error: Argument "dependencies" to "make_dependency_file" has incompatible type "list[str | dict[str, str]]"; expected "list[str | dict[str, list[str]]]" [arg-type]
How I tested this
Confirmed that this behavior is covered by existing unit tests (and added one more condition there for completeness).
Ran the following to confirm that some of the mypy issues had been resolved:
Contributes to #87.
rapids-dependency-file-generator
handles deduplicating the sets of dependencies provided to it, includingpip:
lists for conda environments.This PR modifies the logic the function does that in the following ways:
This fixes these errors found by
mypy
:How I tested this
Confirmed that this behavior is covered by existing unit tests (and added one more condition there for completeness).
Ran the following to confirm that some of the
mypy
issues had been resolved: