-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add pre-commit * initial docs pages add uws errorSummary snippet / possibly reformat for autodoc added uws snippets and examples add api docs / quickstart use google docstring style minor fixups add readthedocs yaml * add a line in readme for docs * found a dangling quote * wording * use enum in example * final newlines
- Loading branch information
1 parent
2753176
commit b8b8b10
Showing
23 changed files
with
1,201 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.8 | ||
hooks: | ||
- id: ruff | ||
args: [., --no-cache, --select, I, --fix] | ||
- repo: local | ||
hooks: | ||
- id: pylint | ||
name: pylint | ||
entry: pylint | ||
language: system | ||
types: [python] | ||
stages: [push] | ||
files: ^vo_models/.+\.py$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
|
||
formats: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# 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 | ||
from pathlib import Path | ||
|
||
import toml | ||
|
||
ROOT_PATH = Path(__file__).parent.parent.parent | ||
CONF_PATH = ROOT_PATH / "pyproject.toml" | ||
sys.path.insert(0, str(ROOT_PATH.absolute())) | ||
|
||
PYPROJECT = toml.load(CONF_PATH)["project"] | ||
|
||
project = PYPROJECT["name"] | ||
release = PYPROJECT["version"] | ||
author = f"{PYPROJECT['authors'][0]['name']} <{PYPROJECT['authors'][0]['email']}>" | ||
copyright = "2023, Joshua Fraustro" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
"sphinx_design", | ||
"sphinx_copybutton", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.autosectionlabel", | ||
"sphinx.ext.viewcode", | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.napoleon", | ||
] | ||
|
||
autodoc_default_options = { | ||
"no-inherited-members": None, | ||
"exclude-members": "model_config, model_fields", | ||
} | ||
|
||
autodoc_typehints = "description" | ||
autodoc_typehints_format = "short" | ||
autodoc_member_order = "bysource" | ||
|
||
autoclass_content = "class" | ||
|
||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/3", None), | ||
"lxml": ("https://lxml.de/apidoc/", None), | ||
} | ||
|
||
autosectionlabel_prefix_document = True | ||
|
||
html_theme_options = {} | ||
html_title = PYPROJECT["name"] | ||
|
||
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 = "furo" | ||
html_static_path = ["_static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
vo-models | ||
========= | ||
|
||
``vo-models`` an open-source project to provide Python models for `IVOA <https://www.ivoa.net/>`_ service protocols. | ||
|
||
The project is designed to be used by IVOA members, service implementors, and developers to help facilitate the development of IVOA-compliant services and clients. | ||
|
||
Features | ||
^^^^^^^^ | ||
|
||
- **Pydantic-xml Models:** The project includes Python models for IVOA protocols, using `pydantic-xml <https://github.com/dapper91/pydantic-xml>`_. Based on `Pydantic <https://docs.pydantic.dev/latest/>`_, these models describe transactions for an IVOA protocol, such as UWS, and feature automatic validation, parsing and serialization of XML data for use with Python clients and web frameworks. | ||
|
||
Using the models in your project for validation and serialization to XML is as simple as: | ||
|
||
.. code-block:: python | ||
from vo_models.uws import ShortJobDescription | ||
from vo_models.uws.types import ExecutionPhase | ||
job = ShortJobDescription( | ||
phase=ExecutionPhase.PENDING, # or use "PENDING" | ||
run_id = "run_1", | ||
job_id = "job_1", | ||
creation_time = "2021-01-01T00:00:00Z", | ||
) | ||
job.to_xml() | ||
.. code-block:: xml | ||
<uws:jobref id="job_1" xlink:type="simple"> | ||
<uws:phase>PENDING</uws:phase> | ||
<uws:runId>run_1</uws:runId> | ||
</uws:jobref> | ||
For more information on getting started with ``vo-models``, see :ref:`quickstart`. | ||
|
||
User Guide | ||
^^^^^^^^^^ | ||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
pages/quickstart | ||
pages/installation | ||
|
||
Supported Protocols | ||
^^^^^^^^^^^^^^^^^^^ | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
pages/protocols/index | ||
|
||
API Documentation | ||
^^^^^^^^^^^^^^^^^ | ||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
pages/api/index | ||
|
||
Links | ||
^^^^^ | ||
|
||
- `Source Code <https://github.com/spacetelescope/vo-models>`_ | ||
- `Pydantic-xml <https://pydantic-xml.readthedocs.io/en/latest/>`_ | ||
- `Pydantic <https://docs.pydantic.dev/latest/>`_ | ||
|
||
Indices and tables | ||
^^^^^^^^^^^^^^^^^^ | ||
* :ref:`genindex` | ||
* :ref:`modindex` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.. _api: | ||
|
||
Developer Documentation | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This section contains documentation on the package's modules and classes. | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
uws_api | ||
vosi_api | ||
voresource_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. _uws_api: | ||
|
||
UWS API | ||
------- | ||
|
||
Models | ||
^^^^^^ | ||
|
||
.. automodule:: vo_models.uws.models | ||
:members: | ||
:no-inherited-members: | ||
:exclude-members: model_config, model_fields, Job | ||
|
||
Simple Types | ||
^^^^^^^^^^^^ | ||
.. automodule:: vo_models.uws.types | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. _voresource_api: | ||
|
||
VOResource API | ||
-------------- | ||
|
||
Simple Types | ||
^^^^^^^^^^^^ | ||
.. automodule:: vo_models.voresource.types | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _vosi_api: | ||
|
||
VOSI API | ||
-------- | ||
|
||
Availability | ||
^^^^^^^^^^^^ | ||
|
||
.. automodule:: vo_models.vosi.availability.models | ||
:members: | ||
:no-inherited-members: | ||
:exclude-members: model_config, model_fields, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. _installation: | ||
|
||
Installation | ||
============= | ||
|
||
Install Using pip | ||
------------------ | ||
|
||
To install the ``vo-models`` package, you can use pip: | ||
|
||
.. code-block:: bash | ||
pip install vo-models | ||
Install Using Conda | ||
------------------- | ||
|
||
To install the project using Conda, you can use the provided environment file: | ||
|
||
.. code-block:: bash | ||
git clone https://github.com/spacetelescope/vo-models.git | ||
cd vo-models | ||
conda env create -f environment.yml | ||
conda activate vo-models | ||
pip install -r requirements.txt | ||
pip install . | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _protocols: | ||
|
||
Supported Protocols | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
The following IVOA protocols are currently supported: | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
uws | ||
vosi |
Oops, something went wrong.