sphinxcontrib-httpexample 1.2__tar.gz → 2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. sphinxcontrib_httpexample-2.0/.coveragerc +2 -0
  2. sphinxcontrib_httpexample-2.0/.editorconfig +15 -0
  3. sphinxcontrib_httpexample-2.0/.github/workflows/build.yml +33 -0
  4. sphinxcontrib_httpexample-2.0/.github/workflows/rtd-pr-preview.yml +23 -0
  5. sphinxcontrib_httpexample-2.0/.gitignore +11 -0
  6. sphinxcontrib_httpexample-2.0/.readthedocs.yaml +35 -0
  7. sphinxcontrib_httpexample-2.0/.treefmt.toml +13 -0
  8. sphinxcontrib_httpexample-2.0/CHANGELOG.md +224 -0
  9. sphinxcontrib_httpexample-2.0/Makefile +136 -0
  10. sphinxcontrib_httpexample-2.0/PKG-INFO +142 -0
  11. sphinxcontrib_httpexample-2.0/README.md +106 -0
  12. sphinxcontrib_httpexample-2.0/devenv.lock +172 -0
  13. sphinxcontrib_httpexample-2.0/devenv.nix +68 -0
  14. sphinxcontrib_httpexample-2.0/devenv.uv2nix.nix +90 -0
  15. sphinxcontrib_httpexample-2.0/devenv.yaml +25 -0
  16. {sphinxcontrib-httpexample-1.2/src/sphinxcontrib/httpexample/static → sphinxcontrib_httpexample-2.0/docs/_static}/sphinxcontrib-httpexample.css +6 -3
  17. sphinxcontrib_httpexample-2.0/docs/conf.py +107 -0
  18. sphinxcontrib_httpexample-2.0/docs/custom.rst +116 -0
  19. sphinxcontrib_httpexample-2.0/docs/index.rst +231 -0
  20. sphinxcontrib_httpexample-2.0/docs/plone_client.py +107 -0
  21. sphinxcontrib_httpexample-2.0/docs/requirements.txt +10 -0
  22. sphinxcontrib_httpexample-2.0/docs/usage.rst +762 -0
  23. sphinxcontrib_httpexample-2.0/pyproject.toml +95 -0
  24. sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/__init__.py +40 -0
  25. sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/builders.py +277 -0
  26. sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/directives.py +239 -0
  27. sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/lexers.py +92 -0
  28. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/src/sphinxcontrib/httpexample/parsers.py +19 -23
  29. {sphinxcontrib-httpexample-1.2/docs/_static → sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/static}/sphinxcontrib-httpexample.css +9 -4
  30. sphinxcontrib_httpexample-2.0/src/sphinxcontrib/httpexample/static/sphinxcontrib-httpexample.js +99 -0
  31. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/src/sphinxcontrib/httpexample/utils.py +27 -31
  32. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/__init__.py +0 -1
  33. sphinxcontrib_httpexample-2.0/tests/snapshots/snap_test_builders.py +256 -0
  34. sphinxcontrib_httpexample-2.0/tests/test_builders.py +57 -0
  35. sphinxcontrib_httpexample-2.0/tests/test_directives.py +106 -0
  36. sphinxcontrib_httpexample-2.0/tests/test_fixtures.py +46 -0
  37. sphinxcontrib_httpexample-2.0/tests/test_lexers.py +123 -0
  38. sphinxcontrib_httpexample-2.0/tests/test_parsers.py +130 -0
  39. sphinxcontrib_httpexample-2.0/tests/test_utils.py +78 -0
  40. sphinxcontrib_httpexample-2.0/uv.lock +1843 -0
  41. sphinxcontrib-httpexample-1.2/CHANGELOG.rst +0 -242
  42. sphinxcontrib-httpexample-1.2/MANIFEST.in +0 -8
  43. sphinxcontrib-httpexample-1.2/PKG-INFO +0 -336
  44. sphinxcontrib-httpexample-1.2/README.rst +0 -71
  45. sphinxcontrib-httpexample-1.2/docs/_static/sphinxcontrib-httpexample.js +0 -25
  46. sphinxcontrib-httpexample-1.2/docs/conf.py +0 -305
  47. sphinxcontrib-httpexample-1.2/docs/index.rst +0 -68
  48. sphinxcontrib-httpexample-1.2/docs/requirements.txt +0 -26
  49. sphinxcontrib-httpexample-1.2/docs/usage.rst +0 -344
  50. sphinxcontrib-httpexample-1.2/flake.lock +0 -285
  51. sphinxcontrib-httpexample-1.2/flake.nix +0 -125
  52. sphinxcontrib-httpexample-1.2/requirements.txt +0 -25
  53. sphinxcontrib-httpexample-1.2/setup.cfg +0 -78
  54. sphinxcontrib-httpexample-1.2/setup.nix +0 -282
  55. sphinxcontrib-httpexample-1.2/setup.py +0 -10
  56. sphinxcontrib-httpexample-1.2/src/sphinxcontrib/__init__.py +0 -2
  57. sphinxcontrib-httpexample-1.2/src/sphinxcontrib/httpexample/__init__.py +0 -35
  58. sphinxcontrib-httpexample-1.2/src/sphinxcontrib/httpexample/builders.py +0 -322
  59. sphinxcontrib-httpexample-1.2/src/sphinxcontrib/httpexample/directives.py +0 -196
  60. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/PKG-INFO +0 -336
  61. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/SOURCES.txt +0 -60
  62. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/dependency_links.txt +0 -1
  63. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/namespace_packages.txt +0 -1
  64. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/not-zip-safe +0 -1
  65. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/requires.txt +0 -4
  66. sphinxcontrib-httpexample-1.2/src/sphinxcontrib_httpexample.egg-info/top_level.txt +0 -1
  67. sphinxcontrib-httpexample-1.2/tests/snapshots/snap_test_builders.py +0 -244
  68. sphinxcontrib-httpexample-1.2/tests/test_builders.py +0 -56
  69. sphinxcontrib-httpexample-1.2/tests/test_directives.py +0 -70
  70. sphinxcontrib-httpexample-1.2/tests/test_fixtures.py +0 -42
  71. sphinxcontrib-httpexample-1.2/tests/test_parsers.py +0 -124
  72. sphinxcontrib-httpexample-1.2/tests/test_utils.py +0 -86
  73. sphinxcontrib-httpexample-1.2/tox.ini +0 -10
  74. {sphinxcontrib-httpexample-1.2/src/sphinxcontrib/httpexample/static → sphinxcontrib_httpexample-2.0/docs/_static}/sphinxcontrib-httpexample.js +0 -0
  75. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/001.request.txt +0 -0
  76. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/001.response.txt +0 -0
  77. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/002.request.txt +0 -0
  78. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/002.response.txt +0 -0
  79. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/003.request.txt +0 -0
  80. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/003.response.txt +0 -0
  81. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/004.request.txt +0 -0
  82. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/004.response.txt +0 -0
  83. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/005.request.txt +0 -0
  84. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/005.response.txt +0 -0
  85. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/006.request.txt +0 -0
  86. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/006.response.txt +0 -0
  87. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/007.request.txt +0 -0
  88. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/007.response.txt +0 -0
  89. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/008.request.txt +0 -0
  90. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/009.request.txt +0 -0
  91. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/010.request.txt +0 -0
  92. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/011.request.txt +0 -0
  93. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/012.request.txt +0 -0
  94. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/013.request.txt +0 -0
  95. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/fixtures/014.request.txt +0 -0
  96. {sphinxcontrib-httpexample-1.2 → sphinxcontrib_httpexample-2.0}/tests/snapshots/__init__.py +0 -0
