Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cdf7980
Template for sphinx documentation
myyong Jan 13, 2023
78210a5
Auto generate document for aa one function
myyong Jan 13, 2023
d83f7a7
Add path to code
myyong Jan 16, 2023
139c775
Edit toctree
myyong Jan 16, 2023
8fe7c92
Editing module path for toctree
myyong Jan 16, 2023
5cd2de0
First pass autosummary
myyong Jan 24, 2023
9d113e1
RTD theme, removed autodoc
myyong Jan 24, 2023
28ea3da
Auto generated rtd files
myyong Jan 24, 2023
1f9f193
Add path for readthedocs
myyong Jan 24, 2023
9c80dba
Add requirements.txt
myyong Jan 24, 2023
cc5de6f
List directory structure
myyong Jan 25, 2023
13644e2
Add yaml file, relocate requirements
myyong Jan 25, 2023
d6d0996
Add yaml file, update requirements
myyong Jan 25, 2023
e6e55a9
Modify requirements
myyong Jan 25, 2023
d4f14c5
Fix conf.py location
myyong Jan 25, 2023
a7885f0
Fix Python version
myyong Jan 25, 2023
93261d2
Merge branch 'main' into my/document
myyong Jan 25, 2023
3532e7f
Removed placeholder docs
myyong Jan 25, 2023
5bde836
Enable napoleon extension
myyong Jan 25, 2023
e287c27
Docstrings for Settings module
myyong Jan 27, 2023
2659373
Organise db test env vars
Iain-S Feb 16, 2023
ba5936e
Template for sphinx documentation
myyong Jan 13, 2023
c9b7c26
Auto generate document for aa one function
myyong Jan 13, 2023
1b1f9b0
Add path to code
myyong Jan 16, 2023
323f840
Edit toctree
myyong Jan 16, 2023
7127093
Editing module path for toctree
myyong Jan 16, 2023
2e0fc03
First pass autosummary
myyong Jan 24, 2023
d07a5eb
RTD theme, removed autodoc
myyong Jan 24, 2023
49fdc50
Auto generated rtd files
myyong Jan 24, 2023
55d0adf
Add path for readthedocs
Iain-S Feb 16, 2023
c140868
Add requirements.txt
myyong Jan 24, 2023
d69b6e9
List directory structure
myyong Jan 25, 2023
23b4959
Add yaml file, relocate requirements
myyong Jan 25, 2023
b86f919
Add yaml file, update requirements
myyong Jan 25, 2023
38cf617
Modify requirements
myyong Jan 25, 2023
5a84393
Fix conf.py location
myyong Jan 25, 2023
f9926fb
Fix Python version
myyong Jan 25, 2023
a53e92f
Removed placeholder docs
myyong Jan 25, 2023
b119139
Enable napoleon extension
myyong Jan 25, 2023
e605e39
Add pydocstyle pre-commit hook
Iain-S Feb 6, 2023
aee5aa6
Fix pydocstyle issues
Iain-S Feb 6, 2023
aae0ecf
Merge pull request #39 from alan-turing-institute/iain-s/document
myyong Feb 22, 2023
099ae18
Merge branch 'my/document' of https://github.com/alan-turing-institut…
myyong Feb 22, 2023
19be1b1
Added docstrings and removed blank lines.
myyong Feb 22, 2023
40ef43c
Removed args and returns where None.
myyong Feb 22, 2023
771c413
Include mimesis to enable BaseProvider class import
myyong Feb 22, 2023
157f521
Merge branch 'main' into my/document
Iain-S Feb 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,7 @@ dmypy.json

.fake
sqlsynthgen/config.ini

