Spaces:
Running
Running
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "ag-ui-protocol==0.1.9", | |
| # "aiohappyeyeballs==2.6.1", | |
| # "aiohttp==3.13.0", | |
| # "aiosignal==1.4.0", | |
| # "annotated-types==0.7.0", | |
| # "anthropic==0.70.0", | |
| # "anyio==4.11.0", | |
| # "argcomplete==3.6.2", | |
| # "attrs==25.4.0", | |
| # "authlib==1.6.5", | |
| # "beautifulsoup4==4.14.2", | |
| # "black==25.9.0", | |
| # "boto3==1.40.53", | |
| # "botocore==1.40.53", | |
| # "cachetools==6.2.1", | |
| # "certifi==2025.10.5", | |
| # "cffi==2.0.0", | |
| # "charset-normalizer==3.4.4", | |
| # "click==8.3.0", | |
| # "cobble==0.1.4", | |
| # "cohere==5.19.0", | |
| # "colorama==0.4.6", | |
| # "coloredlogs==15.0.1", | |
| # "cryptography==46.0.3", | |
| # "cyclopts==3.24.0", | |
| # "defusedxml==0.7.1", | |
| # "distro==1.9.0", | |
| # "dnspython==2.8.0", | |
| # "docstring-parser==0.17.0", | |
| # "docstring-to-markdown==0.17", | |
| # "docutils==0.22.2", | |
| # "email-validator==2.3.0", | |
| # "eval-type-backport==0.2.2", | |
| # "exceptiongroup==1.3.0", | |
| # "executing==2.2.1", | |
| # "fastapi>=0.119.0", | |
| # "fastavro==1.12.1", | |
| # "fastmcp==2.12.4", | |
| # "filelock==3.20.0", | |
| # "flatbuffers==25.9.23", | |
| # "frozenlist==1.8.0", | |
| # "fsspec==2025.9.0", | |
| # "genai-prices==0.0.32", | |
| # "google-auth==2.41.1", | |
| # "google-genai==1.45.0", | |
| # "googleapis-common-protos==1.70.0", | |
| # "griffe==1.14.0", | |
| # "groq==0.32.0", | |
| # "h11==0.16.0", | |
| # "hf-xet==1.1.10", | |
| # "html-for-docx==1.0.10", | |
| # "httpcore==1.0.9", | |
| # "httpx==0.28.1", | |
| # "httpx-sse==0.4.0", | |
| # "huggingface-hub==0.35.3", | |
| # "humanfriendly==10.0", | |
| # "idna==3.11", | |
| # "importlib-metadata==8.7.0", | |
| # "invoke==2.2.1", | |
| # "isodate==0.7.2", | |
| # "itsdangerous==2.2.0", | |
| # "jedi==0.19.2", | |
| # "jiter==0.11.0", | |
| # "jmespath==1.0.1", | |
| # "jsonschema==4.25.1", | |
| # "jsonschema-path==0.3.4", | |
| # "jsonschema-specifications==2025.9.1", | |
| # "lazy-object-proxy==1.12.0", | |
| # "logfire==4.13.2", | |
| # "logfire-api==4.13.2", | |
| # "loro==1.8.1", | |
| # "lxml==6.0.2", | |
| # "magika==0.6.2", | |
| # "mammoth==1.11.0", | |
| # "marimo==0.17.0", | |
| # "markdown==3.9", | |
| # "markdown-it-py==4.0.0", | |
| # "markdownify==1.2.0", | |
| # "markitdown>=0.1.2", | |
| # "markupsafe==3.0.3", | |
| # "mcp==1.17.0", | |
| # "mdurl==0.1.2", | |
| # "mistralai==1.9.11", | |
| # "mistune==3.1.4", | |
| # "more-itertools==10.8.0", | |
| # "mpmath==1.3.0", | |
| # "msgspec-m==0.19.2", | |
| # "multidict==6.7.0", | |
| # "mypy-extensions==1.1.0", | |
| # "narwhals==2.8.0", | |
| # "nest-asyncio==1.6.0", | |
| # "nexus-rpc==1.1.0", | |
| # "numpy==2.3.4", | |
| # "onnxruntime==1.23.1", | |
| # "openai==2.3.0", | |
| # "openapi-core==0.19.5", | |
| # "openapi-pydantic==0.5.1", | |
| # "openapi-schema-validator==0.6.3", | |
| # "openapi-spec-validator==0.7.2", | |
| # "opentelemetry-api==1.37.0", | |
| # "opentelemetry-exporter-otlp-proto-common==1.37.0", | |
| # "opentelemetry-exporter-otlp-proto-http==1.37.0", | |
| # "opentelemetry-instrumentation==0.58b0", | |
| # "opentelemetry-instrumentation-httpx==0.58b0", | |
| # "opentelemetry-proto==1.37.0", | |
| # "opentelemetry-sdk==1.37.0", | |
| # "opentelemetry-semantic-conventions==0.58b0", | |
| # "opentelemetry-util-http==0.58b0", | |
| # "packaging==25.0", | |
| # "parse==1.20.2", | |
| # "parso==0.8.5", | |
| # "pathable==0.4.4", | |
| # "pathspec==0.12.1", | |
| # "pdfminer-six==20250506", | |
| # "platformdirs==4.5.0", | |
| # "pluggy==1.6.0", | |
| # "prompt-toolkit==3.0.52", | |
| # "propcache==0.4.1", | |
| # "protobuf==6.33.0", | |
| # "psutil==7.1.0", | |
| # "pyasn1==0.6.1", | |
| # "pyasn1-modules==0.4.2", | |
| # "pycparser==2.23", | |
| # "pydantic==2.12.2", | |
| # "pydantic-ai==1.1.0", | |
| # "pydantic-ai-slim==1.1.0", | |
| # "pydantic-core==2.41.4", | |
| # "pydantic-evals==1.1.0", | |
| # "pydantic-graph==1.1.0", | |
| # "pydantic-settings==2.11.0", | |
| # "pygments==2.19.2", | |
| # "pymdown-extensions==10.16.1", | |
| # "pyperclip==1.11.0", | |
| # "python-dateutil==2.9.0.post0", | |
| # "python-docx==1.2.0", | |
| # "python-docx-replace==0.4.4", | |
| # "python-dotenv==1.1.1", | |
| # "python-lsp-jsonrpc==1.1.2", | |
| # "python-lsp-server==1.13.1", | |
| # "python-multipart==0.0.20", | |
| # "pytokens==0.2.0", | |
| # "pyyaml==6.0.3", | |
| # "referencing==0.36.2", | |
| # "requests==2.32.5", | |
| # "rfc3339-validator==0.1.4", | |
| # "rich==14.2.0", | |
| # "rich-rst==1.3.2", | |
| # "rpds-py==0.27.1", | |
| # "rsa==4.9.1", | |
| # "s3transfer==0.14.0", | |
| # "six==1.17.0", | |
| # "sniffio==1.3.1", | |
| # "soupsieve==2.8", | |
| # "sse-starlette==3.0.2", | |
| # "starlette==0.48.0", | |
| # "sympy==1.14.0", | |
| # "temporalio==1.18.0", | |
| # "tenacity==9.1.2", | |
| # "tokenizers==0.22.1", | |
| # "tomlkit==0.13.3", | |
| # "tqdm==4.67.1", | |
| # "types-protobuf==6.32.1.20250918", | |
| # "types-requests==2.32.4.20250913", | |
| # "typing-extensions==4.15.0", | |
| # "typing-inspection==0.4.2", | |
| # "ujson==5.11.0", | |
| # "urllib3==2.5.0", | |
| # "uvicorn==0.37.0", | |
| # "uvloop==0.21.0", | |
| # "wcwidth==0.2.14", | |
| # "websockets==15.0.1", | |
| # "werkzeug==3.1.1", | |
| # "wrapt==1.17.3", | |
| # "yarl==1.22.0", | |
| # "zipp==3.23.0", | |
| # ] | |
| # /// | |
| import logging | |
| import os | |
| from pathlib import Path | |
| import marimo | |
| from dotenv import load_dotenv | |
| from fastapi import FastAPI, Request | |
| from fastapi.responses import RedirectResponse | |
| # Load environment variables | |
| load_dotenv() | |
| # Set up logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| # Get port from environment variable or use default | |
| PORT = int(os.environ.get('PORT', 7860)) | |
| root_dir = Path(__file__).parent.parent | |
| ROOTS = [root_dir / 'cicero_jobs'] | |
| server = marimo.create_asgi_app(include_code=True) | |
| app_names: list[str] = [] | |
| for root in ROOTS: | |
| for filename in root.iterdir(): | |
| if filename.is_file() and filename.suffix == '.py': | |
| app_path = root.stem + '/' + filename.stem | |
| server = server.with_app(path=f'/{app_path}', root=str(filename)) | |
| app_names.append(app_path) | |
| # Create a FastAPI app | |
| app = FastAPI() | |
| logger.info(f'Mounting {len(app_names)} apps') | |
| for app_name in app_names: | |
| logger.info(' /%s', app_name) | |
| async def home(request: Request): | |
| return RedirectResponse(url='/cicero_jobs/app/') | |
| app.mount('/', server.build()) | |
| # Run the server | |
| if __name__ == '__main__': | |
| import uvicorn | |
| uvicorn.run(app, host='0.0.0.0', port=PORT, log_level='info') | |