def dependencies_in_sync(self):
if not self.dependencies:
return True
from hatchling.dep.core import dependencies_in_sync
with self.safe_activation():
return dependencies_in_sync(
self.dependencies_complex, sys_path=self.virtual_env.sys_path, environment=self.virtual_env.environment
)
Instead of self.dependencies_complex an exhaustive list of dependencies should be read from the requirements file. pip-tools gives a nice way to access the pip API:
from typing import Iterator, List
from piptools._compat.pip_compat import InstallRequirement, PipSession, parse_requirements
reqs: Iterator[InstallRequirement] = parse_requirements(
"requirements.txt",
session=PipSession(),
)
piptools_dependencies_complex: List[InstallRequirement] = list(reqs)
super().dependencies_in_sync()
ultimately callsdependencies_in_sync
onself.dependencies_complex
.https://github.com/pypa/hatch/blob/482deaddb4897b4214050dc0ca4618ae8a596f2e/src/hatch/env/virtual.py#L128-L137
Instead of
self.dependencies_complex
an exhaustive list of dependencies should be read from the requirements file.pip-tools
gives a nice way to access thepip
API: