python-wheel-build / fromager

Build your own wheels
https://pypi.org/project/fromager/
Apache License 2.0
3 stars 9 forks source link

return version value from download_source should be validated #176

Closed dhellmann closed 1 month ago

dhellmann commented 1 month ago

Plugins return a version as a string. We need to make sure the return values are valid Version representations and should fail if they are not.

We could change the API to require returning a Version, but that would be a hassle for existing implementations. We could make that optional.

At the very least we should pass the return value to Version and let it throw an exception to report any errors.

shubhbapna commented 1 month ago

Looks like default_download_source is already returning a version object and is already doing this validation then. It gets the version from: https://github.com/python-wheel-build/fromager/blob/main/src/fromager/sources.py#L138

and in resolve_dist, the candidate.version field is being returned which is already a Version: https://github.com/python-wheel-build/fromager/blob/main/src/fromager/resolver.py#L44

We will want to fix this mismatch