Przeglądaj źródła

A workflow to build documentation with sphinx and push it to github pages (#1)

andrewerf 11 miesięcy temu
rodzic
commit
b0ba3fce5b

+ 21 - 0
.github/workflows/sphinx-docs.yml

@@ -0,0 +1,21 @@
+name: Deploy Sphinx documentation to Pages
+
+on:
+  push:
+    branches: [main, sphinx-test] # branch to trigger deployment
+
+jobs:
+  pages:
+    runs-on: ubuntu-20.04
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    permissions:
+      pages: write
+      id-token: write
+    steps:
+    - run: sudo apt install graphviz
+    - id: deployment
+      uses: sphinx-notes/pages@v3
+      with:
+        documentation_path: ./docs/source

+ 2 - 0
docs/requirements.txt

@@ -0,0 +1,2 @@
+furo
+sphinxcontrib-apidoc

+ 5 - 1
docs/source/conf.py

@@ -20,7 +20,11 @@ author = 'Andrey Aralov'
 # -- General configuration ---------------------------------------------------
 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
 
-extensions = ['sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.graphviz']
+extensions = ['sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.graphviz', 'sphinxcontrib.apidoc']
+
+apidoc_module_dir = '../../'
+apidoc_output_dir = '.'
+apidoc_separate_modules = False
 
 templates_path = ['_templates']
 exclude_patterns = []

+ 0 - 129
notebooks/test_bot.ipynb

@@ -1,129 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "initial_id",
-   "metadata": {
-    "collapsed": true
-   },
-   "outputs": [],
-   "source": [
-    "from pathlib import Path\n",
-    "from aiortc import MediaStreamTrack\n",
-    "from aiortc.contrib.media import MediaRecorder, MediaPlayer\n",
-    "\n",
-    "from aiortc.mediastreams import AudioStreamTrack\n",
-    "\n",
-    "from hubsbot import Bot\n",
-    "from hubsbot.peer import Peer\n",
-    "from hubsbot.consumer import ConsumerFactory as BaseConsumerFactory, TextConsumer as BaseTextConsumer, VoiceConsumer, Message\n",
-    "from hubsbot.consumer.aiortc import RecorderFactory\n",
-    "\n",
-    "import logging\n",
-    "logging.getLogger().setLevel(logging.DEBUG)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "outputs": [],
-   "source": [
-    "class TextConsumer(BaseTextConsumer):\n",
-    "    def __init__(self, peer: Peer):\n",
-    "        self.peer = peer\n",
-    "\n",
-    "    async def on_message(self, msg: Message):\n",
-    "        print(f'Message from {self.peer.id}: {msg}')\n",
-    "\n",
-    "class ConsumerFactory(RecorderFactory):\n",
-    "    def create_text_consumer(self, peer: Peer) -> TextConsumer:\n",
-    "        return TextConsumer(peer)"
-   ],
-   "metadata": {
-    "collapsed": false
-   },
-   "id": "4ca06ddc04e96118"
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "outputs": [],
-   "source": [
-    "\n",
-    "bot = Bot(\n",
-    "    host='9de36d10e9.us2.myhubs.net',\n",
-    "    room_id='NUCedZ2',\n",
-    "    avatar_id=\"basebot\",\n",
-    "    display_name=\"Python User\",\n",
-    "    consumer_factory=ConsumerFactory(Path('/home/andrew/Projects/MEPhI/HubsBot/audio-sample/output')),\n",
-    "    # voice_track=AudioStreamTrack()\n",
-    "    voice_track=MediaPlayer('/home/andrew/Projects/MEPhI/HubsBot/audio-sample/03. The Art Of War.mp3').audio\n",
-    ")"
-   ],
-   "metadata": {
-    "collapsed": false
-   },
-   "id": "3ee170157087975e"
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "outputs": [],
-   "source": [
-    "import asyncio\n",
-    "import nest_asyncio\n",
-    "\n",
-    "nest_asyncio.apply()\n",
-    "asyncio.get_event_loop().run_until_complete(bot.join())"
-   ],
-   "metadata": {
-    "collapsed": false
-   },
-   "id": "f1db38b3356b571d"
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "outputs": [],
-   "source": [
-    "asyncio.get_event_loop().run_until_complete(bot.close())"
-   ],
-   "metadata": {
-    "collapsed": false
-   },
-   "id": "53fa6a2f12621806"
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "outputs": [],
-   "source": [],
-   "metadata": {
-    "collapsed": false
-   },
-   "id": "11080b4b3383d31a"
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "name": "hubsbot",
-   "language": "python",
-   "display_name": "HubsBot"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 2
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython2",
-   "version": "2.7.6"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}

+ 16 - 3
pyproject.toml

@@ -1,16 +1,29 @@
 [project]
 name = "HubsBot"
 description = "Mozilla Hubs client for AI-powered bots creation (support voice chatting)"
-requires-python = "==3.10"
-license = "AGPL-3.0-or-later"
+version = "0.0.0"
+requires-python = ">=3.10,<3.11"
+license = {text="AGPL-3.0"}
 keywords = ["mozilla-hubs"]
 authors = [
     { name = "Andrew Aralov", email = "andrew-aralov@yandex.ru" },
     { name = "Iskander Gafarov" }
 ]
 dependencies = [
+    "Cryptography<=38.0.0",
+    "aioprocessing",
+    "av",
+    "gql",
+    "matplotlib",
+    "numpy",
+    "pydub",
     "pymediasoup",
-    "Cryptography<=38.0.0"
+    "Requests",
+    "transforms3d",
+    "websockets",
+    "requests-toolbelt",
+    "vosk",
+    "openai==0.28.1"
 ]
 
 [options]