Skip to content

Commit 66d2002

Browse files
committed
update dependency remove click
1 parent d6c0a33 commit 66d2002

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ dependencies = [
1919
"torch>=2.2.0",
2020
"torch-geometric>=2.6.1",
2121
"numpy",
22-
"click",
2322
"huggingface_hub>=0.22.2",
2423
"joblib>=1.3.2",
2524
"networkx>=3.2.1",
26-
"PyYAML>=6.0.2",
2725
"rdkit>=2023.9.5",
2826
"scikit_learn>=1.4.1.post1",
2927
"scipy>=1.14.1",

tests/local_import.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import os
22
import ast
33

4-
def files_importing_pandas(root_dir):
5-
pandas_files = set()
4+
# List of packages from dependencies in pyproject.toml
5+
packages = [
6+
'click',
7+
'joblib',
8+
'networkx',
9+
'yaml', # PyYAML
10+
'sklearn',
11+
'scipy',
12+
]
13+
14+
def files_importing_package(root_dir, package):
15+
package_files = set()
616
for dirpath, dirnames, filenames in os.walk(root_dir):
717
for fn in filenames:
818
if not fn.endswith('.py'):
@@ -14,21 +24,28 @@ def files_importing_pandas(root_dir):
1424
except (SyntaxError, UnicodeDecodeError):
1525
continue
1626
for node in ast.walk(tree):
17-
# catch import pandas” or import pandas as pd”
27+
# catch "import package" or "import package as alias"
1828
if isinstance(node, ast.Import):
1929
for alias in node.names:
20-
if alias.name == 'pandas' or alias.name.startswith('pandas.'):
21-
pandas_files.add(path)
30+
if alias.name == package or alias.name.startswith(package + '.'):
31+
package_files.add(path)
2232
break
23-
# catch from pandas import … or from pandas.core import …
33+
# catch "from package import …" or "from package.module import …"
2434
elif isinstance(node, ast.ImportFrom):
25-
if node.module and node.module.startswith('pandas'):
26-
pandas_files.add(path)
35+
if node.module and node.module.startswith(package):
36+
package_files.add(path)
2737
break
28-
return pandas_files
38+
return package_files
2939

3040
if __name__ == '__main__':
3141
project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) # or replace with your path
3242
print(f"Project root: {project_root}")
33-
for f in sorted(files_importing_pandas(project_root)):
34-
print(f)
43+
44+
for package in packages:
45+
print(f"\n=== Files importing {package} ===")
46+
files = files_importing_package(project_root, package)
47+
if files:
48+
for f in sorted(files):
49+
print(f)
50+
else:
51+
print(f"No files found importing {package}")

0 commit comments

Comments
 (0)