-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
68 lines (59 loc) · 2.1 KB
/
setup.py
File metadata and controls
68 lines (59 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
from setuptools import setup, find_packages
def read_environment_yaml():
"""Read dependencies from environment.yaml"""
env_file = 'environment.yaml'
if not os.path.exists(env_file):
return []
try:
import yaml
with open(env_file, 'r') as f:
env_data = yaml.safe_load(f)
except ImportError:
# PyYAML not available, fallback to basic parsing
return []
# Extract pip dependencies
pip_deps = []
dependencies = env_data.get('dependencies', [])
for dep in dependencies:
if isinstance(dep, dict) and 'pip' in dep:
pip_deps.extend(dep['pip'])
# Filter out packages that are typically conda-only or not needed for setup.py
essential_deps = []
for dep in pip_deps:
pkg_name = dep.split('==')[0].split('>=')[0].split('<=')[0]
# Keep only essential dependencies for the core package
if pkg_name.lower() in ['numpy', 'scipy', 'matplotlib', 'scikit-learn', 'scikit-image', 'pot', 'tqdm']:
essential_deps.append(dep)
return essential_deps
def get_base_requirements():
"""Get base requirements that are always needed"""
return [
'torch',
'numpy',
]
# Read all dependencies from environment.yaml
try:
env_requirements = read_environment_yaml()
install_requires = get_base_requirements() + env_requirements
except Exception:
install_requires = get_base_requirements()
setup(
name='nonlinear-tsw',
version='0.1.0',
package_dir={'': 'src'},
packages=find_packages(where='src'),
install_requires=install_requires,
author='Thanh Tran',
author_email='thanhqt2002@gmail.com',
description='Tree-Sliced Wasserstein Distance with Nonlinear Projection',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/thanhqt2002/NonlinearTSW',
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
python_requires='>=3.9',
)