Skip to content

Commit 94b89b8

Browse files
authored
Rename 'hyper-h2' to simply 'h2' (#1246)
1 parent 5bfbb67 commit 94b89b8

24 files changed

+137
-135
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Release History
44
dev
55
---
66

7+
**Note:** The GitHub repository has been renamed to ``python-hyper/h2``, previously
8+
was ``python-hyper/hyper-h2``. **The name of the package on PyPI is unchanged**
9+
710
**API Changes (Backward Incompatible)**
811

912
-

README.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
===============================
2-
hyper-h2: HTTP/2 Protocol Stack
3-
===============================
1+
=========================
2+
h2: HTTP/2 Protocol Stack
3+
=========================
44

5-
.. image:: https://github.com/python-hyper/hyper-h2/workflows/CI/badge.svg
6-
:target: https://github.com/python-hyper/hyper-h2/actions
5+
.. image:: https://github.com/python-hyper/h2/workflows/CI/badge.svg
6+
:target: https://github.com/python-hyper/h2/actions
77
:alt: Build Status
8-
.. image:: https://codecov.io/gh/python-hyper/hyper-h2/branch/master/graph/badge.svg
9-
:target: https://codecov.io/gh/python-hyper/hyper-h2
8+
.. image:: https://codecov.io/gh/python-hyper/h2/branch/master/graph/badge.svg
9+
:target: https://codecov.io/gh/python-hyper/h2
1010
:alt: Code Coverage
11-
.. image:: https://readthedocs.org/projects/hyper-h2/badge/?version=latest
12-
:target: https://hyper-h2.readthedocs.io/en/latest/
11+
.. image:: https://readthedocs.org/projects/h2/badge/?version=latest
12+
:target: https://h2.readthedocs.io
1313
:alt: Documentation Status
1414
.. image:: https://img.shields.io/badge/chat-join_now-brightgreen.svg
1515
:target: https://gitter.im/python-hyper/community
@@ -45,17 +45,17 @@ To install it, just run:
4545

4646
.. code-block:: console
4747
48-
$ pip install h2
48+
$ python -m pip install h2
4949
5050
Documentation
5151
=============
5252

53-
Documentation is available at https://hyper-h2.readthedocs.io/ .
53+
Documentation is available at https://h2.readthedocs.io .
5454

5555
Contributing
5656
============
5757

58-
``hyper-h2`` welcomes contributions from anyone! Unlike many other projects we
58+
``h2`` welcomes contributions from anyone! Unlike many other projects we
5959
are happy to accept cosmetic contributions and small contributions, in addition
6060
to large feature requests and changes.
6161

@@ -67,10 +67,11 @@ please `read the contribution guidelines`_.
6767
License
6868
=======
6969

70-
``hyper-h2`` is made available under the MIT License. For more details, see the
70+
``h2`` is made available under the MIT License. For more details, see the
7171
``LICENSE`` file in the repository.
7272

7373
Authors
7474
=======
7575

76-
``hyper-h2`` is maintained by Cory Benfield, with contributions from others.
76+
``h2`` was authored by Cory Benfield and is maintained
77+
by the members of `python-hyper <https://github.com/orgs/python-hyper/people>`_.

docs/source/advanced-usage.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Priority
1010
build a HTTP/2 priority tree, and the effect that should have on sending data
1111
from a server.
1212

13-
Hyper-h2 does not enforce any priority logic by default for servers. This is
13+
h2 does not enforce any priority logic by default for servers. This is
1414
because scheduling data sends is outside the scope of this library, as it
1515
likely requires fairly substantial understanding of the scheduler being used.
1616

@@ -26,7 +26,7 @@ Related Events
2626

2727
.. versionadded:: 2.4.0
2828

29-
In the 2.4.0 release hyper-h2 added support for signaling "related events".
29+
In the 2.4.0 release h2 added support for signaling "related events".
3030
These are a HTTP/2-only construct that exist because certain HTTP/2 events can
3131
occur simultaneously: that is, one HTTP/2 frame can cause multiple state
3232
transitions to occur at the same time. One example of this is a HEADERS frame
@@ -35,17 +35,17 @@ cause three events to fire (one of the various request/response received
3535
events, a :class:`PriorityUpdated <h2.events.PriorityUpdated>` event, and a
3636
:class:`StreamEnded <h2.events.StreamEnded>` event).
3737

38-
Ordinarily hyper-h2's logic will emit those events to you one at a time. This
38+
Ordinarily h2's logic will emit those events to you one at a time. This
3939
means that you may attempt to process, for example, a
4040
:class:`DataReceived <h2.events.DataReceived>` event, not knowing that the next
4141
event out will be a :class:`StreamEnded <h2.events.StreamEnded>` event.
42-
hyper-h2 *does* know this, however, and so will forbid you from taking certain
42+
h2 *does* know this, however, and so will forbid you from taking certain
4343
actions that are a violation of the HTTP/2 protocol.
4444

4545
To avoid this asymmetry of information, events that can occur simultaneously
4646
now carry properties for their "related events". These allow users to find the
4747
events that can have occurred simultaneously with each other before the event
48-
is emitted by hyper-h2. The following objects have "related events":
48+
is emitted by h2. The following objects have "related events":
4949

5050
- :class:`RequestReceived <h2.events.RequestReceived>`:
5151

@@ -96,7 +96,7 @@ is emitted by hyper-h2. The following objects have "related events":
9696
same time as receiving this data.
9797

9898

99-
.. warning:: hyper-h2 does not know if you are looking for related events or
99+
.. warning:: h2 does not know if you are looking for related events or
100100
expecting to find events in the event stream. Therefore, it will
101101
always emit "related events" in the event stream. If you are using
102102
the "related events" event pattern, you will want to be careful to
@@ -167,19 +167,19 @@ When To Send
167167
~~~~~~~~~~~~
168168

169169
In addition to knowing how much data to send (see :ref:`advanced-sending-data`)
170-
it is important to know when to send data. For hyper-h2, this amounts to
170+
it is important to know when to send data. For h2, this amounts to
171171
knowing when to call :meth:`data_to_send
172172
<h2.connection.H2Connection.data_to_send>`.
173173

174-
Hyper-h2 may write data into its send buffer at two times. The first is
174+
h2 may write data into its send buffer at two times. The first is
175175
whenever :meth:`receive_data <h2.connection.H2Connection.receive_data>` is
176176
called. This data is sent in response to some control frames that require no
177177
user input: for example, responding to PING frames. The second time is in
178178
response to user action: whenever a user calls a method like
179179
:meth:`send_headers <h2.connection.H2Connection.send_headers>`, data may be
180180
written into the buffer.
181181

182-
In a standard design for a hyper-h2 consumer, then, that means there are two
182+
In a standard design for a h2 consumer, then, that means there are two
183183
places where you'll potentially want to send data. The first is in your
184184
"receive data" loop. This is where you take the data you receive, pass it into
185185
:meth:`receive_data <h2.connection.H2Connection.receive_data>`, and then
@@ -240,16 +240,16 @@ Working With Flow Control
240240
~~~~~~~~~~~~~~~~~~~~~~~~~
241241

242242
The amount of flow control window a ``DATA`` frame consumes is the sum of both
243-
its contained application data *and* the amount of padding used. hyper-h2 shows
243+
its contained application data *and* the amount of padding used. h2 shows
244244
this to the user in a :class:`DataReceived <h2.events.DataReceived>` event by
245245
using the :data:`flow_controlled_length
246246
<h2.events.DataReceived.flow_controlled_length>` field. When working with flow
247-
control in hyper-h2, users *must* use this field: simply using
247+
control in h2, users *must* use this field: simply using
248248
``len(datareceived.data)`` can eventually lead to deadlock.
249249

250250
When data has been received and given to the user in a :class:`DataReceived
251251
<h2.events.DataReceived>`, it is the responsibility of the user to re-open the
252-
flow control window when the user is ready for more data. hyper-h2 does not do
252+
flow control window when the user is ready for more data. h2 does not do
253253
this automatically to avoid flooding the user with data: if we did, the remote
254254
peer could send unbounded amounts of data that the user would need to buffer
255255
before processing.
@@ -258,7 +258,7 @@ To re-open the flow control window, then, the user must call
258258
:meth:`increment_flow_control_window
259259
<h2.connection.H2Connection.increment_flow_control_window>` with the
260260
:data:`flow_controlled_length <h2.events.DataReceived.flow_controlled_length>`
261-
of the received data. hyper-h2 requires that you manage both the connection
261+
of the received data. h2 requires that you manage both the connection
262262
and the stream flow control windows separately, so you may need to increment
263263
both the stream the data was received on and stream ``0``.
264264

@@ -269,10 +269,10 @@ flow control windows. You can find out how much data you can send on a given
269269
stream by using the :meth:`local_flow_control_window
270270
<h2.connection.H2Connection.local_flow_control_window>` method, which will do
271271
all of these calculations for you. If you attempt to send more than this amount
272-
of data on a stream, hyper-h2 will throw a :class:`ProtocolError
272+
of data on a stream, h2 will throw a :class:`ProtocolError
273273
<h2.exceptions.ProtocolError>` and refuse to send the data.
274274

275-
In hyper-h2, receiving a ``WINDOW_UPDATE`` frame causes a :class:`WindowUpdated
275+
In h2, receiving a ``WINDOW_UPDATE`` frame causes a :class:`WindowUpdated
276276
<h2.events.WindowUpdated>` event to fire. This will notify you that there is
277277
potentially more room in a flow control window. Note that, just because an
278278
increment of a given size was received *does not* mean that that much more data
@@ -301,7 +301,7 @@ control strategies. While particular high performance or specific-use-case
301301
applications may gain value from directly controlling the emission of
302302
``WINDOW_UPDATE`` frames, the average application can use a
303303
lowest-common-denominator strategy to emit those frames. As of version 2.5.0,
304-
hyper-h2 now provides this automatic strategy for users, if they want to use
304+
h2 now provides this automatic strategy for users, if they want to use
305305
it.
306306

307307
This automatic strategy is built around a single method:

docs/source/api.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
Hyper-h2 API
2-
============
1+
h2 API
2+
======
33

4-
This document details the API of Hyper-h2.
4+
This document details the API of h2.
55

66
Semantic Versioning
77
-------------------
88

9-
Hyper-h2 follows semantic versioning for its public API. Please note that the
9+
h2 follows semantic versioning for its public API. Please note that the
1010
guarantees of semantic versioning apply only to the API that is *documented
1111
here*. Simply because a method or data field is not prefaced by an underscore
12-
does not make it part of Hyper-h2's public API. Anything not documented here is
12+
does not make it part of h2's public API. Anything not documented here is
1313
subject to change at any time.
1414

1515
Connection

docs/source/basic-usage.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Getting Started: Writing Your Own HTTP/2 Server
22
===============================================
33

44
This document explains how to get started writing fully-fledged HTTP/2
5-
implementations using Hyper-h2 as the underlying protocol stack. It covers the
5+
implementations using h2 as the underlying protocol stack. It covers the
66
basic concepts you need to understand, and talks you through writing a very
77
simple HTTP/2 server.
88

@@ -17,10 +17,10 @@ return to this documentation.
1717
Connections
1818
-----------
1919

20-
Hyper-h2's core object is the
20+
h2's core object is the
2121
:class:`H2Connection <h2.connection.H2Connection>` object. This object is an
2222
abstract representation of the state of a single HTTP/2 connection, and holds
23-
all the important protocol state. When using Hyper-h2, this object will be the
23+
all the important protocol state. When using h2, this object will be the
2424
first thing you create and the object that does most of the heavy lifting.
2525

2626
The interface to this object is relatively simple. For sending data, you
@@ -54,7 +54,7 @@ this document, we'll do just that.
5454

5555
Some important subtleties of ``H2Connection`` objects are covered in
5656
:doc:`advanced-usage`: see :ref:`h2-connection-advanced` for more information.
57-
However, one subtlety should be covered, and that is this: Hyper-h2's
57+
However, one subtlety should be covered, and that is this: h2's
5858
``H2Connection`` object doesn't do I/O. Let's talk briefly about why.
5959

6060
I/O
@@ -74,19 +74,19 @@ into bytes to send. So there's no reason to have lots of different versions of
7474
this core protocol code: one for Twisted, one for gevent, one for threading,
7575
and one for synchronous code.
7676

77-
This is why we said at the top that Hyper-h2 is a *HTTP/2 Protocol Stack*, not
78-
a *fully-fledged implementation*. Hyper-h2 knows how to transform bytes into
77+
This is why we said at the top that h2 is a *HTTP/2 Protocol Stack*, not
78+
a *fully-fledged implementation*. h2 knows how to transform bytes into
7979
events and back, but that's it. The I/O and smarts might be different, but
80-
the core HTTP/2 logic is the same: that's what Hyper-h2 provides.
80+
the core HTTP/2 logic is the same: that's what h2 provides.
8181

82-
Not doing I/O makes Hyper-h2 general, and also relatively simple. It has an
82+
Not doing I/O makes h2 general, and also relatively simple. It has an
8383
easy-to-understand performance envelope, it's easy to test (and as a result
8484
easy to get correct behaviour out of), and it behaves in a reproducible way.
8585
These are all great traits to have in a library that is doing something quite
8686
complex.
8787

