Skip to content

Commit 32d733d

Browse files
authored
Basic dialect docs (#92)
1 parent 62af230 commit 32d733d

File tree

13 files changed

+1662
-0
lines changed

13 files changed

+1662
-0
lines changed

.github/workflows/docs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Deploy Sphinx documentation to Github Pages
2+
3+
on:
4+
push:
5+
branches: [main, basic_dialect_docs] # branch to trigger deployment
6+
7+
jobs:
8+
pages:
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: github-pages
12+
url: ${{ steps.deployment.outputs.page_url }}
13+
permissions:
14+
pages: write
15+
id-token: write
16+
steps:
17+
- id: deployment
18+
uses: sphinx-notes/pages@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@ dmypy.json
133133

134134
# VSCode
135135
.vscode
136+
137+
docs/.build/
138+
.DS_Store

docs/Makefile

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

docs/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# YDB SQLAlchemy Documentation
2+
3+
This directory contains the documentation for YDB SQLAlchemy dialect.
4+
5+
## Building Documentation
6+
7+
### Prerequisites
8+
9+
1. Install Sphinx and required extensions:
10+
```bash
11+
pip install sphinx sphinx-rtd-theme sphinx-copybutton
12+
```
13+
14+
### Building HTML Documentation
15+
16+
1. Navigate to the docs directory:
17+
```bash
18+
cd docs
19+
```
20+
21+
2. Build the documentation:
22+
```bash
23+
make html
24+
```
25+
26+
3. Open the documentation in your browser:
27+
```bash
28+
open .build/html/index.html
29+
```
30+
31+
### Building Other Formats
32+
33+
- **PDF**: `make latexpdf` (requires LaTeX)
34+
- **EPUB**: `make epub`
35+
- **Man pages**: `make man`
36+
37+
### Development
38+
39+
When adding new documentation:
40+
41+
1. Create `.rst` files in the appropriate directory
42+
2. Add them to the `toctree` in `index.rst`
43+
3. Rebuild with `make html`
44+
4. Check for warnings and fix them
45+
46+
### Structure
47+
48+
- `index.rst` - Main documentation page
49+
- `installation.rst` - Installation guide
50+
- `quickstart.rst` - Quick start guide
51+
- `connection.rst` - Connection configuration
52+
- `types.rst` - Data types documentation
53+
- `migrations.rst` - Alembic migrations guide
54+
- `api/` - API reference documentation
55+
- `conf.py` - Sphinx configuration
56+
- `_static/` - Static files (images, CSS, etc.)
57+
58+
### Configuration
59+
60+
The documentation is configured in `conf.py`. Key settings:
61+
62+
- **Theme**: `sphinx_rtd_theme` (Read the Docs theme)
63+
- **Extensions**: autodoc, napoleon, intersphinx, copybutton
64+
- **Intersphinx**: Links to Python, SQLAlchemy, and Alembic docs
65+
66+
### Troubleshooting
67+
68+
**Sphinx not found**: Make sure Sphinx is installed in your virtual environment
69+
70+
**Import errors**: Ensure the YDB SQLAlchemy package is installed in the same environment
71+
72+
**Theme issues**: Install `sphinx-rtd-theme` if you get theme-related errors

docs/_static/logo.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/api/index.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
API Reference
2+
=============
3+
4+
This section contains the complete API reference for YDB SQLAlchemy.
5+
6+
Core Module
7+
-----------
8+
9+
.. automodule:: ydb_sqlalchemy.sqlalchemy
10+
:members:
11+
:undoc-members:
12+
:show-inheritance:
13+
14+
Types Module
15+
------------
16+
17+
.. automodule:: ydb_sqlalchemy.sqlalchemy.types
18+
:members:
19+
:undoc-members:
20+
:show-inheritance:
21+
22+
DateTime Types
23+
--------------
24+
25+
.. automodule:: ydb_sqlalchemy.sqlalchemy.datetime_types
26+
:members:
27+
:undoc-members:
28+
:show-inheritance:
29+
30+
JSON Types
31+
----------
32+
33+
.. automodule:: ydb_sqlalchemy.sqlalchemy.json
34+
:members:
35+
:undoc-members:
36+
:show-inheritance:
37+
38+
Compiler Module
39+
---------------
40+
41+
.. automodule:: ydb_sqlalchemy.sqlalchemy.compiler
42+
:members:
43+
:undoc-members:
44+
:show-inheritance:
45+
46+
DML Operations
47+
--------------
48+
49+
.. automodule:: ydb_sqlalchemy.sqlalchemy.dml
50+
:members:
51+
:undoc-members:
52+
:show-inheritance:

docs/conf.py

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
import os
16+
import sys
17+
sys.path.insert(0, os.path.abspath('..'))
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = 'YDB SQLAlchemy'
23+
copyright = '2025, Yandex'
24+
author = 'Yandex'
25+
26+
# The short X.Y version
27+
version = '0.1'
28+
# The full version, including alpha/beta/rc tags
29+
release = '0.1.9'
30+
31+
32+
# -- General configuration ---------------------------------------------------
33+
34+
# If your documentation needs a minimal Sphinx version, state it here.
35+
#
36+
# needs_sphinx = '1.0'
37+
38+
# Add any Sphinx extension module names here, as strings. They can be
39+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40+
# ones.
41+
extensions = [
42+
'sphinx.ext.autodoc',
43+
'sphinx.ext.viewcode',
44+
'sphinx.ext.todo',
45+
'sphinx.ext.napoleon',
46+
'sphinx.ext.coverage',
47+
'sphinx.ext.intersphinx',
48+
'sphinx.ext.githubpages',
49+
'sphinx_copybutton',
50+
]
51+
52+
# Add any paths that contain templates here, relative to this directory.
53+
templates_path = ['.templates']
54+
55+
# The suffix(es) of source filenames.
56+
# You can specify multiple suffix as a list of string:
57+
#
58+
# source_suffix = ['.rst', '.md']
59+
source_suffix = '.rst'
60+
61+
# The master toctree document.
62+
master_doc = 'index'
63+
64+
# The language for content autogenerated by Sphinx. Refer to documentation
65+
# for a list of supported languages.
66+
#
67+
# This is also used if you do content translation via gettext catalogs.
68+
# Usually you set "language" from the command line for these cases.
69+
language = None
70+
71+
# List of patterns, relative to source directory, that match files and
72+
# directories to ignore when looking for source files.
73+
# This pattern also affects html_static_path and html_extra_path.
74+
exclude_patterns = ['.build', 'Thumbs.db', '.DS_Store']
75+
76+
# The name of the Pygments (syntax highlighting) style to use.
77+
pygments_style = None
78+
79+
80+
# -- Options for HTML output -------------------------------------------------
81+
82+
# The theme to use for HTML and HTML Help pages. See the documentation for
83+
# a list of builtin themes.
84+
#
85+
html_theme = 'sphinx_rtd_theme'
86+
87+
html_theme_options = {
88+
'fixed_sidebar': True,
89+
'page_width': '1140px',
90+
'show_related': True,
91+
'show_powered_by': False
92+
}
93+
94+
html_logo = '_static/logo.svg'
95+
html_favicon = '_static/logo.svg'
96+
97+
html_show_sourcelink = False
98+
99+
# Theme options are theme-specific and customize the look and feel of a theme
100+
# further. For a list of options available for each theme, see the
101+
# documentation.
102+
#
103+
# html_theme_options = {}
104+
105+
# Add any paths that contain custom static files (such as style sheets) here,
106+
# relative to this directory. They are copied after the builtin static files,
107+
# so a file named "default.css" will overwrite the builtin "default.css".
108+
html_static_path = ['_static']
109+
110+
# Custom sidebar templates, must be a dictionary that maps document names
111+
# to template names.
112+
#
113+
# The default sidebars (for documents that don't match any pattern) are
114+
# defined by theme itself. Builtin themes are using these templates by
115+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
116+
# 'searchbox.html']``.
117+
#
118+
# html_sidebars = {}
119+
120+
121+
# -- Options for HTMLHelp output ---------------------------------------------
122+
123+
# Output file base name for HTML help builder.
124+
htmlhelp_basename = 'ydb-sqlalchemy-doc'
125+
126+
127+
# -- Options for LaTeX output ------------------------------------------------
128+
129+
latex_elements = {
130+
# The paper size ('letterpaper' or 'a4paper').
131+
#
132+
# 'papersize': 'letterpaper',
133+
134+
# The font size ('10pt', '11pt' or '12pt').
135+
#
136+
# 'pointsize': '10pt',
137+
138+
# Additional stuff for the LaTeX preamble.
139+
#
140+
# 'preamble': '',
141+
142+
# Latex figure (float) alignment
143+
#
144+
# 'figure_align': 'htbp',
145+
}
146+
147+
# Grouping the document tree into LaTeX files. List of tuples
148+
# (source start file, target name, title,
149+
# author, documentclass [howto, manual, or own class]).
150+
latex_documents = [
151+
(master_doc, 'ydb-sqlalchemy.tex', 'YDB SQLAlchemy Documentation',
152+
'Yandex', 'manual'),
153+
]
154+
155+
156+
# -- Options for manual page output ------------------------------------------
157+
158+
# One entry per manual page. List of tuples
159+
# (source start file, name, description, authors, manual section).
160+
man_pages = [
161+
(master_doc, 'ydb-sqlalchemy', 'YDB SQLAlchemy Documentation',
162+
[author], 1)
163+
]
164+
165+
166+
# -- Options for Texinfo output ----------------------------------------------
167+
168+
# Grouping the document tree into Texinfo files. List of tuples
169+
# (source start file, target name, title, author,
170+
# dir menu entry, description, category)
171+
texinfo_documents = [
172+
(master_doc, 'ydb-sqlalchemy', 'YDB SQLAlchemy Documentation',
173+
author, 'ydb-sqlalchemy', 'SQLAlchemy dialect for YDB (Yandex Database).',
174+
'Miscellaneous'),
175+
]
176+
177+
178+
# -- Options for Epub output -------------------------------------------------
179+
180+
# Bibliographic Dublin Core info.
181+
epub_title = project
182+
183+
# The unique identifier of the text. This can be a ISBN number
184+
# or the project homepage.
185+
#
186+
# epub_identifier = ''
187+
188+
# A unique identification for the text.
189+
#
190+
# epub_uid = ''
191+
192+
# A list of files that should not be packed into the epub file.
193+
epub_exclude_files = ['search.html']
194+
195+
196+
# -- Extension configuration -------------------------------------------------
197+
198+
autoclass_content = "both"
199+
autodoc_typehints = "both"
200+
autodoc_default_options = {
201+
'undoc-members': True,
202+
'member-order': 'bysource'
203+
}
204+
205+
# -- Intersphinx configuration -----------------------------------------------
206+
207+
intersphinx_mapping = {
208+
'python': ('https://docs.python.org/3', None),
209+
'sqlalchemy': ('https://docs.sqlalchemy.org/en/20/', None),
210+
'alembic': ('https://alembic.sqlalchemy.org/en/latest/', None),
211+
}
212+
213+
# -- Copy button configuration --------------------------------------------
214+
215+
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
216+
copybutton_prompt_is_regexp = True

0 commit comments

Comments
 (0)