Skip to content

Commit

Permalink
first pass implementing twitter langchain docs generation and publica…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
stat committed Nov 19, 2024
1 parent 5d83836 commit 677e4fa
Show file tree
Hide file tree
Showing 12 changed files with 764 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true

# cdp-agentkit-core
- name: Load cached venv for cdp-agentkit-core
id: cached-poetry-dependencies-core
uses: actions/cache@v3
Expand All @@ -45,6 +46,7 @@ jobs:
mkdir -p docs/cdp-agentkit-core
cp -r cdp-agentkit-core/docs/_build/html/* docs/cdp-agentkit-core
# cdp-langchain
- name: Load cached venv for cdp-langchain
id: cached-poetry-dependencies-langchain
uses: actions/cache@v3
Expand All @@ -69,6 +71,32 @@ jobs:
mkdir -p docs/cdp-langchain
cp -r cdp-langchain/docs/_build/html/* docs/cdp-langchain
# twitter-langchain
- name: Load cached venv for twitter-langchain
id: cached-poetry-dependencies-twitter-langchain
uses: actions/cache@v3
with:
path: ./twitter-langchain/.venv
key: venv-twitter-langchain-${{ runner.os }}-3.10-${{ hashFiles('twitter-langchain/poetry.lock') }}

- name: Install dependencies for twitter-langchain
if: steps.cached-poetry-dependencies-twitter-langchain.outputs.cache-hit != 'true'
run: |
cd twitter-langchain
poetry install --with dev
cd ..
- name: Build Sphinx Documentation for twitter-langchain
run: |
cd twitter-langchain
poetry run make docs
cd docs
poetry run make html
cd ../..
mkdir -p docs/twitter-langchain
cp -r twitter-langchain/docs/_build/html/* docs/twitter-langchain
# deploy
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
Expand Down
19 changes: 19 additions & 0 deletions twitter-langchain/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
.PHONY: help
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
.PHONY: Makefile
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 1 addition & 0 deletions twitter-langchain/docs/README.md
34 changes: 34 additions & 0 deletions twitter-langchain/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import sys
import os

sys.path.insert(0, os.path.abspath(".."))

project = 'CDP Agentkit - Twitter LangChain'
author = 'Coinbase Developer Platform'
release = '0.0.5'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser', # Parsing Markdown
'sphinx.ext.autodoc', # Automatically generate documentation from docstrings
'sphinx.ext.napoleon', # Google-style docstring support
'sphinx_autodoc_typehints' # Type hints in function signatures
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
12 changes: 12 additions & 0 deletions twitter-langchain/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CDP Agentkit - Twitter LangChain Documentation
==============================================

.. include:: README.md
:parser: myst_parser.sphinx_

.. toctree::
:maxdepth: 2
:caption: Contents:
:hidden:

modules
35 changes: 35 additions & 0 deletions twitter-langchain/docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
7 changes: 7 additions & 0 deletions twitter-langchain/docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
twitter_langchain
=================

.. toctree::
:maxdepth: 4

twitter_langchain
37 changes: 37 additions & 0 deletions twitter-langchain/docs/twitter_langchain.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
twitter\_langchain package
==========================

Submodules
----------

twitter\_langchain.twitter\_api\_wrapper module
-----------------------------------------------

.. automodule:: twitter_langchain.twitter_api_wrapper
:members:
:undoc-members:
:show-inheritance:

twitter\_langchain.twitter\_tool module
---------------------------------------

.. automodule:: twitter_langchain.twitter_tool
:members:
:undoc-members:
:show-inheritance:

twitter\_langchain.twitter\_toolkit module
------------------------------------------

.. automodule:: twitter_langchain.twitter_toolkit
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: twitter_langchain
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 677e4fa

Please sign in to comment.