8888
This document will talk you through how to build a relatively simple HTTP/2
89-
implementation using Hyper-h2, to give you an understanding of where it fits in
89+
implementation using h2, to give you an understanding of where it fits in
9090
your software.
9191

9292

@@ -99,7 +99,7 @@ When writing a HTTP/2 implementation it's important to know what the remote
9999
peer is doing: if you didn't care, writing networked programs would be a lot
100100
easier!
101101

102-
Hyper-h2 encodes the actions of the remote peer in the form of *events*. When
102+
h2 encodes the actions of the remote peer in the form of *events*. When
103103
you receive data from the remote peer and pass it into your ``H2Connection``
104104
object (see :ref:`h2-connection-basic`), the ``H2Connection`` returns a list
105105
of objects, each one representing a single event that has occurred. Each
@@ -112,11 +112,11 @@ concept, not just a HTTP/2 one. Other events are extremely HTTP/2-specific:
112112
for example, :class:`PushedStreamReceived <h2.events.PushedStreamReceived>`
113113
refers to Server Push, a very HTTP/2-specific concept.
114114

115-
The reason these events exist is that Hyper-h2 is intended to be very general.
116-
This means that, in many cases, Hyper-h2 does not know exactly what to do in
115+
The reason these events exist is that h2 is intended to be very general.
116+
This means that, in many cases, h2 does not know exactly what to do in
117117
response to an event. Your code will need to handle these events, and make
118118
decisions about what to do. That's the major role of any HTTP/2 implementation
119-
built on top of Hyper-h2.
119+
built on top of h2.
120120

