style: apply black and isort formatting across entire codebase
- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
from alembic import command
|
||||
from alembic.config import Config
|
||||
from urllib.parse import urlparse
|
||||
|
||||
# Add project root to Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
@@ -20,10 +22,10 @@ def get_database_info():
|
||||
parsed = urlparse(db_url)
|
||||
|
||||
db_type = parsed.scheme
|
||||
if db_type == 'sqlite':
|
||||
if db_type == "sqlite":
|
||||
# Extract path from sqlite:///./path or sqlite:///path
|
||||
db_path = db_url.replace('sqlite:///', '')
|
||||
if db_path.startswith('./'):
|
||||
db_path = db_url.replace("sqlite:///", "")
|
||||
if db_path.startswith("./"):
|
||||
db_path = db_path[2:]
|
||||
return db_type, db_path
|
||||
else:
|
||||
@@ -40,7 +42,7 @@ def verify_database_setup():
|
||||
db_type, db_path = get_database_info()
|
||||
print(f"[INFO] Database type: {db_type}")
|
||||
|
||||
if db_type == 'sqlite':
|
||||
if db_type == "sqlite":
|
||||
if not os.path.exists(db_path):
|
||||
print(f"[ERROR] Database file not found: {db_path}")
|
||||
return False
|
||||
@@ -54,10 +56,14 @@ def verify_database_setup():
|
||||
|
||||
with engine.connect() as conn:
|
||||
# Get table list (works for both SQLite and PostgreSQL)
|
||||
if db_type == 'sqlite':
|
||||
result = conn.execute(text("SELECT name FROM sqlite_master WHERE type='table'"))
|
||||
if db_type == "sqlite":
|
||||
result = conn.execute(
|
||||
text("SELECT name FROM sqlite_master WHERE type='table'")
|
||||
)
|
||||
else:
|
||||
result = conn.execute(text("SELECT tablename FROM pg_tables WHERE schemaname='public'"))
|
||||
result = conn.execute(
|
||||
text("SELECT tablename FROM pg_tables WHERE schemaname='public'")
|
||||
)
|
||||
|
||||
tables = [row[0] for row in result.fetchall()]
|
||||
|
||||
@@ -65,12 +71,17 @@ def verify_database_setup():
|
||||
|
||||
# Expected tables from your models
|
||||
expected_tables = [
|
||||
'users', 'products', 'inventory', 'vendors', 'products',
|
||||
'marketplace_import_jobs', 'alembic_version'
|
||||
"users",
|
||||
"products",
|
||||
"inventory",
|
||||
"vendors",
|
||||
"products",
|
||||
"marketplace_import_jobs",
|
||||
"alembic_version",
|
||||
]
|
||||
|
||||
for table in sorted(tables):
|
||||
if table == 'alembic_version':
|
||||
if table == "alembic_version":
|
||||
print(f" * {table} (migration tracking)")
|
||||
elif table in expected_tables:
|
||||
print(f" * {table}")
|
||||
@@ -78,12 +89,12 @@ def verify_database_setup():
|
||||
print(f" ? {table} (unexpected)")
|
||||
|
||||
# Check for missing expected tables
|
||||
missing_tables = set(expected_tables) - set(tables) - {'alembic_version'}
|
||||
missing_tables = set(expected_tables) - set(tables) - {"alembic_version"}
|
||||
if missing_tables:
|
||||
print(f"[WARNING] Missing expected tables: {missing_tables}")
|
||||
|
||||
# Check if alembic_version table exists
|
||||
if 'alembic_version' in tables:
|
||||
if "alembic_version" in tables:
|
||||
result = conn.execute(text("SELECT version_num FROM alembic_version"))
|
||||
version = result.fetchone()
|
||||
if version:
|
||||
@@ -126,16 +137,19 @@ def verify_model_structure():
|
||||
# Test database models
|
||||
try:
|
||||
from models.database.base import Base
|
||||
|
||||
print(f"[OK] Database Base imported")
|
||||
print(f"[INFO] Found {len(Base.metadata.tables)} database tables: {list(Base.metadata.tables.keys())}")
|
||||
print(
|
||||
f"[INFO] Found {len(Base.metadata.tables)} database tables: {list(Base.metadata.tables.keys())}"
|
||||
)
|
||||
|
||||
# Import specific models
|
||||
from models.database.user import User
|
||||
from models.database.marketplace_product import MarketplaceProduct
|
||||
from models.database.inventory import Inventory
|
||||
from models.database.vendor import Vendor
|
||||
from models.database.product import Product
|
||||
from models.database.marketplace_import_job import MarketplaceImportJob
|
||||
from models.database.marketplace_product import MarketplaceProduct
|
||||
from models.database.product import Product
|
||||
from models.database.user import User
|
||||
from models.database.vendor import Vendor
|
||||
|
||||
print("[OK] All database models imported successfully")
|
||||
|
||||
@@ -146,13 +160,23 @@ def verify_model_structure():
|
||||
# Test API models
|
||||
try:
|
||||
import models.schema
|
||||
|
||||
print("[OK] API models package imported")
|
||||
|
||||
# Test specific API model imports
|
||||
api_modules = ['base', 'auth', 'product', 'inventory', 'vendor ', 'marketplace', 'admin', 'stats']
|
||||
api_modules = [
|
||||
"base",
|
||||
"auth",
|
||||
"product",
|
||||
"inventory",
|
||||
"vendor ",
|
||||
"marketplace",
|
||||
"admin",
|
||||
"stats",
|
||||
]
|
||||
for module in api_modules:
|
||||
try:
|
||||
__import__(f'models.api.{module}')
|
||||
__import__(f"models.api.{module}")
|
||||
print(f" * models.api.{module}")
|
||||
except ImportError:
|
||||
print(f" ? models.api.{module} (not found, optional)")
|
||||
@@ -176,7 +200,7 @@ def check_project_structure():
|
||||
"models/database/inventory.py",
|
||||
"app/core/config.py",
|
||||
"alembic/env.py",
|
||||
"alembic.ini"
|
||||
"alembic.ini",
|
||||
]
|
||||
|
||||
for path in critical_paths:
|
||||
@@ -189,7 +213,7 @@ def check_project_structure():
|
||||
init_files = [
|
||||
"models/__init__.py",
|
||||
"models/database/__init__.py",
|
||||
"models/api/__init__.py"
|
||||
"models/api/__init__.py",
|
||||
]
|
||||
|
||||
print(f"\n[INIT] Checking __init__.py files...")
|
||||
@@ -221,7 +245,9 @@ if __name__ == "__main__":
|
||||
print("Next steps:")
|
||||
print(" 1. Run 'make dev' to start your FastAPI server")
|
||||
print(" 2. Visit http://localhost:8000/docs for interactive API docs")
|
||||
print(" 3. Use your API endpoints for authentication, products, inventory, etc.")
|
||||
print(
|
||||
" 3. Use your API endpoints for authentication, products, inventory, etc."
|
||||
)
|
||||
sys.exit(0)
|
||||
else:
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user