# sphinx
docs/build/*
docs/temp/*
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ repos:
entry: poetry run pylint
language: system
types: ['python']
- id: pydocstyle
name: pydocstyle
entry: poetry run pydocstyle
language: system
types: ['python']
exclude: (?x)(
tests/|
docs/
)
- id: mypy
name: mypy
entry: poetry run mypy --follow-imports=silent
Expand Down
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -559,5 +559,5 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
29 changes: 29 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
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 = source
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)
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=source
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
53 changes: 53 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
alabaster==0.7.13 ; python_version >= "3.9" and python_version < "4.0"
babel==2.11.0 ; python_version >= "3.9" and python_version < "4.0"
certifi==2022.12.7 ; python_version >= "3.9" and python_version < "4"
cfgv==3.3.1 ; python_version >= "3.9" and python_version < "4.0"
charset-normalizer==3.0.1 ; python_version >= "3.9" and python_version < "4"
click==8.1.3 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows" or python_version >= "3.9" and python_version < "4.0" and sys_platform == "win32"
distlib==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
docutils==0.17.1 ; python_version >= "3.9" and python_version < "4.0"
filelock==3.9.0 ; python_version >= "3.9" and python_version < "4.0"
greenlet==2.0.1 ; python_version >= "3.9" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version < "4.0"
identify==2.5.15 ; python_version >= "3.9" and python_version < "4.0"
idna==3.4 ; python_version >= "3.9" and python_version < "4"
imagesize==1.4.1 ; python_version >= "3.9" and python_version < "4.0"
importlib-metadata==6.0.0 ; python_version >= "3.9" and python_version < "3.10"
inflect==6.0.2 ; python_version >= "3.9" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
markupsafe==2.1.2 ; python_version >= "3.9" and python_version < "4.0"
mimesis==6.1.1 ; python_version >= "3.9" and python_version < "4.0"
nodeenv==1.7.0 ; python_version >= "3.9" and python_version < "4.0"
packaging==23.0 ; python_version >= "3.9" and python_version < "4.0"
platformdirs==2.6.0 ; python_version >= "3.9" and python_version < "4.0"
pockets==0.9.1 ; python_version >= "3.9" and python_version < "4.0"
pre-commit==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
psycopg2-binary==2.9.5 ; python_version >= "3.9" and python_version < "4.0"
pydantic==1.10.2 ; python_version >= "3.9" and python_version < "4.0"
pydantic[dotenv]==1.10.2 ; python_version >= "3.9" and python_version < "4.0"
pygments==2.14.0 ; python_version >= "3.9" and python_version < "4.0"
python-docs-theme==2022.1 ; python_version >= "3.9" and python_version < "4.0"
python-dotenv==0.21.0 ; python_version >= "3.9" and python_version < "4.0"
pytz==2022.7.1 ; python_version >= "3.9" and python_version < "4.0"
pyyaml==6.0 ; python_version >= "3.9" and python_version < "4.0"
requests==2.28.2 ; python_version >= "3.9" and python_version < "4"
setuptools==66.1.1 ; python_version >= "3.9" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.9" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
sphinx-rtd-theme==1.1.1 ; python_version >= "3.9" and python_version < "4.0"
sphinx==5.3.0 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-htmlhelp==2.0.0 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-napoleon==0.7 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.9" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.9" and python_version < "4.0"
sqlacodegen @ git+https://github.com/agronholm/sqlacodegen.git@3.0.0rc1 ; python_version >= "3.9" and python_version < "4.0"
sqlalchemy-utils==0.38.3 ; python_version >= "3.9" and python_version < "4.0"
sqlalchemy==1.4.44 ; python_version >= "3.9" and python_version < "4.0"
typer==0.7.0 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.4.0 ; python_version >= "3.9" and python_version < "4.0"
urllib3==1.26.14 ; python_version >= "3.9" and python_version < "4"
virtualenv==20.17.1 ; python_version >= "3.9" and python_version < "4.0"
zipp==3.11.0 ; python_version >= "3.9" and python_version < "3.10"
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Changelog
=========

**2023-01-30**

- [Feature]: Detect tables, create Python classes
- [Feature]: Populate classes with random values.
- [Feature]: Create new tables, load values.
43 changes: 43 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Sphinx configuration"""
# 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 pathlib
import sys

sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix())
sys.path.insert(0, os.path.abspath("../.."))

project = "sqlsynthgen" # pylint: disable=C0103
copyright = "2023, anon" # pylint: disable=C0103,W0622
author = "anon" # pylint: disable=C0103
release = "0.0" # pylint: disable=C0103

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

extensions: list[str] = [
"sphinx.ext.duration",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx_rtd_theme",
"sphinxcontrib.napoleon",
]

autodoc_mock_imports: list[str] = ["typer", "pydantic", "sqlalchemy"]

templates_path: list[str] = ["_templates"]
exclude_patterns: list[str] = []

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

html_theme = "sphinx_rtd_theme" # pylint: disable=C0103
html_static_path = ["_static"]
31 changes: 31 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. sqlsynthgen documentation master file, created by
sphinx-quickstart on Fri Jan 13 15:18:50 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Draft sqlsynthgen's documentation
=======================================

**sqlsynthgen** is a etc

.. note::

This project will be under active development from Jan - Oct 2023

Contents:
---------

.. toctree::
:maxdepth: 2

changelog
installation
modules


Indices and tables
------------------

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
23 changes: 23 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Installation
============

Get started
------------

To use sqlsynthgen, first install it using poetry:

.. code-block:: console

(<your_poetry_shell>) $ poetry add sqlsynthgen


.. Test print integer function
.. ---------------------------

.. To test print integer function,
.. you can use the ``sqlsynthgen.docs.print_int`` function:

.. .. autofunction:: sqlsynthgen.docs.print_int

.. The ``phone`` argument should be of type integer. Otherwise, :py:func:`sqlsynthgen.docs.print_int`
.. will raise an exception.
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sqlsynthgen
===========

.. toctree::
:maxdepth: 1

sqlsynthgen
44 changes: 44 additions & 0 deletions docs/source/sqlsynthgen.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
sqlsynthgen package
===================

Submodules
----------

sqlsynthgen.create module
-------------------------

.. automodule:: sqlsynthgen.create
:members:
:undoc-members:
:show-inheritance:

sqlsynthgen.main module
-----------------------

.. automodule:: sqlsynthgen.main
:members:
:undoc-members:
:show-inheritance:

sqlsynthgen.make module
-----------------------

.. automodule:: sqlsynthgen.make
:members:
:undoc-members:
:show-inheritance:

sqlsynthgen.providers module
----------------------------

.. automodule:: sqlsynthgen.providers
:members:
:undoc-members:
:show-inheritance:

sqlsynthgen.settings module
---------------------------

.. automodule:: sqlsynthgen.settings
:members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/temp/automatethis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# remember to place requirements in docs/
poetry export --without-hashes --format=requirements.txt > requirements.txt

# this does not clean, use make clean html from docs instead?
sphinx-build -b html docs/source docs/build/html

# sweep up autodocs, check out options
rm docs/source/modules.rst
rm docs/source/sqlsynthgen.rst
sphinx-apidoc -o docs/source sqlsynthgen/
Loading