121121
A full list of events is available in :ref:`h2-events-api`. For the purposes
122122
of this example, we will handle only a small set of events.
@@ -129,15 +129,15 @@ Armed with the knowledge you just obtained, we're going to write a very simple
129129
HTTP/2 web server. The goal of this server is to write a server that can handle
130130
a HTTP GET, and that returns the headers sent by the client, encoded in JSON.
131131
Basically, something a lot like `httpbin.org/get`_. Nothing fancy, but this is
132-
a good way to get a handle on how you should interact with Hyper-h2.
132+
a good way to get a handle on how you should interact with h2.
133133

134134
For the sake of simplicity, we're going to write this using the Python standard
135135
library, in Python 3. In reality, you'll probably want to use an asynchronous
136136
framework of some kind: see the `examples directory`_ in the repository for
137137
some examples of how you'd do that.
138138

139139
Before we start, create a new file called ``h2server.py``: we'll use that as
140-
our workspace. Additionally, you should install Hyper-h2: follow the
140+
our workspace. Additionally, you should install h2: follow the
141141
instructions in :doc:`installation`.
142142

143143
Step 1: Sockets
@@ -324,7 +324,7 @@ Let's do that next.
324324
Step 3: Sending the Preamble
325325
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
326326

327-
Hyper-h2 makes doing connection setup really easy. All you need to do is call
327+
h2 makes doing connection setup really easy. All you need to do is call
328328
the
329329
:meth:`initiate_connection <h2.connection.H2Connection.initiate_connection>`
330330
method, and then send the corresponding data. Let's update our ``handle``
@@ -348,7 +348,7 @@ new method in there:
348348
:meth:`data_to_send <h2.connection.H2Connection.data_to_send>`.
349349

