Skip to content

Commit a6bbe59

Browse files
authored
Merge pull request #16 from jedymatt/add-docs
Initialize docs
2 parents 8397cba + 4c8c214 commit a6bbe59

File tree

8 files changed

+226
-0
lines changed

8 files changed

+226
-0
lines changed

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/environment.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: docs
2+
channels:
3+
- defaults
4+
dependencies:
5+
- sphinx==4.2.0
6+
- pip:
7+
- sphinx_rtd_theme

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx-rtd-theme==1.0.0
2+
sphinx==4.2.0

docs/source/api.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. currentmodule:: sqlalchemyseed
2+
3+
API Reference
4+
=============
5+
6+
Seeders
7+
--------------
8+
9+
.. autoclass:: seeder.Seeder
10+
:members:
11+
:undoc-members:
12+
13+
.. autoclass:: seeder.HybridSeeder
14+
:members:
15+
:undoc-members:
16+
17+
Loaders
18+
-------
19+
20+
.. automodule:: loader
21+
:members:
22+
:undoc-members:
23+
24+
Validators
25+
----------
26+
27+
.. autoclass:: validator.SchemaValidator
28+
:members:
29+
30+
.. autofunction:: validator.validate
31+
32+
33+
.. autofunction:: validator.hybrid_validate
34+
35+
36+
Exceptions
37+
----------
38+
39+
.. automodule:: errors
40+
:members:

docs/source/conf.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'sqlalchemyseed'
21+
copyright = '2021, jedymatt'
22+
author = 'jedymatt'
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
extensions = [
31+
'sphinx.ext.autodoc'
32+
]
33+
34+
# Add any paths that contain templates here, relative to this directory.
35+
templates_path = ['_templates']
36+
37+
# List of patterns, relative to source directory, that match files and
38+
# directories to ignore when looking for source files.
39+
# This pattern also affects html_static_path and html_extra_path.
40+
exclude_patterns = []
41+
42+
43+
# -- Options for HTML output -------------------------------------------------
44+
45+
# The theme to use for HTML and HTML Help pages. See the documentation for
46+
# a list of builtin themes.
47+
#
48+
# html_theme = "alabaster"
49+
html_theme = "sphinx_rtd_theme"
50+
51+
# Add any paths that contain custom static files (such as style sheets) here,
52+
# relative to this directory. They are copied after the builtin static files,
53+
# so a file named "default.css" will overwrite the builtin "default.css".
54+
html_static_path = ['_static']

docs/source/index.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. sqlalchemyseed documentation master file, created by
2+
sphinx-quickstart on Sat Sep 25 14:41:54 2021.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to sqlalchemyseed's documentation!
7+
==========================================
8+
9+
sqlalchemyseed is a SQLAlchemy seeder that supports nested relationships
10+
with an easy to read text files.
11+
12+
Contents
13+
========
14+
15+
.. toctree::
16+
:maxdepth: 2
17+
18+
intro
19+
api
20+
21+
Indices and tables
22+
==================
23+
24+
* :ref:`genindex`
25+
* :ref:`modindex`
26+
* :ref:`search`

docs/source/intro.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Introduction
2+
============
3+
4+
sqlalchemyseed is a SQLAlchemy seeder that supports nested relationships
5+
with an easy to read text files.
6+
7+
Supported file types.
8+
9+
- json
10+
- yaml
11+
- csv
12+
13+
Example of json file
14+
15+
.. code-block :: json
16+
17+
{
18+
"model": "models.Person",
19+
"data": [
20+
{
21+
"name": "John March",
22+
"age": 23
23+
},
24+
{
25+
"name": "Juan Dela Cruz",
26+
"age": 21
27+
}
28+
]
29+
}
30+
31+
32+
Installation
33+
------------
34+
35+
Default installation ::
36+
37+
pip install sqlalchemyseed
38+
39+
When using yaml to load entities from yaml files,
40+
execute this command to install necessary dependencies ::
41+
42+
pip install sqlalchemyseed[yaml]

0 commit comments

Comments
 (0)