Skip to content

Commit

Permalink
Update check_imports.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneKras committed Jan 7, 2025
1 parent b611440 commit 7d75e3d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion check_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ def get_imports_from_notebook(notebook_path):
def get_packages_from_environment_yml(env_path):
with open(env_path, "r") as f:
env = yaml.safe_load(f)
return set(env.get("dependencies", []))
dependencies = env.get("dependencies", [])
packages = set()
for dep in dependencies:
if isinstance(dep, str):
packages.add(dep.split("=")[0])
elif isinstance(dep, dict):
for key in dep:
packages.add(key.split("=")[0])
return packages


def main():
Expand Down

0 comments on commit 7d75e3d

Please sign in to comment.