File size: 5,915 Bytes
c60109f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/usr/bin/env python3
"""
HunyuanVideo-Foley: Multimodal Diffusion with Representation Alignment 
for High-Fidelity Foley Audio Generation

Setup script for building and installing the HunyuanVideo-Foley package.
"""

import os
import re
from typing import List
from setuptools import setup, find_packages

def read_file(filename: str) -> str:
    """Read content from a file."""
    here = os.path.abspath(os.path.dirname(__file__))
    with open(os.path.join(here, filename), 'r', encoding='utf-8') as f:
        return f.read()

def get_version() -> str:
    """Extract version from constants.py or use default."""
    try:
        constants_path = os.path.join('hunyuanvideo_foley', 'constants.py')
        content = read_file(constants_path)
        version_match = re.search(r"__version__\s*=\s*['\"]([^'\"]*)['\"]", content)
        if version_match:
            return version_match.group(1)
    except FileNotFoundError:
        pass
    return "1.0.0"

def parse_requirements(filename: str) -> List[str]:
    """Parse requirements from requirements.txt file."""
    try:
        content = read_file(filename)
        lines = content.splitlines()
        requirements = []
        
        for line in lines:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            
            # Handle git+https dependencies - convert to standard package names
            if line.startswith('git+'):
                if 'transformers' in line:
                    requirements.append('transformers>=4.49.0')
                elif 'audiotools' in line:
                    # Use a placeholder for audiotools since it's not on PyPI
                    # Users will need to install it separately
                    continue  # Skip for now
                else:
                    continue  # Skip other git dependencies
            else:
                requirements.append(line)
                
        return requirements
    except FileNotFoundError:
        return []

def get_long_description() -> str:
    """Get long description from README.md."""
    try:
        readme = read_file("README.md")
        # Remove HTML tags and excessive styling for PyPI compatibility
        readme = re.sub(r'<[^>]+>', '', readme)
        return readme
    except FileNotFoundError:
        return "Multimodal Diffusion with Representation Alignment for High-Fidelity Foley Audio Generation"

# Read requirements
install_requires = parse_requirements("requirements.txt")

# Separate development requirements
dev_requirements = [
    "black>=23.0.0",
    "isort>=5.12.0", 
    "flake8>=6.0.0",
    "mypy>=1.3.0",
    "pre-commit>=3.0.0",
    "pytest>=7.0.0",
    "pytest-cov>=4.0.0",
]

# Optional dependencies for different features
extras_require = {
    "dev": dev_requirements,
    "test": [
        "pytest>=7.0.0",
        "pytest-cov>=4.0.0",
    ],
    "gradio": [
        "gradio==3.50.2",
    ],
    "comfyui": [
        # ComfyUI specific dependencies can be added here
    ],
    "all": dev_requirements + ["gradio==3.50.2"],
}

setup(
    name="hunyuanvideo-foley",
    version=get_version(),
    
    # Package metadata
    author="Tencent Hunyuan Team",
    author_email="hunyuan@tencent.com", 
    description="Multimodal Diffusion with Representation Alignment for High-Fidelity Foley Audio Generation",
    long_description=get_long_description(),
    long_description_content_type="text/markdown",
    
    # URLs
    url="https://github.com/Tencent-Hunyuan/HunyuanVideo-Foley",
    project_urls={
        "Homepage": "https://github.com/Tencent-Hunyuan/HunyuanVideo-Foley",
        "Repository": "https://github.com/Tencent-Hunyuan/HunyuanVideo-Foley",
        "Documentation": "https://szczesnys.github.io/hunyuanvideo-foley",
        "Paper": "https://arxiv.org/abs/2508.16930",
        "Demo": "https://huggingface.co/spaces/tencent/HunyuanVideo-Foley",
        "Models": "https://huggingface.co/tencent/HunyuanVideo-Foley",
    },
    
    # Package discovery
    packages=find_packages(
        include=["hunyuanvideo_foley", "hunyuanvideo_foley.*"]
    ),
    include_package_data=True,
    
    # Package requirements
    python_requires=">=3.8",
    install_requires=install_requires,
    extras_require=extras_require,
    
    # Entry points for command line scripts
    entry_points={
        "console_scripts": [
            "hunyuanvideo-foley=hunyuanvideo_foley.cli:main",
        ],
    },
    
    # Package data
    package_data={
        "hunyuanvideo_foley": [
            "configs/*.yaml",
            "configs/*.yml", 
            "*.yaml",
            "*.yml",
        ],
    },
    
    # Classification
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "Intended Audience :: Science/Research", 
        "License :: OSI Approved :: Apache Software License",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9", 
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "Topic :: Scientific/Engineering :: Artificial Intelligence",
        "Topic :: Multimedia :: Sound/Audio :: Analysis",
        "Topic :: Multimedia :: Video",
    ],
    
    # Keywords for discoverability
    keywords=[
        "artificial intelligence", 
        "machine learning", 
        "deep learning",
        "multimodal",
        "diffusion models",
        "audio generation", 
        "foley audio",
        "video-to-audio",
        "text-to-audio",
        "pytorch",
        "huggingface",
        "tencent",
        "hunyuan"
    ],
    
    # Licensing
    license="Apache-2.0",
    
    # Build configuration
    zip_safe=False,
    
    # Additional metadata
    platforms=["any"],
)