350350
When you make function calls on your ``H2Connection`` object, these will often
351-
want to cause HTTP/2 data to be written out to the network. But Hyper-h2
351+
want to cause HTTP/2 data to be written out to the network. But h2
352352
doesn't do any I/O, so it can't do that itself. Instead, it writes it to an
353353
internal buffer. You can retrieve data from this buffer using the
354354
``data_to_send`` method. There are some subtleties about that method, but we
@@ -477,17 +477,17 @@ there: ``:status``. This is a HTTP/2-specific header, and it's used to hold the
477477
HTTP status code that used to go at the top of a HTTP response. Here, we're
478478
saying the response is ``200 OK``, which is successful.
479479

480-
To send headers in Hyper-h2, you use the
480+
To send headers in h2, you use the
481481
:meth:`send_headers <h2.connection.H2Connection.send_headers>` function.
482482

483483
Next, we want to send the body data. To do that, we use the
484484
:meth:`send_data <h2.connection.H2Connection.send_data>` function. This also
485-
takes a stream ID. Note that the data is binary: Hyper-h2 does not work with
485+
takes a stream ID. Note that the data is binary: h2 does not work with
486486
unicode strings, so you *must* pass bytestrings to the ``H2Connection``. The
487-
one exception is headers: Hyper-h2 will automatically encode those into UTF-8.
487+
one exception is headers: h2 will automatically encode those into UTF-8.
488488

