marcosomma commited on
Commit
aebb186
·
1 Parent(s): 2c655e8

documentation

Browse files
.github/workflows/docs.yml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Documentation
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ paths:
7
+ - 'orka/**'
8
+ - 'docs/**'
9
+ - '.github/workflows/docs.yml'
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ pages: write
15
+ id-token: write
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v3
23
+
24
+ - name: Setup Python
25
+ uses: actions/setup-python@v4
26
+ with:
27
+ python-version: '3.10'
28
+ cache: pip
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install -e ".[dev]"
34
+ pip install sphinx sphinx-rtd-theme
35
+
36
+ - name: Build documentation
37
+ run: |
38
+ python docs/sphinx/build_docs.py
39
+
40
+ - name: Setup Pages
41
+ uses: actions/configure-pages@v3
42
+
43
+ - name: Upload artifact
44
+ uses: actions/upload-pages-artifact@v2
45
+ with:
46
+ path: 'docs/sphinx/_build/html'
47
+
48
+ deploy:
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ runs-on: ubuntu-latest
53
+ needs: build
54
+ steps:
55
+ - name: Deploy to GitHub Pages
56
+ id: deployment
57
+ uses: actions/deploy-pages@v2
.gitignore CHANGED
@@ -36,4 +36,11 @@ Thumbs.db
36
  # Backup
37
  *.rdb
38
 
 
 
 
 
 
 
 
39
  PRIVATE_**.*
 
36
  # Backup
37
  *.rdb
38
 
