From 1df39bbf284322f7f97e9ada6482ae91b9e6bd3d Mon Sep 17 00:00:00 2001 From: Marius van Niekerk Date: Wed, 11 May 2022 10:48:54 -0400 Subject: [PATCH] Fix pip hashing requirements --- conda_lock/conda_lock.py | 10 ++++++++-- pyrightconfig.json | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 pyrightconfig.json diff --git a/conda_lock/conda_lock.py b/conda_lock/conda_lock.py index bf8826d20..7d136e633 100644 --- a/conda_lock/conda_lock.py +++ b/conda_lock/conda_lock.py @@ -574,9 +574,15 @@ def format_pip_requirement( if spec.source and spec.source.type == "url": return f"{spec.name} @ {spec.source.url}" elif direct: - return f"{spec.name} @ {spec.url}#md5={spec.hash.md5}" + s = f"{spec.name} @ {spec.url}" + if spec.hash.sha256: + s += f"#sha256={spec.hash.sha256}" + return s else: - return f"{spec.name} === {spec.version} --hash=md5:{spec.hash.md5}" + s = f"{spec.name} === {spec.version}" + if spec.hash.sha256: + s += f"--hash=sha256:{spec.hash.sha256}" + return s def format_conda_requirement( spec: LockedDependency, platform: str, direct: bool = False diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 000000000..bece1eca5 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,3 @@ +{ + "ignore": ["conda_lock/vendor/**"] +} \ No newline at end of file