489489
The last thing to note is that on our call to ``send_data``, we set
490-
``end_stream`` to ``True``. This tells Hyper-h2 (and the remote peer) that
490+
``end_stream`` to ``True``. This tells h2 (and the remote peer) that
491491
we're done with sending data: the response is over. Because we know that
492492
``hyper`` will have ended its side of the stream, when we end ours the stream
493493
will be totally done with.
@@ -703,7 +703,7 @@ see something like the following output from ``hyper``:
703703
Here you can see the HTTP/2 request 'special headers' that ``hyper`` sends.
704704
These are similar to the ``:status`` header we have to send on our response:
705705
they encode important parts of the HTTP request in a clearly-defined way. If
706-
you were writing a client stack using Hyper-h2, you'd need to make sure you
706+
you were writing a client stack using h2, you'd need to make sure you
707707
were sending those headers.
708708

709709
Congratulations!
@@ -737,10 +737,10 @@ it, there are a few directions you could investigate:
737737

738738
.. _event loop: https://en.wikipedia.org/wiki/Event_loop
739739
.. _httpbin.org/get: https://httpbin.org/get
740-
.. _examples directory: https://github.com/python-hyper/hyper-h2/tree/master/examples
741-
.. _standard library's socket module: https://docs.python.org/3.5/library/socket.html
740+
.. _examples directory: https://github.com/python-hyper/h2/tree/master/examples
741+
.. _standard library's socket module: https://docs.python.org/3/library/socket.html
742742
.. _Application Layer Protocol Negotiation: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation
743-
.. _get your certificate here: https://raw.githubusercontent.com/python-hyper/hyper-h2/master/examples/twisted/server.crt
744-
.. _get your private key here: https://raw.githubusercontent.com/python-hyper/hyper-h2/master/examples/twisted/server.key
743+
.. _get your certificate here: https://raw.githubusercontent.com/python-hyper/h2/master/examples/twisted/server.crt
744+
.. _get your private key here: https://raw.githubusercontent.com/python-hyper/h2/master/examples/twisted/server.key
745745
.. _PyOpenSSL: http://pyopenssl.readthedocs.org/
746-
.. _Eventlet example: https://github.com/python-hyper/hyper-h2/blob/master/examples/eventlet/eventlet-server.py
746+
.. _Eventlet example: https://github.com/python-hyper/h2/blob/master/examples/eventlet/eventlet-server.py

docs/source/curio-example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ example of how to build a concurrent networking framework using Python 3.5's
66
new ``async``/``await`` syntax.
77

88
This example is notable for demonstrating the correct use of HTTP/2 flow
9-
control with Hyper-h2. It is also a good example of the brand new syntax.
9+
control with h2. It is also a good example of the brand new syntax.
1010

1111
.. literalinclude:: ../../examples/curio/curio-server.py
1212
:language: python

0 commit comments

Comments
 (0)