Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Dec 10, 2023
1 parent e7a65c8 commit 4f5cfb1
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Docs

on:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: Debug with tmate
required: false
default: false

jobs:
docs:
runs-on: ubuntu-latest

name: Docs

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- name: Create ArangoDB Docker container
run: >
docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static
arangodb/arangodb:latest --server.jwt-secret-keyfile=/tests/static/keyfile
- name: Start ArangoDB Docker container
run: docker start arango

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Debug with tmate
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Run pre-commit checks
uses: pre-commit/action@v3.0.0

- name: Install dependencies
run: pip install .[dev]

- name: Run Sphinx doctest
run: python -m sphinx -b doctest docs docs/_build

- name: Generate Sphinx HTML
run: python -m sphinx -b html -W docs docs/_build
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
63 changes: 63 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 os
import sys

sys.path.insert(0, os.path.abspath('../arango_rdf'))

project = 'ArangoRDF'
copyright = '2023, Anthony Mahanna'
author = 'Anthony Mahanna'
release = '0.1.0'

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

extensions = [
"sphinx_rtd_theme",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.viewcode",
]

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'
html_static_path = ['_static']

autodoc_member_order = "bysource"


doctest_global_setup = """
from arango import ArangoClient
from arango_rdf import ArangoRDF
from rdflib import Graph
# Initialize the ArangoDB client db.
db = ArangoClient().db('_system', username='root', password='passwd')
# Initialize the ArangoRDF client.
arangordf = ArangoRDF(db)
# Create a new RDF graph.
rdf_graph = Graph()
rdf_graph.parse("https://raw.githubusercontent.com/stardog-union/stardog-tutorials/master/music/beatles.ttl")
# RDF to ArangoDB
adb_graph_rpt = adbrdf.rdf_to_arangodb_by_rpt("BeatlesRPT", rdf_graph, overwrite_graph=True)
adb_graph_pgt = adbrdf.rdf_to_arangodb_by_pgt("BeatlesPGT", rdf_graph, overwrite_graph=True)
# ArangoDB to RDF
rdf_graph_2, adb_mapping = adbrdf.arangodb_graph_to_rdf("Beatles", Graph())
"""
20 changes: 20 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. ArangoRDF documentation master file, created by
sphinx-quickstart on Sat Dec 9 18:56:57 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to ArangoRDF's documentation!
=====================================

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



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions 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
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Documentation :: Sphinx",
"Topic :: Utilities",
"Typing :: Typed",
]
Expand All @@ -50,6 +51,8 @@ dev = [
"pytest-cov>=2.0.0",
"coveralls>=3.3.1",
"types-setuptools",
"sphinx",
"sphinx_rtd_theme",
]

[project.urls]
Expand Down

0 comments on commit 4f5cfb1

Please sign in to comment.