Closed sfinkens closed 2 months ago
Name | Link |
---|---|
Latest commit | 96c132698cebc7c66934eb0127f50848b4ca2db4 |
Latest deploy log | https://app.netlify.com/sites/conda-lock/deploys/662bc8a0d800b600082a96d0 |
Deploy Preview | https://deploy-preview-629--conda-lock.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Thanks so much @sfinkens for all your work on this! I like your approach.
_dependency_provides_hash
. Then you should be solid from a typing perspective. Could you be more specific about the inconsistency you're concerned about? (I'm sure you're thinking more deeply that I am on this subject.)pypi_solver.get_requirements()
there's an if
block
def get_requirements():
if op.package.source_type == "url":
hash = ... # variant 1
elif op.package.source_type == "git":
hash = ... # variant 2
else:
hash = ... # variant 3
and I was wondering if that logic could be delegated to the corresponding dependency classes
def get_requirements():
hash = op.package.dependency.get_hash_model()
# ...
class PoetryURLDependency:
def get_hash_model()
# variant 1
class PoetryVCSDependency:
def get_hash_model():
# variant 2
class PoetryDependencyWithHash:
def get_hash_model():
# variant 3
We couldn't get rid of the if
block entirely, but maybe make it a bit smaller. Then mypy wouldn't complain anymore, because every dependency class provides that method. But now that I think about it, that's maybe beyond the scope of this PR.
Regarding 4. I find the if
nice and explicit. Unless there's a really clean and obvious class hierarchy, tucking away logic into class methods seems unnecessarily indirect. Since this is all a bit of a hack, I'd rather have that hack in one place upfront in the if
block, if that makes any sense. :)
Since this is all a bit of a hack, I'd rather have that hack in one place
Good point! :+1:
Description
Fix #624 by
--hash
option in the requirement parser, for exampleQuestions
Is this going into the right direction? And some more specific questions:
pypi_solver.py
(PoetryDependency
not having theget_hash_model
method). I agree with mypy that the solution is not really consistent, because some dependencies still carry the hash in their URL. MaybePoetryURLDependency
andPoetryVCSDependency
could be extended with aget_hash_model
method as well?