Skip to content

Commit f1fe11b

Browse files
committed
Better documentation for hyperframe.
1 parent 7714377 commit f1fe11b

4 files changed

Lines changed: 201 additions & 32 deletions

File tree

docs/source/api.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
hyperframe API
2+
==============
3+
4+
This document provides the hyperframe API.
5+
6+
All frame classes are subclasses of :class:`Frame <hyperframe.frame.Frame>`,
7+
and provide the methods and attributes defined there. Additionally, some frames
8+
use the :class:`Priority <hyperframe.frame.Priority>` and
9+
:class:`Padding <hyperframe.frame.Padding>` mixins, and make the methods and
10+
attributes defined on *those* mixins available as well.
11+
12+
Rather than clutter up the documentation repeatedly documenting those methods
13+
and objects, we explicitly show the inheritance heirarchy of the frames: don't
14+
forget to consule the parent classes before deciding if a method or attribute
15+
you need is not present!
16+
17+
.. autoclass:: hyperframe.frame.Frame
18+
:members:
19+
20+
.. autoclass:: hyperframe.frame.Padding
21+
:members:
22+
23+
.. autoclass:: hyperframe.frame.Priority
24+
:members:
25+
26+
.. autoclass:: hyperframe.frame.DataFrame
27+
:show-inheritance:
28+
:members:
29+
30+
.. autoclass:: hyperframe.frame.PriorityFrame
31+
:show-inheritance:
32+
:members:
33+
34+
.. autoclass:: hyperframe.frame.RstStreamFrame
35+
:show-inheritance:
36+
:members:
37+
38+
.. autoclass:: hyperframe.frame.SettingsFrame
39+
:show-inheritance:
40+
:members:
41+
42+
.. autoclass:: hyperframe.frame.PushPromiseFrame
43+
:show-inheritance:
44+
:members:
45+
46+
.. autoclass:: hyperframe.frame.PingFrame
47+
:show-inheritance:
48+
:members:
49+
50+
.. autoclass:: hyperframe.frame.GoAwayFrame
51+
:show-inheritance:
52+
:members:
53+
54+
.. autoclass:: hyperframe.frame.WindowUpdateFrame
55+
:show-inheritance:
56+
:members:
57+
58+
.. autoclass:: hyperframe.frame.HeadersFrame
59+
:show-inheritance:
60+
:members:
61+
62+
.. autoclass:: hyperframe.frame.ContinuationFrame
63+
:show-inheritance:
64+
:members:
65+
66+
.. autodata:: hyperframe.frame.FRAMES

docs/source/index.rst

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1-
.. hyperframe documentation master file, created by
2-
sphinx-quickstart on Mon Oct 12 14:06:36 2015.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
1+
hyperframe: HTTP/2 Framing for Python
2+
=====================================
53

6-
Welcome to hyperframe's documentation!
7-
======================================
4+
hyperframe is a pure-Python tool for working with HTTP/2 frames. This library
5+
allows you to create, serialize, and parse HTTP/2 frames.
86

9-
Contents:
7+
Working with it is easy:
108

11-
.. toctree::
12-
:maxdepth: 2
9+
.. code-block:: python
10+
11+
import hyperframe
12+
13+
f = hyperframe.frame.DataFrame(stream_id=5)
14+
f.data = b'some binary data'
15+
f.flags.add('END_STREAM')
16+
f.flags.add('PADDED')
17+
f.padding_length = 30
1318
19+
data = f.serialize()
1420
21+
new_frame = hyperframe.frame.Frame.parse_frame_header(data[:9])
22+
new_frame.parse_body(data[9:])
1523
16-
Indices and tables
17-
==================
24+
hyperframe is pure-Python, contains no external dependencies, and runs on a
25+
wide variety of Python interpreters and platforms. Made available under the MIT
26+
license, why write your own frame parser?
1827

19-
* :ref:`genindex`
20-
* :ref:`modindex`
21-
* :ref:`search`
28+
Contents:
29+
30+
.. toctree::
31+
:maxdepth: 2
2232

33+
installation
34+
api

docs/source/installation.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Installing hyperframe
2+
=====================
3+
4+
hyperframe is trivial to install from the Python Package Index. Simply run:
5+
6+
.. code-block:: console
7+
8+
$ pip install hyperframe
9+
10+
Alternatively, feel free to download one of the release tarballs from
11+
`our GitHub page`_, extract it to your favourite directory, and then run
12+
13+
.. code-block:: console
14+
15+
$ python setup.py install
16+
17+
hyperframe has no external dependencies.
18+
19+
20+
21+
.. _our GitHub page: https://github.com/python-hyper/hyperframe

0 commit comments

Comments
 (0)