@@ -0,0 +1,2 @@
1
+ [report]
2
+ include = src/*
@@ -0,0 +1,15 @@
1
+ [*]
2
+ indent_style = space
3
+ end_of_line = lf
4
+ insert_final_newline = true
5
+ trim_trailing_whitespace = true
6
+ charset = utf-8
7
+
8
+ [{*.py,*.cfg}]
9
+ indent_size = 4
10
+
11
+ [{*.html,*.dtml,*.pt,*.zpt,*.xml,*.zcml,*.js}]
12
+ indent_size = 2
13
+
14
+ [Makefile]
15
+ indent_style = tab
@@ -0,0 +1,33 @@
1
+ name: "build"
2
+ on:
3
+ push:
4
+ pull_request:
5
+ workflow_dispatch:
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ python: [python310, python311, python312, python313, python314]
12
+ sphinx: [8.2.3, 8.1.3, 8.0.2, 7.4.7]
13
+ exclude:
14
+ - python: python310
15
+ sphinx: 8.2.3
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ - uses: cachix/install-nix-action@v30
19
+ with:
20
+ nix_path: nixpkgs=channel:nixos-unstable
21
+ - uses: cachix/cachix-action@v15
22
+ with:
23
+ name: datakurre
24
+ signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
25
+ authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
26
+ - run: nix profile install nixpkgs#devenv
27
+ - run: LC_ALL=en_US.UTF-8 make devenv-test devenv-coverage devenv-docs PYTHON=${{ matrix.python }} SPHINX=${{ matrix.sphinx }}
28
+ - uses: coverallsapp/github-action@v2
29
+ if: matrix.python == 'python314' && matrix.sphinx == '8.2.3'
30
+ with:
31
+ debug: true
32
+ format: cobertura
33
+ github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,23 @@
1
+ # .github/workflows/rtd-pr-preview.yml
2
+ # https://github.com/readthedocs/actions/blob/v1/preview/README.md
3
+ name: readthedocs/actions
4
+ on:
5
+ pull_request_target:
6
+ types:
7
+ - opened
8
+ # Execute this action only on PRs that touch
9
+ # documentation files.
10
+ # paths:
11
+ # - "docs/**"
12
+
13
+ permissions:
14
+ pull-requests: write
15
+
16
+ jobs:
17
+ documentation-links:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: readthedocs/actions/preview@v1
21
+ with:
22
+ project-slug: "sphinxcontrib-httpexample"
23
+ single-version: "true"
@@ -0,0 +1,11 @@
1
+ *.egg-info
2
+ *.mo
3
+ *.pyc
4
+ .cache
5
+ .coverage
6
+ .devenv*
7
+ .pre-commit-config.yaml
8
+ .eggs/
9
+ _build/
10
+ coverage.xml
11
+ devenv.local.nix
@@ -0,0 +1,35 @@
1
+ # Read the Docs configuration file for Sphinx projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the OS, Python version and other tools you might need
8
+ build:
9
+ os: ubuntu-22.04
10
+ tools:
11
+ python: "3.13"
12
+ # You can also specify other tool versions:
13
+ # nodejs: "20"
14
+ # rust: "1.70"
15
+ # golang: "1.20"
16
+
17
+ # Build documentation in the "docs/" directory with Sphinx
18
+ sphinx:
19
+ configuration: docs/conf.py
20
+ # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21
+ # builder: "dirhtml"
22
+ # Fail on all warnings to avoid broken references
23
+ # fail_on_warning: true
24
+
25
+ # Optionally build your docs in additional formats such as PDF and ePub
26
+ # formats:
27
+ # - pdf
28
+ # - epub
29
+
30
+ # Optional but recommended, declare the Python requirements required
31
+ # to build your documentation
32
+ # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33
+ python:
34
+ install:
35
+ - requirements: docs/requirements.txt
@@ -0,0 +1,13 @@
1
+ on-unmatched = "debug"
2
+
3
+ [formatter.nix]
4
+ command = "nixfmt"
5
+ includes = ["*.nix"]
6
+
7
+ [formatter.python]
8
+ command = "black"
9
+ includes = ["*.py"]
10
+
11
+ [formatter.isort]
12
+ command = "isort"
13
+ includes = ["*.py"]
@@ -0,0 +1,224 @@
1
+ # Changelog
2
+
3
+ ## 2.0 (2026-02-23)
4
+
5
+ - Dropped support for Python 3.9.
6
+ [stevepiercy]
7
+ - Migrated from `pkg_resources` to `importlib`.
8
+ [datakurre]
9
+ - Overhauled `Makefile`. Add `make lint` and `make test` targets.
10
+ [stevepiercy]
11
+ - Use uv to set up a development environment.
12
+ [stevepiercy]
13
+ - Enhanced documentation with `@plone/client` examples, clarify headings, fix broken links, and improve formatting, grammar, and syntax.
14
+ Added sphinx-copybutton extension to allow copying code snippets.
15
+ [stevepiercy]
16
+ - Use the `name` argument for the CSS label.
17
+ [Hrittik20]
18
+ - Fixed a regression so that the response tab now shows the HTTP response instead of the request.
19
+ [datakurre]
20
+
21
+
22
+ ## 2.0rc1 (2025-12-02)
23
+
24
+ - Add support for Python 3.14
25
+ [datakurre]
26
+ - Drop support for Python 2
27
+ [datakurre]
28
+
29
+ ## 1.3 (2024-08-18)
30
+
31
+ - Add new directive `.. http:example-block::` to allow use with Sphinx tab libraries like
32
+ [sphinx-inline-tabs](https://sphinx-inline-tabs.readthedocs.io/en/latest/) or
33
+ [sphinx-design](https://sphinx-design.readthedocs.io/en/furo-theme/tabs.html).
34
+ [AWhetter]
35
+
36
+ ## 1.2 (2024-08-17)
37
+
38
+ - Add new HTTP example builder `plone-javascript`
39
+ [datakurre]
40
+ - Fix tabbing to no longer depend on jQuery
41
+ [datakurre]
42
+ - Fix tabbing to support arrow key navigation
43
+ [datakurre]
44
+ - Fix tab key to stop at tab list only once
45
+ [datakurre]
46
+ - Fix requests builder to flatten simple values in form data
47
+ [datakurre]
48
+ - Fix requests builder to pass form data as dictionary
49
+ [datakurre]
50
+ - Change JavaScript-based tabbing to no longer require JQuery
51
+ [datakurre]
52
+
53
+ ## 1.1 (2021-12-25)
54
+
55
+ - Add support for docutils 0.17.x
56
+ [kvondersaar, datakurre]
57
+ - Add support for Python 3.8
58
+ [datakurre]
59
+ - Fix example tabs accessibility
60
+ [datakurre]
61
+
62
+ ## 1.0 (2021-09-10)
63
+
64
+ - The curl command builder will now always specify a method
65
+ [LefterisJP]
66
+
67
+ ## 0.11.0 (2021-05-14)
68
+
69
+ - Change to quote examples with `"` rather than `'`
70
+ [datakurre]
71
+ - Fix Sphinx deprecation warnings and support Sphinx 4.x
72
+ [kkrypt0nn, AWhetter]
73
+ - Fix to use `ast.unparse` instead of `astunparse` on Python >= 3.9
74
+ [datakurre]
75
+
76
+ ## 0.10.3 (2019-05-01)
77
+
78
+ - Re-release 0.10.2 with wheel
79
+ [datakurre]
80
+
81
+ ## 0.10.2 (2019-05-01)
82
+
83
+ - Add support for inline response examples without HTTP version
84
+ (e.g., `HTTP 200 OK`)
85
+ [datakurre]
86
+ - Fix regression where support for reading request examples from
87
+ external files was broken since 0.10.0
88
+ [datakurre]
89
+
90
+ ## 0.10.1 (2019-03-19)
91
+
92
+ - Fix issue where it was not possible to request examples with
93
+ float values in payload JSON [fixes #42]
94
+ [datakurre]
95
+
96
+ ## 0.10.0 (2018-10-09)
97
+
98
+ - Add support for URL query parameters, using the `query` field.
99
+ Given a line `:query param_name: param_value` in an HTTP example
100
+ directive, the key-value pair `param_name`, `param_value` will be
101
+ added to the request URL (and excluded from further processing).
102
+ [ludaavics]
103
+
104
+ Example:
105
+
106
+ ```http
107
+ GET /items HTTP/1.1
108
+ Host: localhost
109
+ Accept: application/json
110
+ Authorization: Basic dXNlcjpwYXNzd29yZA==
111
+
112
+ :query from: 20170101
113
+ :query to: 20171231
114
+ :query user_id: 12
115
+ :query limit: 20
116
+ :query sort: date(asc)
117
+ ```
118
+
119
+ ## 0.9.1 (2018-10-06)
120
+
121
+ - Fix packaging to include `setup.cfg` in sdist
122
+ [datakurre]
123
+ - Add the Guillotina docs (which now uses httpexample)
124
+ [cdevienne]
125
+
126
+ ## 0.9.0 (2018-07-22)
127
+
128
+ - Add support for inlining responses
129
+ [cdevienne]
130
+
131
+ ## 0.8.1 (2018-06-27)
132
+
133
+ - Fix error when parsing top-level JSON lists
134
+ [AWhetter]
135
+
136
+ ## 0.8.0 (2017-11-18)
137
+
138
+ - Fix to not strip out `Accept`/`Content-Type` headers in builders
139
+ [dokai]
140
+ - Improve logic to detect a JSON content type
141
+ [dokai]
142
+ - Use redirected input to pass request payload to `httpie`
143
+ [dokai]
144
+ - Fix quoting of non-trivial HTTP headers in builders
145
+ [dokai]
146
+ - Change to use declarative packaging (`setup.cfg` instead of `setup.py`)
147
+ [datakurre]
148
+
149
+ ## 0.7.0 (2017-10-21)
150
+
151
+ - Allow the URL scheme (`http` or `https`) to be configured
152
+ [dokai]
153
+ - Quote the URL if it contains `&` characters in `curl`/`httpie`/`wget` examples
154
+ [dokai]
155
+
156
+ ## 0.6.1 (2017-05-11)
157
+
158
+ - Release as universal wheel
159
+ [datakurre]
160
+
161
+ ## 0.6.0 (2017-05-11)
162
+
163
+ - Support non-JSON requests
164
+ [jaroel]
165
+ - Support `application/json; charset=utf-8`
166
+ [skyzyx]
167
+
168
+ ## 0.5.2 (2017-03-09)
169
+
170
+ - Fix packaging to include the files in `static` [#3]
171
+ [csenger]
172
+
173
+ ## 0.5.1 (2017-03-05)
174
+
175
+ - Update README and documentation
176
+ [datakurre]
177
+
178
+ ## 0.5.0 (2017-03-05)
179
+
180
+ - Change development status to beta
181
+ [datakurre]
182
+
183
+ ## 0.4.2 (2017-03-05)
184
+
185
+ - Fix issue where `wget` basic auth required a challenge from the backend, which is not
186
+ always available
187
+ [datakurre]
188
+
189
+ ## 0.4.1 (2017-03-05)
190
+
191
+ - Fix issue where generated `httpie` commands did not always set `Accept` and
192
+ `Content-Type` headers
193
+ [datakurre]
194
+
195
+ ## 0.4.0 (2017-03-05)
196
+
197
+ - Add support for `wget`
198
+ [datakurre]
199
+
200
+ ## 0.3.0 (2017-03-05)
201
+
202
+ - Add generic `Authorization` header support
203
+ [datakurre]
204
+
205
+ ## 0.2.1 (2017-03-05)
206
+
207
+ - Fix issue where `Authorization` header was always required
208
+ [datakurre]
209
+ - Fix to raise proper exception when parsing bad requests
210
+ [datakurre]
211
+ - Fix issue where `httpie` builder did not quote values with spaces
212
+ [datakurre]
213
+ - Fix link to `python-requests` documentation
214
+ [datakurre]
215
+
216
+ ## 0.2.0 (2017-03-05)
217
+
218
+ - Add support for `GET` requests
219
+ [datakurre]
220
+
221
+ ## 0.1.0 (2017-03-05)
222
+
223
+ - First release
224
+ [datakurre]
@@ -0,0 +1,136 @@
1
+ # Makefile for Sphinx documentation
2
+ .DEFAULT_GOAL = help
3
+ SHELL = bash
4
+
5
+ # You can set these variables from the command line.
6
+ SPHINXOPTS ?=
7
+ PAPER ?=
8
+
9
+ # Internal variables.
10
+ MAKEFILE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
11
+ ifdef IN_NIX_SHELL
12
+ BIN_FOLDER = $(shell dirname "$$(command -v python)")
13
+ VENV_FOLDER = $(shell dirname "$(BIN_FOLDER)")
14
+ else
15
+ VENV_FOLDER = $(MAKEFILE_DIR)/.venv
16
+ BIN_FOLDER = $(VENV_FOLDER)/bin
17
+ endif
18
+ DOCS_DIR = $(MAKEFILE_DIR)/docs/
19
+ BUILDDIR = $(MAKEFILE_DIR)/_build
20
+ SPHINXBUILD = "$(realpath $(BIN_FOLDER)/sphinx-build)"
21
+ SPHINXAUTOBUILD = "$(realpath $(BIN_FOLDER)/sphinx-autobuild)"
22
+ PAPEROPT_a4 = -D latex_paper_size=a4
23
+ PAPEROPT_letter = -D latex_paper_size=letter
24
+ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
25
+ PYTHONVERSION = >=3.11,<3.15
26
+
27
+ # Add the following 'help' target to your Makefile
28
+ # And add help text after each target name starting with '\#\#'
29
+ .PHONY: help
30
+ help: ## This help message
31
+ @grep -Eh '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | uniq
32
+
33
+ SPHINX ?= 8.3.2
34
+ PYTHON ?= python313
35
+
36
+ # docs contains example of custom http-example builder module
37
+ export PYTHONPATH=$(DOCS_DIR)
38
+
39
+ # environment management
40
+ .venv: ## Install required Python, create Python virtual environment, and install package requirements
41
+ ifndef IN_NIX_SHELL
42
+ @uv python install "$(PYTHONVERSION)"
43
+ @uv venv --python "$(PYTHONVERSION)"
44
+ @uv sync
45
+ endif
46
+
47
+ .PHONY: sync
48
+ sync: ## Sync package requirements
49
+ ifndef IN_NIX_SHELL
50
+ @uv sync
51
+ endif
52
+
53
+ .PHONY: init
54
+ init: clean clean-python .venv ## Clean docs build directory and initialize Python virtual environment
55
+
56
+ .PHONY: clean
57
+ clean: ## Clean docs build directory
58
+ cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/
59
+
60
+ .PHONY: clean-python
61
+ clean-python: clean
62
+ rm -rf .venv/
63
+ # /environment management
64
+
65
+
66
+ # documentation builders
67
+ .PHONY: html
68
+ html: .venv ## Build html
69
+ cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
70
+ @echo
71
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
72
+
73
+ .PHONY: livehtml
74
+ livehtml: .venv ## Rebuild Sphinx documentation on changes, with live-reload in the browser
75
+ cd "$(DOCS_DIR)" && ${SPHINXAUTOBUILD} \
76
+ --ignore "*.swp" \
77
+ --watch "../src/sphinxcontrib/httpexample/" \
78
+ --port 8050 \
79
+ -b html . "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
80
+ # /documentation builders
81
+
82
+
83
+ # development and contributing
84
+ .PHONY: format
85
+ format: ## Format code
86
+ treefmt
87
+
88
+ .PHONY: show
89
+ show: ## Show installed packages
90
+ @python --version
91
+ @python -c "from importlib import metadata; print('\n'.join(sorted(d.metadata['Name'] + f' {d.version}' for d in metadata.distributions() if d.metadata['Name'].lower() in ['docutils', 'sphinx'])))"
92
+
93
+ .PHONY: test
94
+ test: ## Run tests
95
+ $(BIN_FOLDER)/pytest --cov sphinxcontrib.httpexample tests
96
+
97
+ .PHONY: devenv-%
98
+ devenv-%: devenv.local.nix
99
+ devenv shell $(MAKE) $*
100
+
101
+ shell: devenv.local.nix ## Start a shell with the development environment
102
+ devenv shell
103
+
104
+ htmlcov: .coverage
105
+ coverage html
106
+
107
+ coverage.xml: .coverage
108
+ coverage xml
109
+
110
+ coverage: coverage.xml
111
+
112
+ .PHONY: test\ all
113
+ test\ all: ## Test all supported versions
114
+ make PYTHON=python314 SPHINX=8.2.3 clean devenv-show devenv-test
115
+ make PYTHON=python314 SPHINX=8.1.3 clean devenv-show devenv-test
116
+ make PYTHON=python314 SPHINX=8.0.2 clean devenv-show devenv-test
117
+ make PYTHON=python314 SPHINX=7.4.7 clean devenv-show devenv-test
118
+ make PYTHON=python313 SPHINX=8.2.3 clean devenv-show devenv-test
119
+ make PYTHON=python313 SPHINX=8.1.3 clean devenv-show devenv-test
120
+ make PYTHON=python313 SPHINX=8.0.2 clean devenv-show devenv-test
121
+ make PYTHON=python313 SPHINX=7.4.7 clean devenv-show devenv-test
122
+ make PYTHON=python312 SPHINX=8.2.3 clean devenv-show devenv-test
123
+ make PYTHON=python312 SPHINX=8.1.3 clean devenv-show devenv-test
124
+ make PYTHON=python312 SPHINX=8.0.2 clean devenv-show devenv-test
125
+ make PYTHON=python312 SPHINX=7.4.7 clean devenv-show devenv-test
126
+ make PYTHON=python311 SPHINX=8.2.3 clean devenv-show devenv-test
127
+ make PYTHON=python311 SPHINX=8.1.3 clean devenv-show devenv-test
128
+ make PYTHON=python311 SPHINX=8.0.2 clean devenv-show devenv-test
129
+ make PYTHON=python311 SPHINX=7.4.7 clean devenv-show devenv-test
130
+ make PYTHON=python310 SPHINX=8.1.3 clean devenv-show devenv-test
131
+ make PYTHON=python310 SPHINX=8.0.2 clean devenv-show devenv-test
132
+ make PYTHON=python310 SPHINX=7.4.7 clean devenv-show devenv-test
133
+
134
+ devenv.local.nix:
135
+ @echo '{ pkgs, ...}: { languages.python = { interpreter = pkgs.$(PYTHON); dependencies = [ "sphinx$(subst .,,$(SPHINX))" "dev" ]; }; }' > devenv.local.nix
136
+ # /development and contributing
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinxcontrib-httpexample
3
+ Version: 2.0
4
+ Summary: Adds example directive for sphinx-contrib httpdomain
5
+ Project-URL: Repository, https://github.com/collective/sphinxcontrib-httpexample
6
+ Author-email: Asko Soukka <asko.soukka@iki.fi>
7
+ License: GPL-2.0-only
8
+ Keywords: documentation,extension,http,rest,sphinx
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Console
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Framework :: Sphinx :: Extension
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Documentation
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: docutils
21
+ Requires-Dist: importlib-metadata
22
+ Requires-Dist: importlib-resources
23
+ Requires-Dist: sphinx
24
+ Requires-Dist: sphinxcontrib-httpdomain
25
+ Provides-Extra: sphinx747
26
+ Requires-Dist: sphinx==7.4.7; (python_version >= '3.10') and extra == 'sphinx747'
27
+ Provides-Extra: sphinx802
28
+ Requires-Dist: sphinx==8.0.2; (python_version >= '3.10') and extra == 'sphinx802'
29
+ Provides-Extra: sphinx813
30
+ Requires-Dist: babel; extra == 'sphinx813'
31
+ Requires-Dist: sphinx==8.1.3; (python_version >= '3.10') and extra == 'sphinx813'
32
+ Provides-Extra: sphinx823
33
+ Requires-Dist: sphinx==8.2.3; (python_version >= '3.11') and extra == 'sphinx823'
34
+ Provides-Extra: test
35
+ Description-Content-Type: text/markdown
36
+
37
+ # sphinxcontrib-httpexample
38
+
39
+ <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">
40
+ <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">
41
+ <img alt="PyPI package" src="https://badge.fury.io/py/sphinxcontrib-httpexample.svg" href="https://pypi.org/project/sphinxcontrib-httpexample/">
42
+ <img alt="Documentation" src="https://readthedocs.org/projects/sphinxcontrib-httpexample/badge/?version=latest" href="https://sphinxcontrib-httpexample.readthedocs.io/en/latest/">
43
+
44
+ sphinxcontrib-httpexample is a Sphinx domain extension for describing RESTful HTTP APIs in detail.
45
+ It enhances [`sphinxcontrib-httpdomain`](https://github.com/sphinx-contrib/httpdomain) with a simple call example directive.
46
+ The directive provided by this extension generates RESTful HTTP API call examples for different HTTP clients from a single HTTP request example.
47
+
48
+ The audience for this extension are developers and technical writers documenting their RESTful HTTP APIs.
49
+ This extension was originally developed for documenting [`plone.restapi`](https://6.docs.plone.org/plone.restapi/docs/source/index.html).
50
+
51
+
52
+ ## Features
53
+
54
+ - Directive for generating various RESTful HTTP API call examples from a single HTTP request.
55
+ - Supported HTTP clients:
56
+
57
+ - [curl](https://curl.haxx.se/)
58
+ - [wget](https://www.gnu.org/software/wget/)
59
+ - [httpie](https://httpie.io/)
60
+ - [requests](https://requests.readthedocs.io/en/stable/)
61
+
62
+ - Custom builders, such as the [`@plone/client`](https://www.npmjs.com/package/@plone/client) package, an agnostic library that provides easy access to the Plone REST API from a client written in TypeScript.
63
+ See https://sphinxcontrib-httpexample.readthedocs.io/en/latest/custom.html for examples.
64
+
65
+
66
+ ## Examples
67
+
68
+ This extension has been used in documentation for the following projects and probably other similar projects as well.
69
+
70
+ - https://6.docs.plone.org/plone.restapi/docs/source/index.html
71
+ - https://sphinxcontrib-httpexample.readthedocs.io/en/latest/
72
+ - https://guillotina.readthedocs.io/en/latest/
73
+
74
+
75
+ ## Documentation
76
+
77
+ Full documentation for end users can be found in the `docs` folder.
78
+ It's also available online at https://sphinxcontrib-httpexample.readthedocs.io/en/latest/.
79
+
80
+
81
+ ## Installation
82
+
83
+ Add `sphinxcontrib-httpexample` and `sphincontrib-httpdomain` to your project requirements.
84
+
85
+ Then configure your Sphinx configuration file `conf.py` with `sphinxcontrib.httpdomain` and `sphinxcontrib.httpexample` as follows.
86
+
87
+ ```python
88
+ extensions = [
89
+ "sphinxcontrib.httpdomain",
90
+ "sphinxcontrib.httpexample",
91
+ ]
92
+ ```
93
+
94
+
95
+ ## Contribute
96
+
97
+ To contribute to `sphinxcontrib-httpexample`, first set up your environment.
98
+
99
+
100
+ ### Set up development environment
101
+
102
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/).
103
+ Carefully read the console output for further instruction.
104
+
105
+ ```shell
106
+ curl -LsSf https://astral.sh/uv/install.sh | sh
107
+ ```
108
+
109
+ Initialize a Python virtual environment.
110
+
111
+ ```shell
112
+ uv venv
113
+ ```
114
+
115
+ Install `sphinxcontrib-httpexample`.
116
+
117
+ ```shell
118
+ uv sync
119
+ ```
120
+
121
+
122
+ ### Build documentation
123
+
124
+ Rebuild Sphinx documentation on changes, with live reload in the browser.
125
+
126
+ ```shell
127
+ make livehtml
128
+ ```
129
+
130
+ To stop the preview, type `CTRL-C`.
131
+
132
+
133
+ ### Run tests
134
+
135
+ ```shell
136
+ make test
137
+ ```
138
+
139
+
140
+ ## License
141
+
142
+ The project is licensed under the GPLv2.