diff --git a/setup.py b/setup.py index a6a2c6b..b53c8c1 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ class BuildFrontendCommand(Command): - description = 'build frontend assets' + description = "build frontend assets" user_options = [] def initialize_options(self): @@ -24,7 +24,7 @@ def run(self): raise def _build_frontend(self): - frontend_dir = Path(__file__).parent / 'frontend' + frontend_dir = Path(__file__).parent / "frontend" if not frontend_dir.exists(): print(f"Frontend directory not found at {frontend_dir}", file=sys.stderr) return @@ -32,15 +32,25 @@ def _build_frontend(self): print("Building frontend assets...") try: # Run npm install with error handling - result = subprocess.run(['npm', 'install'], cwd=frontend_dir, - capture_output=True, text=True, check=False) + result = subprocess.run( + ["npm", "install"], + cwd=frontend_dir, + capture_output=True, + text=True, + check=False, + ) if result.returncode != 0: print(f"npm install failed: {result.stderr}", file=sys.stderr) raise Exception("npm install failed") # Run npm build with error handling - result = subprocess.run(['npm', 'run', 'build'], cwd=frontend_dir, - capture_output=True, text=True, check=False) + result = subprocess.run( + ["npm", "run", "build"], + cwd=frontend_dir, + capture_output=True, + text=True, + check=False, + ) if result.returncode != 0: print(f"npm build failed: {result.stderr}", file=sys.stderr) raise Exception("npm build failed") @@ -56,11 +66,11 @@ def _build_frontend(self): raise def _copy_assets(self, frontend_dir): - dist_dir = frontend_dir / 'dist' + dist_dir = frontend_dir / "dist" if not dist_dir.exists(): raise Exception(f"Build directory not found at {dist_dir}") - package_static_dir = Path(__file__).parent / 'preswald' / 'static' + package_static_dir = Path(__file__).parent / "preswald" / "static" package_static_dir.mkdir(parents=True, exist_ok=True) # Copy dist contents @@ -78,7 +88,7 @@ def _copy_assets(self, frontend_dir): shutil.copy2(item, dest) # Copy public assets - public_dir = frontend_dir / 'public' + public_dir = frontend_dir / "public" if public_dir.exists(): print("Copying public assets...") for item in public_dir.iterdir(): @@ -92,27 +102,27 @@ def _copy_assets(self, frontend_dir): # Define core dependencies needed for the package to run CORE_DEPENDENCIES = [ - 'fastapi>=0.68.0,<1.0.0', - 'uvicorn>=0.15.0,<1.0.0', - 'websockets>=10.0,<11.0', - 'python-multipart>=0.0.5,<0.1.0', - 'httpx>=0.23.0,<1.0.0', - 'Markdown>=3.4.0', - 'pandas>=1.5', - 'toml==0.10.2', - 'SQLAlchemy==2.0.36', - 'plotly==5.24.1', - 'Jinja2==3.1.4', - 'click==8.1.7', - 'networkx>=3.0', - 'Requests==2.32.3', + "fastapi>=0.68.0,<1.0.0", + "uvicorn>=0.15.0,<1.0.0", + "websockets>=10.0,<11.0", + "python-multipart>=0.0.5,<0.1.0", + "httpx>=0.23.0,<1.0.0", + "Markdown>=3.4.0", + "pandas>=1.5", + "toml==0.10.2", + "SQLAlchemy==2.0.36", + "plotly==5.24.1", + "Jinja2==3.1.4", + "click==8.1.7", + "networkx>=3.0", + "Requests==2.32.3", + "setuptools==75.1.0", ] # Define additional dependencies for development DEV_DEPENDENCIES = [ - 'pytest>=8.3', - 'setuptools==75.1.0', - 'build', + "pytest>=8.3", + "build", ] setup( @@ -126,7 +136,6 @@ def _copy_assets(self, frontend_dir): long_description_content_type="text/markdown", url="https://github.com/StructuredLabs/preswald", license="Apache License 2.0", - # Package configuration packages=find_packages(), classifiers=[ @@ -134,29 +143,25 @@ def _copy_assets(self, frontend_dir): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - # Package data and dependencies include_package_data=True, package_data={ - 'preswald': ['static/*', 'static/assets/*'], + "preswald": ["static/*", "static/assets/*"], }, - python_requires='>=3.7', - + python_requires=">=3.7", # Dependencies install_requires=CORE_DEPENDENCIES, extras_require={ - 'dev': DEV_DEPENDENCIES, + "dev": DEV_DEPENDENCIES, }, - # Command line interface registration entry_points={ - 'console_scripts': [ - 'preswald=preswald.cli:cli', + "console_scripts": [ + "preswald=preswald.cli:cli", ], }, - # Custom commands cmdclass={ - 'build_frontend': BuildFrontendCommand, + "build_frontend": BuildFrontendCommand, }, )