Skip to content

Commit

Permalink
feat: allow for transitive local dependencies (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
AGiantSquid committed Aug 3, 2023
1 parent 62a30ce commit a41baf0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/monas/project.py
Expand Up @@ -149,11 +149,19 @@ def remove_dependency(self, dependency: str) -> None:

def install(self) -> None:
"""Bootstrap the package and link depending packages in the monorepo"""
dependency_names = self.metadata.get_dependency_names()
packages = [
pkg
for pkg in self.config.iter_packages()
if pkg.canonical_name in dependency_names
] + [self]
requirements = [sh_join(["-e", pkg.path.as_posix()]) for pkg in packages]
local_dependencies = self.get_local_dependencies() + [self]
requirements = [
sh_join(["-e", pkg.path.as_posix()])
for pkg in local_dependencies
]
pip_install(self.path / ".venv", requirements)

def get_local_dependencies(self) -> list[PyPackage]:
"""Return list of local dependencies."""
dependency_names = self.metadata.get_dependency_names()
local_dependencies = []
local_packages = list(self.config.iter_packages())
for pkg in local_packages:
if pkg.canonical_name in dependency_names:
local_dependencies += pkg.get_local_dependencies() + [pkg]
return local_dependencies

0 comments on commit a41baf0

Please sign in to comment.