src/rapids_dependency_file_generator/_config.py:185: error: Argument "pip" to "PipRequirements" has incompatible type "str"; expected "list[str]" [arg-type]
_parse_requirement() should never see a dictionary like {"pip": "package"}, because the dependencies.yaml requires that pip dependencies be an array.
This fixes a type hint and a test case suggesting that possibility, and adds a new test case to ensure rapids-dependency-file-generator rejects lists like this:
The provided dependency file contains schema errors.
'pandas' is not of type 'array'
Failed validating 'type' in schema[1]['properties']['pip']:
{'items': {'$ref': '#/$defs/requirement'},
'minItems': 1,
'type': 'array'}
On instance['pip']:
'pandas'
...
RuntimeError: The provided dependencies data is invalid.
Contributes to #87.
Fixes this error from
mypy
:_parse_requirement()
should never see a dictionary like{"pip": "package"}
, because thedependencies.yaml
requires that pip dependencies be an array.https://github.com/rapidsai/dependency-file-generator/blob/a8660f41117a2015daf9cf0ca2a64b7ad9b71042/src/rapids_dependency_file_generator/schema.json#L154-L161
https://github.com/rapidsai/dependency-file-generator/blob/a8660f41117a2015daf9cf0ca2a64b7ad9b71042/src/rapids_dependency_file_generator/schema.json#L146-L147
This fixes a type hint and a test case suggesting that possibility, and adds a new test case to ensure
rapids-dependency-file-generator
rejects lists like this:How I tested this
Saw the new test case I added get picked up in the output of
pytest -v
.Saw `rapids-dependency-file-generator raise exactly the expected error on it.