Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Consiliency_treesitter-chunker /scripts /serve_all.py
| #!/usr/bin/env python3 | |
| """Launch both MkDocs and Sphinx servers simultaneously.""" | |
| import os | |
| import subprocess | |
| import sys | |
| import threading | |
| import time | |
| from pathlib import Path | |
| def run_mkdocs(): | |
| """Run MkDocs server in background.""" | |
| project_root = Path(__file__).parent.parent | |
| os.chdir(project_root) | |
| try: | |
| subprocess.run( | |
| [ | |
| sys.executable, | |
| "-m", | |
| "mkdocs", | |
| "serve", | |
| "--dev-addr", | |
| "127.0.0.1:8000", | |
| "--livereload", | |
| ], | |
| check=True, | |
| ) | |
| except subprocess.CalledProcessError as e: | |
| print(f"โ MkDocs error: {e}") | |
| def run_sphinx(): | |
| """Run Sphinx server in background.""" | |
| project_root = Path(__file__).parent.parent | |
| sphinx_dir = project_root / "docs" / "sphinx" | |
| os.chdir(sphinx_dir) | |
| try: | |
| subprocess.run( | |
| [ | |
| sys.executable, | |
| "-m", | |
| "sphinx_autobuild", | |
| "source", | |
| "_build/html", | |
| "--host", | |
| "127.0.0.1", | |
| "--port", | |
| "8001", | |
| ], | |
| check=True, | |
| ) | |
| except subprocess.CalledProcessError as e: | |
| print(f"โ Sphinx error: {e}") | |
| def main(): | |
| """Launch both servers.""" | |
| print("๐ Launching both documentation servers...") | |
| print() | |
| print("๐ MkDocs (Material theme): http://127.0.0.1:8000") | |
| print("๐ Sphinx (Read the Docs theme): http://127.0.0.1:8001") | |
| print() | |
| print("๐ Both servers have live-reload enabled") | |
| print("โน๏ธ Press Ctrl+C to stop all servers") | |
| print() | |
| # Start servers in separate threads | |
| mkdocs_thread = threading.Thread(target=run_mkdocs, daemon=True) | |
| sphinx_thread = threading.Thread(target=run_sphinx, daemon=True) | |
| mkdocs_thread.start() | |
| time.sleep(2) # Small delay to avoid port conflicts | |
| sphinx_thread.start() | |
| try: | |
| # Keep main thread alive | |
| while True: | |
| time.sleep(1) | |
| except KeyboardInterrupt: | |
| print("\n๐ Stopping all servers...") | |
| print("โ Servers stopped") | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 2.24 kB
- Xet hash:
- 07e1807fa04817aeb44bcfae0516c7248fb077b9ef07f0899205d84b8033671f
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.