diff --git a/check-requirements.py b/check-requirements.py index 675ee7699..d2d4b7fc3 100755 --- a/check-requirements.py +++ b/check-requirements.py @@ -23,6 +23,12 @@ "E.g. dlt>=0.3.5,<0.4.0" ) + +def has_url_with_pin(dlt_req: Requirement) -> bool: + """Checks if the url contains a reference to a branch, tag, or commit""" + return dlt_req.url is not None and "@" in dlt_req.url + + for source in source_dirs: req_path = source.joinpath("requirements.txt") if not req_path.is_file(): @@ -54,7 +60,7 @@ ) error = True continue - if not dlt_req.specifier: + if not dlt_req.specifier and not has_url_with_pin(dlt_req): print( f"ERROR: Source {source.name} dlt requirement '{dlt_req}' has no version constraint. {error_msg_suffix}" )