39
+ # Sphinx documentation
40
+ docs/sphinx/_build/
41
+ docs/sphinx/*.rst
42
+ !docs/sphinx/index.rst
43
+ docs/sphinx/_static/
44
+ docs/sphinx/_templates/
45
+
46
  PRIVATE_**.*
README.md CHANGED
@@ -527,7 +527,8 @@ A content platform used OrKa to build a moderation system that:
527
 
528
  ## 📚 Documentation
529
 
530
- 📘 [View the Documentation](./docs/index.md)
 
531
  📝 [YAML Configuration Guide](./docs/yaml-configuration-guide.md) - Detailed examples for all agent types and nodes
532
 
533
  ## 🤝 Contributing
 
527
 
528
  ## 📚 Documentation
529
 
530
+ 🐍 [Pypi Documentation](./docs/sphinx/_build/html/index.html)
531
+ 📘 [View the Idea Manifesto](./docs/index.md)
532
  📝 [YAML Configuration Guide](./docs/yaml-configuration-guide.md) - Detailed examples for all agent types and nodes
533
 
534
  ## 🤝 Contributing
build_docs.bat ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ @echo off
2
+ echo Building OrKa Documentation...
3
+ python -m pip install sphinx sphinx-rtd-theme
4
+ python docs/sphinx/build_docs.py
5
+ echo Done!
6
+ pause
build_docs.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "Building OrKa Documentation..."
3
+ python -m pip install sphinx sphinx-rtd-theme
4
+ python docs/sphinx/build_docs.py
5
+ echo "Done!"
docs/sphinx/build_docs.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """
3
+ Script to build the OrKa documentation.
4
+ """
5
+
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+
11
+
12
+ def main():
13
+ """Run the main documentation build process."""
14
+ # Get the directory of this script
15
+ script_dir = os.path.dirname(os.path.abspath(__file__))
16
+
17
+ # Path to the source code
18
+ orka_dir = os.path.abspath(os.path.join(script_dir, "..", "..", "orka"))
19
+
20
+ # Create directories if they don't exist
21
+ os.makedirs(os.path.join(script_dir, "_build"), exist_ok=True)
22
+ os.makedirs(os.path.join(script_dir, "_static"), exist_ok=True)
23
+ os.makedirs(os.path.join(script_dir, "_templates"), exist_ok=True)
24
+
25
+ # Get the current Python executable
26
+ python_exe = sys.executable
27
+
28
+ # Try to find sphinx executables
29
+ sphinx_apidoc = shutil.which("sphinx-apidoc")
30
+ sphinx_build = shutil.which("sphinx-build")
31
+
32
+ print("Generating module documentation...")
33
+ try:
34
+ if sphinx_apidoc:
35
+ # Use direct command if available
36
+ subprocess.run(
37
+ [
38
+ sphinx_apidoc,
39
+ "-f",
40
+ "-o",
41
+ script_dir,
42
+ orka_dir,
43
+ "--separate",
44
+ "--module-first",
45
+ ],
46
+ check=True,
47
+ )
48
+ else:
49
+ # Fall back to module approach
50
+ subprocess.run(
51
+ [
52
+ python_exe,
53
+ "-m",
54
+ "sphinx.ext.apidoc",
55
+ "-f",
56
+ "-o",
57
+ script_dir,
58
+ orka_dir,
59
+ "--separate",
60
+ "--module-first",
61
+ ],
62
+ check=True,
63
+ )
64
+ except subprocess.CalledProcessError:
65
+ # If both methods fail, try with pip install first
66
+ print("Installing sphinx and dependencies...")
67
+ subprocess.run(
68
+ [python_exe, "-m", "pip", "install", "sphinx", "sphinx-rtd-theme"],
69
+ check=True,
70
+ )
71
+
72
+ # Try again with the module
73
+ print("Retrying documentation generation...")
74
+ subprocess.run(
75
+ [
76
+ python_exe,
77
+ "-c",
78
+ "from sphinx.ext import apidoc; apidoc.main(['-f', '-o', r'"
79
+ + script_dir
80
+ + "', r'"
81
+ + orka_dir
82
+ + "', '--separate', '--module-first'])",
83
+ ],
84
+ check=True,
85
+ )
86
+
87
+ print("Building HTML documentation...")
88
+ html_dir = os.path.join(script_dir, "_build", "html")
89
+
90
+ try:
91
+ if sphinx_build:
92
+ # Use direct command if available
93
+ subprocess.run(
94
+ [sphinx_build, "-b", "html", script_dir, html_dir], check=True
95
+ )
96
+ else:
97
+ # Fall back to module approach
98
+ subprocess.run(
99
+ [
100
+ python_exe,
101
+ "-c",
102
+ "import sphinx.cmd.build; sphinx.cmd.build.main(['-b', 'html', r'"
103
+ + script_dir
104
+ + "', r'"
105
+ + html_dir
106
+ + "'])",
107
+ ],
108
+ check=True,
109
+ )
110
+ except subprocess.CalledProcessError:
111
+ print("Retrying HTML build with direct import...")
112
+ subprocess.run(
113
+ [
114
+ python_exe,
115
+ "-c",
116
+ "import sphinx; sphinx.build_main(['-b', 'html', r'"
117
+ + script_dir
118
+ + "', r'"
119
+ + html_dir
120
+ + "'])",
121
+ ],
122
+ check=True,
123
+ )
124
+
125
+ print(f"Documentation built successfully in {html_dir}")
126
+ return 0
127
+
128
+
129
+ if __name__ == "__main__":
130
+ sys.exit(main())
docs/sphinx/conf.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ import os
7
+ import sys
8
+
9
+ sys.path.insert(0, os.path.abspath("../.."))
10
+
11
+ # -- Project information -----------------------------------------------------
12
+ project = "OrKa"
13
+ copyright = "2025, Marco Somma"
14
+ author = "Marco Somma"
15
+ version = "0.5.7"
16
+
17
+ # -- General configuration ---------------------------------------------------
18
+ extensions = [
19
+ "sphinx.ext.autodoc",
20
+ "sphinx.ext.viewcode",
21
+ "sphinx.ext.napoleon",
22
+ "sphinx.ext.intersphinx",
23
+ ]
24
+
25
+ templates_path = ["_templates"]
26
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
27
+
28
+ # -- Options for HTML output -------------------------------------------------
29
+ html_theme = "sphinx_rtd_theme"
30
+ html_static_path = ["_static"]
31
+
32
+ # -- Options for autodoc -----------------------------------------------------
33
+ autodoc_member_order = "bysource"
34
+ autodoc_default_options = {
35
+ "members": True,
36
+ "show-inheritance": True,
37
+ "undoc-members": True,
38
+ }
39
+
40
+ # -- Napoleon settings -------------------------------------------------------
41
+ napoleon_google_docstring = True
42
+ napoleon_numpy_docstring = False
43
+ napoleon_include_init_with_doc = True
44
+ napoleon_include_private_with_doc = False
45
+ napoleon_include_special_with_doc = True
46
+ napoleon_use_admonition_for_examples = True
47
+ napoleon_use_admonition_for_notes = True
48
+ napoleon_use_admonition_for_references = True
49
+ napoleon_use_ivar = False
50
+ napoleon_use_param = True
51
+ napoleon_use_rtype = True
52
+ napoleon_preprocess_types = False
53
+ napoleon_type_aliases = None
54
+ napoleon_attr_annotations = True
docs/sphinx/index.rst ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Welcome to OrKa's Documentation!
2
+ ==============================
3
+
4
+ OrKa: Orchestrator Kit Agents
5
+ -----------------------------
6
+
7
+ .. toctree::
8
+ :maxdepth: 2
9
+ :caption: Contents:
10
+
11
+ modules
12
+
13
+ Indices and tables
14
+ ==================
15
+
16
+ * :ref:`genindex`
17
+ * :ref:`modindex`
18
+ * :ref:`search`
pyproject.toml CHANGED
@@ -34,7 +34,9 @@ dev = [
34
  "pytest",
35
  "coverage",
36
  "pytest-cov",
37
- "ruff"
 
 
38
  ]
39
 
40
  [project.entry-points."orka.agents"]
 
34
  "pytest",
35
  "coverage",
36
  "pytest-cov",
37
+ "ruff",
38
+ "sphinx",
39
+ "sphinx-rtd-theme"
40
  ]
41
 
42
  [project.entry-points."orka.agents"]
requirements.txt CHANGED
@@ -16,4 +16,6 @@ pytest-asyncio>=0.21.0
16
  uvicorn
17
  sentence-transformers>=2.2.0
18
  numpy>=1.21.0
19
- fakeredis>=2.0.0
 
 
 
16
  uvicorn
17
  sentence-transformers>=2.2.0
18
  numpy>=1.21.0
19
+ fakeredis>=2.0.0
20
+ sphinx
21
+ sphinx-rtd-theme