|
1 | | -sphinxcontrib-httpexample |
2 | | -========================= |
| 1 | +# sphinxcontrib-httpexample |
3 | 2 |
|
4 | | -.. image:: https://github.com/collective/sphinxcontrib-httpexample/actions/workflows/build.yml/badge.svg?branch=master |
5 | | - :target: https://github.com/collective/sphinxcontrib-httpexample/actions |
| 3 | +<img alt="GitHub Actions" src="https://github.com/collective/sphinxcontrib-httpexample/actions/workflows/build.yml/badge.svg?branch=master" href="https://github.com/collective/sphinxcontrib-httpexample/actions"> |
| 4 | +<img alt="Coverage" src="https://coveralls.io/repos/github/collective/sphinxcontrib-httpexample/badge.svg?branch=master" href="https://coveralls.io/github/collective/sphinxcontrib-httpexample?branch=master"> |
| 5 | +<img alt="PyPI package" src="https://badge.fury.io/py/sphinxcontrib-httpexample.svg" href="https://badge.fury.io/py/sphinxcontrib-httpexample"> |
| 6 | +<img alt="Documentation" src="https://readthedocs.org/projects/sphinxcontrib-httpexample/badge/?version=latest" href="http://sphinxcontrib-httpexample.readthedocs.io/en/latest"> |
6 | 7 |
|
7 | | -.. image:: https://coveralls.io/repos/github/collective/sphinxcontrib-httpexample/badge.svg?branch=master |
8 | | - :target: https://coveralls.io/github/collective/sphinxcontrib-httpexample?branch=master |
| 8 | +sphinxcontrib-httpexample enhances [`sphinxcontrib-httpdomain`](https://pythonhosted.org/sphinxcontrib-httpdomain/), a Sphinx domain extension for describing RESTful HTTP APIs in detail, with a simple call example directive. The new directive provided by this extension generates RESTful HTTP API call examples for different tools from a single HTTP request example. |
9 | 9 |
|
10 | | -.. image:: https://badge.fury.io/py/sphinxcontrib-httpexample.svg |
11 | | - :target: https://badge.fury.io/py/sphinxcontrib-httpexample |
| 10 | +The audience for this extension are developers and technical writes documenting their RESTful HTTP APIs. This extension has originally been developed for documenting [`plone.restapi`](https://6.docs.plone.org/plone.restapi/docs/source/index.html). |
12 | 11 |
|
13 | | -.. image:: https://readthedocs.org/projects/sphinxcontrib-httpexample/badge/?version=latest |
14 | | - :target: http://sphinxcontrib-httpexample.readthedocs.io/en/latest |
15 | 12 |
|
16 | | -sphinxcontrib-httpexample enhances `sphinxcontrib-httpdomain`_, a Sphinx domain extension for describing RESTful HTTP APIs in detail, with a simple call example directive. The new directive provided by this extension generates RESTful HTTP API call examples for different tools from a single HTTP request example. |
| 13 | +## Features |
17 | 14 |
|
18 | | -The audience for this extension are developers and technical writes documenting their RESTful HTTP APIs. This extension has originally been developed for documenting `plone.restapi`_. |
| 15 | +- Directive for generating various RESTful HTTP API call examples from single HTTP request. |
| 16 | +- Supported tools: |
19 | 17 |
|
20 | | -.. _sphinxcontrib-httpdomain: https://pythonhosted.org/sphinxcontrib-httpdomain/ |
21 | | -.. _plone.restapi: http://plonerestapi.readthedocs.org/ |
| 18 | + - [curl](https://curl.haxx.se/) |
| 19 | + - [wget](https://www.gnu.org/software/wget/) |
| 20 | + - [httpie](https://httpie.org/) |
| 21 | + - [python-requests](http://docs.python-requests.org/) |
22 | 22 |
|
23 | 23 |
|
24 | | -Features |
25 | | --------- |
| 24 | +## Examples |
26 | 25 |
|
27 | | -* Directive for generating various RESTful HTTP API call examples from single HTTP request. |
| 26 | +This extension has been used at least in the following documentations: |
28 | 27 |
|
29 | | -* Supported tools: |
| 28 | +- https://6.docs.plone.org/plone.restapi/docs/source/index.html |
| 29 | +- https://sphinxcontrib-httpexample.readthedocs.org/en/latest/ |
| 30 | +- https://guillotina.readthedocs.io/en/latest/ |
30 | 31 |
|
31 | | - - curl_ |
32 | | - - wget_ |
33 | | - - httpie_ |
34 | | - - python-requests_ |
35 | 32 |
|
36 | | -.. _curl: https://curl.haxx.se/ |
37 | | -.. _wget: https://www.gnu.org/software/wget/ |
38 | | -.. _httpie: https://httpie.org/ |
39 | | -.. _python-requests: http://docs.python-requests.org/ |
| 33 | +## Documentation |
40 | 34 |
|
| 35 | +Full documentation for end users can be found in the "docs" folder. It is also available online at http://sphinxcontrib-httpexample.readthedocs.org/ |
41 | 36 |
|
42 | | -Examples |
43 | | --------- |
44 | 37 |
|
45 | | -This extension has been used at least in the following documentations: |
| 38 | +## Installation |
46 | 39 |
|
47 | | -* http://plonerestapi.readthedocs.org/ |
48 | | -* http://sphinxcontrib-httpexample.readthedocs.org/ |
49 | | -* https://guillotina.readthedocs.io/en/latest/ |
| 40 | +Add `sphinxcontrib-httpexample` and `sphincontrib-httpdomain` into your project requirements. |
50 | 41 |
|
| 42 | +Then configure your Sphinx configuration file `conf.py` with `sphinxcontrib.httpdomain` and `sphinxcontrib.httpexample` as follows. |
51 | 43 |
|
52 | | -Documentation |
53 | | -------------- |
| 44 | +```python |
| 45 | +extensions = [ |
| 46 | + "sphinxcontrib.httpdomain", |
| 47 | + "sphinxcontrib.httpexample", |
| 48 | +] |
| 49 | +``` |
54 | 50 |
|
55 | | -Full documentation for end users can be found in the "docs" folder. It is also available online at http://sphinxcontrib-httpexample.readthedocs.org/ |
56 | 51 |
|
| 52 | +## Contribute |
57 | 53 |
|
58 | | -Installation |
59 | | ------------- |
| 54 | +To contribute to `sphinxcontrib-httpexample`, first set up your environment. |
60 | 55 |
|
61 | | -Add sphinxcontrib-httpexample into requirements of your product documentation and into the configuration file of your Sphinx documentation next to sphincontrib-httpdomain as follows: |
62 | 56 |
|
63 | | -.. code:: python |
| 57 | +### Set up development environment |
64 | 58 |
|
65 | | - extensions = ['sphinxcontrib.httpdomain', 'sphinxcontrib.httpexample'] |
| 59 | +Install [uv](https://6.docs.plone.org/glossary.html#term-uv). |
| 60 | +Carefully read the console output for further instructions, and follow them, if needed. |
66 | 61 |
|
| 62 | +```shell |
| 63 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 64 | +``` |
67 | 65 |
|
68 | | -## Contribute |
| 66 | +Initialize a Python virtual environment. |
69 | 67 |
|
70 | 68 | ```shell |
71 | 69 | uv venv |
| 70 | +``` |
| 71 | + |
| 72 | +Install `sphinxcontrib-httpexample`. |
| 73 | + |
| 74 | +```shell |
72 | 75 | uv sync |
73 | | -make watch |
74 | 76 | ``` |
75 | 77 |
|
76 | | -Yields |
77 | | - |
78 | | -```console |
79 | | -$ make watch |
80 | | -PYTHONPATH=/Users/stevepiercy/projects/sphinxcontrib-httpexample/docs sphinx-autobuild -b html docs docs/html |
81 | | -[sphinx-autobuild] > sphinx-build -b html /Users/stevepiercy/projects/sphinxcontrib-httpexample/docs /Users/stevepiercy/projects/sphinxcontrib-httpexample/docs/html |
82 | | -Running Sphinx v4.5.0 |
83 | | - |
84 | | -Configuration error: |
85 | | -There is a programmable error in your configuration file: |
86 | | - |
87 | | -Traceback (most recent call last): |
88 | | - File "/Users/stevepiercy/.pyenv/versions/3.10.13/lib/python3.10/site-packages/sphinx/config.py", line 332, in eval_config_file |
89 | | - exec(code, namespace) |
90 | | - File "/Users/stevepiercy/projects/sphinxcontrib-httpexample/docs/conf.py", line 86, in <module> |
91 | | - dist = metadata.distribution("sphinxcontrib-httpexample") |
92 | | - File "/Users/stevepiercy/.pyenv/versions/3.10.13/lib/python3.10/importlib/metadata/__init__.py", line 969, in distribution |
93 | | - return Distribution.from_name(distribution_name) |
94 | | - File "/Users/stevepiercy/.pyenv/versions/3.10.13/lib/python3.10/importlib/metadata/__init__.py", line 548, in from_name |
95 | | - raise PackageNotFoundError(name) |
96 | | -importlib.metadata.PackageNotFoundError: No package metadata was found for sphinxcontrib-httpexample |
97 | | - |
98 | | -Command exited with exit code: 2 |
99 | | -The server will continue serving the build folder, but the contents being served are no longer in sync with the documentation sources. Please fix the cause of the error above or press Ctrl+C to stop the server. |
100 | | -[I 251202 22:42:04 server:335] Serving on http://127.0.0.1:8000 |
101 | | -[I 251202 22:42:04 handlers:62] Start watching changes |
| 78 | +### Build documentation |
| 79 | + |
| 80 | +Rebuild Sphinx documentation on changes, with live-reload in the browser |
| 81 | + |
| 82 | +```shell |
| 83 | +make livehtml |
102 | 84 | ``` |
103 | 85 |
|
| 86 | +To stop the preview, type `CTRL-C`. |
| 87 | + |
| 88 | + |
| 89 | +### Run tests |
| 90 | + |
| 91 | +make te |
104 | 92 |
|
105 | | -License |
106 | | -------- |
| 93 | +## License |
107 | 94 |
|
108 | 95 | The project is licensed under the GPLv2. |
0 commit comments