-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_docs.py
More file actions
42 lines (33 loc) · 1.18 KB
/
run_docs.py
File metadata and controls
42 lines (33 loc) · 1.18 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
#!/usr/bin/env python3
"""
MkDocs Runner for Text Classification API Documentation
Serve the API documentation locally
"""
import subprocess
import sys
import os
def main():
"""Serve the MkDocs documentation"""
print("📚 Starting MkDocs documentation server...")
# Change to api directory where mkdocs.yml is located
api_dir = os.path.join(os.path.dirname(__file__), "api")
if not os.path.exists(api_dir):
print("❌ API directory not found!")
sys.exit(1)
os.chdir(api_dir)
# Check if mkdocs.yml exists
if not os.path.exists("mkdocs.yml"):
print("❌ mkdocs.yml not found in api directory!")
sys.exit(1)
try:
print("📖 Documentation will be available at: http://localhost:8001")
print("Press Ctrl+C to stop the documentation server")
print("-" * 50)
subprocess.run([sys.executable, "-m", "mkdocs", "serve", "--dev-addr=127.0.0.1:8001"], check=True)
except KeyboardInterrupt:
print("\n👋 Documentation server stopped")
except subprocess.CalledProcessError as e:
print(f"❌ Failed to start documentation server: {e}")
sys.exit(1)
if __name__ == "__main__":
main()