This is an automated email from the ASF dual-hosted git repository.
ianmcook pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-experiments.git
The following commit(s) were added to refs/heads/main by this push:
new b3630b4 Reorganize Python examples (#36)
b3630b4 is described below
commit b3630b4f41f59f23a85a517013c86e6020fc1b23
Author: Ian Cook <[email protected]>
AuthorDate: Wed Sep 11 07:37:51 2024 -0700
Reorganize Python examples (#36)
---
http/get_simple/python/client/README.md | 11 ++---------
.../python/client/{ => urllib.request}/README.md | 4 ++--
.../python/client/{ => urllib.request}/client.py | 0
http/get_simple/python/server/README.md | 14 ++------------
http/get_simple/python/server/{ => http.server}/README.md | 6 +++---
http/get_simple/python/server/{ => http.server}/server.py | 0
6 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/http/get_simple/python/client/README.md
b/http/get_simple/python/client/README.md
index d794968..f7c852a 100644
--- a/http/get_simple/python/client/README.md
+++ b/http/get_simple/python/client/README.md
@@ -17,16 +17,9 @@
under the License.
-->
-# HTTP GET Arrow Data: Simple Python Client Example
+# HTTP GET Arrow Data: Simple Python Client Examples
-This directory contains a minimal example of an HTTP client implemented in
Python. The client:
+This directory contains minimal examples of HTTP clients implemented in Python
using various libraries. Each of these clients:
1. Sends an HTTP GET request to a server.
2. Receives an HTTP 200 response from the server, with the response body
containing an Arrow IPC stream of record batches.
3. Adds the record batches to a list as they are received.
-
-To run this example, first start one of the server examples in the parent
directory, then:
-
-```sh
-pip install pyarrow
-python client.py
-```
diff --git a/http/get_simple/python/client/README.md
b/http/get_simple/python/client/urllib.request/README.md
similarity index 85%
copy from http/get_simple/python/client/README.md
copy to http/get_simple/python/client/urllib.request/README.md
index d794968..f43884f 100644
--- a/http/get_simple/python/client/README.md
+++ b/http/get_simple/python/client/urllib.request/README.md
@@ -17,9 +17,9 @@
under the License.
-->
-# HTTP GET Arrow Data: Simple Python Client Example
+# HTTP GET Arrow Data: Simple Python Client Example with `urllib.request`
-This directory contains a minimal example of an HTTP client implemented in
Python. The client:
+This directory contains a minimal example of an HTTP client implemented in
Python using the built-in
[`urllib.request`](https://docs.python.org/3/library/urllib.request.html)
module. The client:
1. Sends an HTTP GET request to a server.
2. Receives an HTTP 200 response from the server, with the response body
containing an Arrow IPC stream of record batches.
3. Adds the record batches to a list as they are received.
diff --git a/http/get_simple/python/client/client.py
b/http/get_simple/python/client/urllib.request/client.py
similarity index 100%
rename from http/get_simple/python/client/client.py
rename to http/get_simple/python/client/urllib.request/client.py
diff --git a/http/get_simple/python/server/README.md
b/http/get_simple/python/server/README.md
index c0b48b0..5de7c20 100644
--- a/http/get_simple/python/server/README.md
+++ b/http/get_simple/python/server/README.md
@@ -17,19 +17,9 @@
under the License.
-->
-# HTTP GET Arrow Data: Simple Python Server Example
+# HTTP GET Arrow Data: Simple Python Server Examples
-This directory contains a minimal example of an HTTP server implemented in
Python. The server:
+This directory contains minimal examples of HTTP servers implemented in Python
using various libraries. Each of these servers:
1. Creates a list of record batches and populates it with synthesized data.
2. Listens for HTTP GET requests from clients.
3. Upon receiving a request, sends an HTTP 200 response with the body
containing an Arrow IPC stream of record batches.
-
-To run this example:
-
-```sh
-pip install pyarrow
-python server.py
-```
-
-> [!NOTE]
-> This example uses Python's built-in
[`http.server`](https://docs.python.org/3/library/http.server.html) module.
This allows us to implement [chunked transfer
encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) manually.
Other servers may implement chunked transfer encoding automatically at the cost
of an undesirable new layer of buffering. Arrow IPC streams already offer a
natural way of chunking large amounts of tabular data. It's not a general
requirement, but in this [...]
diff --git a/http/get_simple/python/server/README.md
b/http/get_simple/python/server/http.server/README.md
similarity index 65%
copy from http/get_simple/python/server/README.md
copy to http/get_simple/python/server/http.server/README.md
index c0b48b0..1d923ae 100644
--- a/http/get_simple/python/server/README.md
+++ b/http/get_simple/python/server/http.server/README.md
@@ -17,9 +17,9 @@
under the License.
-->
-# HTTP GET Arrow Data: Simple Python Server Example
+# HTTP GET Arrow Data: Simple Python Server Example with `http.server`
-This directory contains a minimal example of an HTTP server implemented in
Python. The server:
+This directory contains a minimal example of an HTTP server implemented in
Python using the built-in
[`http.server`](https://docs.python.org/3/library/http.server.html) module. The
server:
1. Creates a list of record batches and populates it with synthesized data.
2. Listens for HTTP GET requests from clients.
3. Upon receiving a request, sends an HTTP 200 response with the body
containing an Arrow IPC stream of record batches.
@@ -32,4 +32,4 @@ python server.py
```
> [!NOTE]
-> This example uses Python's built-in
[`http.server`](https://docs.python.org/3/library/http.server.html) module.
This allows us to implement [chunked transfer
encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) manually.
Other servers may implement chunked transfer encoding automatically at the cost
of an undesirable new layer of buffering. Arrow IPC streams already offer a
natural way of chunking large amounts of tabular data. It's not a general
requirement, but in this [...]
+> This example implements [chunked transfer
encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) manually.
Other servers may implement chunked transfer encoding automatically at the cost
of an undesirable new layer of buffering. Arrow IPC streams already offer a
natural way of chunking large amounts of tabular data. It's not a general
requirement, but in this example each chunk corresponds to one Arrow record
batch.
diff --git a/http/get_simple/python/server/server.py
b/http/get_simple/python/server/http.server/server.py
similarity index 100%
rename from http/get_simple/python/server/server.py
rename to http/get_simple/python/server/http.server/server.py