-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
152 lines (134 loc) · 4.2 KB
/
setup.py
File metadata and controls
152 lines (134 loc) · 4.2 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
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
"""
Setup script for Edix package with automatic frontend building
"""
import os
import sys
import subprocess
from pathlib import Path
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.install import install
def build_frontend():
"""Build frontend assets"""
frontend_dir = Path(__file__).parent / "frontend_src"
static_dir = Path(__file__).parent / "edix" / "static"
# Create static directory if not exists
static_dir.mkdir(parents=True, exist_ok=True)
print("Building frontend assets...")
# Check if npm is installed
try:
subprocess.run(["npm", "--version"], check=True, capture_output=True)
except (subprocess.CalledProcessError, FileNotFoundError):
print("Warning: npm not found. Using pre-built frontend assets.")
return
# Install npm dependencies
if frontend_dir.exists():
print("Installing frontend dependencies...")
subprocess.run(
["npm", "install"],
cwd=frontend_dir,
check=False
)
# Build frontend
print("Building frontend...")
result = subprocess.run(
["npm", "run", "build"],
cwd=frontend_dir,
check=False
)
if result.returncode == 0:
print("Frontend built successfully!")
else:
print("Warning: Frontend build failed. Using fallback assets.")
else:
print("Frontend source not found. Using pre-built assets.")
class BuildPyCommand(build_py):
"""Custom build command to compile frontend"""
def run(self):
build_frontend()
build_py.run(self)
class DevelopCommand(develop):
"""Custom develop command to compile frontend"""
def run(self):
build_frontend()
develop.run(self)
class InstallCommand(install):
"""Custom install command to compile frontend"""
def run(self):
build_frontend()
install.run(self)
# Read long description from README
readme_path = Path(__file__).parent / "README.md"
long_description = ""
if readme_path.exists():
long_description = readme_path.read_text(encoding="utf-8")
setup(
name="edix",
version="1.0.2",
author="Your Name",
author_email="your.email@example.com",
description="Universal data structure editor with dynamic SQL schema generation",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/yourusername/edix",
packages=find_packages(),
include_package_data=True,
package_data={
"edix": [
"static/**/*",
"templates/**/*",
"schemas/*.json",
],
},
install_requires=[
"fastapi>=0.100.0",
"uvicorn[standard]>=0.23.0",
"pydantic>=2.0.0",
"pyyaml>=6.0",
"aiosqlite>=0.19.0",
"jinja2>=3.1.0",
"python-multipart>=0.0.6",
"websockets>=11.0",
"jsonschema>=4.19.0",
"alembic>=1.12.0",
],
extras_require={
"dev": [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"black>=23.0.0",
"mypy>=1.5.0",
"ruff>=0.0.290",
],
"export": [
"openpyxl>=3.1.0",
"lxml>=4.9.0",
"toml>=0.10.2",
],
},
cmdclass={
"build_py": BuildPyCommand,
"develop": DevelopCommand,
"install": InstallCommand,
},
entry_points={
"console_scripts": [
"edix=edix.__main__:main",
"edix-server=edix.app:run_server",
],
},
python_requires=">=3.8",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Framework :: FastAPI",
],
)