Suhasdev commited on
Commit
f0ab1a7
·
1 Parent(s): 74d4bea

Fix Hugging Face Spaces deployment: add setup.py, install local package in requirements.txt, improve path setup

Browse files
Files changed (3) hide show
  1. app.py +7 -2
  2. requirements.txt +3 -0
  3. setup.py +64 -0
app.py CHANGED
@@ -5,8 +5,13 @@ Principal Engineer Edition: Linear/Vercel-style Dark Mode with Premium UX
5
 
6
  import sys
7
  import os
8
- # Add src directory to Python path for gepa_optimizer imports
9
- sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
 
 
 
 
 
10
 
11
  import gradio as gr
12
  import json
 
5
 
6
  import sys
7
  import os
8
+ from pathlib import Path
9
+
10
+ # Add src directory to Python path for Hugging Face Spaces
11
+ # This ensures gepa_optimizer can be imported even if -e . installation fails
12
+ src_path = Path(__file__).parent / "src"
13
+ if src_path.exists() and str(src_path) not in sys.path:
14
+ sys.path.insert(0, str(src_path))
15
 
16
  import gradio as gr
17
  import json
requirements.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  # Core dependencies - gepa from git
2
  git+https://github.com/gepa-ai/gepa.git
3
  numpy>=1.21.0
 
1
+ # Install local gepa_optimizer package first
2
+ -e .
3
+
4
  # Core dependencies - gepa from git
5
  git+https://github.com/gepa-ai/gepa.git
6
  numpy>=1.21.0
setup.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import setup, find_packages
2
+ from pathlib import Path
3
+
4
+ # Read version from version.py
5
+ version_file = Path(__file__).parent / "src" / "gepa_optimizer" / "version.py"
6
+ version = "0.1.0" # Default version
7
+ if version_file.exists():
8
+ with open(version_file, 'r') as f:
9
+ for line in f:
10
+ if line.startswith('__version__'):
11
+ version = line.split('=')[1].strip().strip('"').strip("'")
12
+ break
13
+
14
+ # Read README for long description
15
+ readme_file = Path(__file__).parent / "README.md"
16
+ long_description = ""
17
+ if readme_file.exists():
18
+ with open(readme_file, 'r', encoding='utf-8') as f:
19
+ long_description = f.read()
20
+
21
+ setup(
22
+ name="gepa-optimizer",
23
+ version=version,
24
+ description="Genetic Evolutionary Prompt Agent (GEPA) - Universal Prompt Optimizer",
25
+ long_description=long_description,
26
+ long_description_content_type="text/markdown",
27
+ author="GEPA Team",
28
+ packages=find_packages(where="src"),
29
+ package_dir={"": "src"},
30
+ python_requires=">=3.8",
31
+ install_requires=[
32
+ "numpy>=1.21.0",
33
+ "pandas>=1.5.0",
34
+ "pydantic>=2.0.0",
35
+ "python-dotenv>=1.0.0",
36
+ "requests>=2.31.0",
37
+ "aiohttp>=3.8.0",
38
+ "asyncio-throttle>=1.0.0",
39
+ "openai>=1.0.0",
40
+ "anthropic>=0.18.0",
41
+ "google-generativeai>=0.3.0",
42
+ "google-genai>=0.2.0",
43
+ "Pillow>=9.0.0",
44
+ ],
45
+ extras_require={
46
+ "dev": [
47
+ "pytest>=7.0.0",
48
+ "black>=22.0.0",
49
+ "flake8>=4.0.0",
50
+ ],
51
+ },
52
+ classifiers=[
53
+ "Development Status :: 4 - Beta",
54
+ "Intended Audience :: Developers",
55
+ "License :: OSI Approved :: MIT License",
56
+ "Programming Language :: Python :: 3",
57
+ "Programming Language :: Python :: 3.8",
58
+ "Programming Language :: Python :: 3.9",
59
+ "Programming Language :: Python :: 3.10",
60
+ "Programming Language :: Python :: 3.11",
61
+ "Programming Language :: Python :: 3.12",
62
+ ],
63
+ )
64
+