Skip to content

Commit

Permalink
docs: use myst-parser and shibuya theme (0b01001001#332)
Browse files Browse the repository at this point in the history
* docs: use myst-parser and shibuya theme

Signed-off-by: Keming <kemingy94@gmail.com>

* fix lint

Signed-off-by: Keming <kemingy94@gmail.com>

---------

Signed-off-by: Keming <kemingy94@gmail.com>
  • Loading branch information
kemingy authored Aug 1, 2023
1 parent 666fb68 commit 2c437e2
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythondoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install Sphinx furo
pip install .[docs]
make install
- name: Generate docs
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest syrupy
pip install .[dev]
- name: Test
run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ doc:
cd docs && make html

opendoc:
cd docs/build/html && python -m http.server 8765
cd docs/build/html && python -m http.server 8765 -b 127.0.0.1

clean:
rm -rf build/ dist/ *.egg-info .pytest_cache
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Install with pip: `pip install spectree`. If you'd like for email fields to be v

### Examples

Check the [examples](/examples) folder.
Check the [examples](examples) folder.

* [flask example](/examples/flask_demo.py)
* [falcon example with logging when validation failed](/examples/falcon_demo.py)
* [flask example](examples/flask_demo.py)
* [falcon example with logging when validation failed](examples/falcon_demo.py)
* [starlette example](examples/starlette_demo.py)

### Step by Step
Expand Down
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


# -- General configuration ---------------------------------------------------
autodoc_class_signature = "separated"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -32,6 +33,7 @@
"sphinx.ext.viewcode",
"sphinx.ext.autodoc",
"sphinx.ext.githubpages",
"myst_parser",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -41,14 +43,16 @@
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
source_suffix = [".rst", ".md"]
language = "en"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"
html_theme = "shibuya"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
35 changes: 35 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
```{eval-rst}
.. meta::
:description lang=en:
SpecTree is an API spec validator and OpenAPI document generator for Python web frameworks.
```

```{include} ../../README.md
```

```{toctree}
---
maxdepth: 2
hidden:
caption: API reference
---
spectree
config
response
models
utils
plugins
```

```{toctree}
---
hidden:
caption: Project Links
---
GitHub <https://github.com/0b01001001/spectree>
```

## Indices and tables

- {ref}`genindex`
113 changes: 0 additions & 113 deletions docs/source/index.rst

This file was deleted.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ starlette = [
]
docs = [
"Sphinx",
"furo",
"shibuya",
"myst-parser",
]

[project.urls]
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
],
"docs": [
"Sphinx",
"furo",
"shibuya",
"myst-parser",
],
},
)
3 changes: 2 additions & 1 deletion spectree/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class SpecTree:
"""
Interface
:param str backend_name: choose from ('flask', 'falcon', 'falcon-asgi', 'starlette')
:param str backend_name: choose from
('flask', 'quart', 'falcon', 'falcon-asgi', 'starlette')
:param backend: a backend that inherit `SpecTree.plugins.base.BasePlugin`, this will
override the `backend_name` if provided
:param app: backend framework application instance (can be registered later)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_list_model():
model = resp.find_model(200)
expect_model = gen_list_model(JSON)
assert get_type_hints(model) == get_type_hints(expect_model)
assert type(model) == type(expect_model)
assert type(model) is type(expect_model)
assert issubclass(model, BaseModel)
data = [
{"name": "a", "limit": 1},
Expand Down

0 comments on commit 2c437e2

Please sign in to comment.