pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat closed pull request #996: Add table listing supported Python versions
Date Thu, 01 Jan 1970 00:00:00 GMT
merlimat closed pull request #996: Add table listing supported Python versions
URL: https://github.com/apache/incubator-pulsar/pull/996
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/site/docs/latest/clients/Python.md b/site/docs/latest/clients/Python.md
index fb3bdbb72..9b36358e4 100644
--- a/site/docs/latest/clients/Python.md
+++ b/site/docs/latest/clients/Python.md
@@ -28,18 +28,28 @@ tags:
 
 The Pulsar Python client library is a wrapper over the existing [C++ client library](../Cpp)
and exposes all of the [same features](../../../../api/cpp). You can find the code in the
[`python` subdirectory]({{ site.pulsar_repo }}/pulsar-client-cpp/python) of the C++ client
code.
 
-
 ## Installation
 
-You can install the `pulsar-client` library either using [pip](https://pip.pypa.io/en/stable/)
or by building the library from source.
+You can install the [`pulsar-client`](https://pypi.python.org/pypi/pulsar-client) library
either via [PyPi](https://pypi.python.org/pypi), using [pip](#installation-using-pip), or
by building the library from source.
+
+### Installation using pip
 
-To install using pip:
+To install the `pulsar-client` library as a pre-built package using the [pip](https://pip.pypa.io/en/stable/)
package manager:
 
 ```shell
 $ pip install pulsar-client
 ```
 
-To install by building from source, follow the [instructions](../Cpp#compilation) and compile
the Pulsar C++ client library. That will also build the Python binding for the library.
+Installation via PyPi is available for the following Python versions:
+
+Platform | Supported Python versions
+:--------|:-------------------------
+MacOS 10.12 (Sierra) and 10.13 (High Sierra) | 2.7, 3.6
+Linux | 2.7, 3.3, 3.4, 3.5, 3.6
+
+### Installing from source
+
+To install the `pulsar-client` library by building from source, follow [these instructions](../Cpp#compilation)
and compile the Pulsar C++ client library. That will also build the Python binding for the
library.
 
 To install the built Python bindings:
 
@@ -49,11 +59,9 @@ $ cd pulsar/pulsar-client-cpp/python
 $ sudo python setup.py install
 ```
 
-{% include admonition.html type="info" content="Currently, the only supported Python version
is 2.7." %}
-
 ## API Reference
 
-The complete Python API reference is available at [api/python]({{site.baseUrl}}/api/python)
+The complete Python API reference is available at [api/python]({{site.baseUrl}}/api/python).
 
 ## Examples
 
@@ -61,15 +69,17 @@ Below you'll find a variety of Python code examples for the `pulsar-client`
libr
 
 ### Producer example
 
-This would create a Python {% popover producer %} for the `persistent://sample/standalone/ns/my-topic`
topic and send 10 messages on that topic:
+This creates a Python {% popover producer %} for the `persistent://sample/standalone/ns/my-topic`
topic and send 10 messages on that topic:
 
 ```python
 import pulsar
 
-client = pulsar.Client('pulsar://localhost:6650')
+TOPIC = 'persistent://sample/standalone/ns/my-topic'
+PULSAR_SERVICE_URL = 'pulsar://localhost:6650'
 
-producer = client.create_producer(
-                'persistent://sample/standalone/ns/my-topic')
+client = pulsar.Client(PULSAR_SERVICE_URL)
+
+producer = client.create_producer(TOPIC)
 
 for i in range(10):
     producer.send('Hello-%d' % i)
@@ -79,15 +89,12 @@ client.close()
 
 ### Consumer example
 
-This would create a {% popover consumer %} with the `my-sub` {% popover subscription %} on
the `persistent://sample/standalone/ns/my-topic` topic, listen for incoming messages, print
the content and ID of messages that arrive, and {% popover acknowledge %} each message to
the Pulsar {% popover broker %}:
+This creates a {% popover consumer %} with the `my-sub` {% popover subscription %} on the
`persistent://sample/standalone/ns/my-topic` topic, listen for incoming messages, print the
content and ID of messages that arrive, and {% popover acknowledge %} each message to the
Pulsar {% popover broker %}:
 
 ```python
-import pulsar
+SUBSCRIPTION = 'my-sub'
 
-client = pulsar.Client('pulsar://localhost:6650')
-consumer = client.subscribe(
-        'persistent://sample/standalone/ns/my-topic',
-        'my-sub')
+consumer = client.subscribe(TOPIC, SUBSCRIPTION)
 
 while True:
     msg = consumer.receive()
@@ -96,28 +103,3 @@ while True:
 
 client.close()
 ```
-
-### Async producer example
-
-This would create a Pulsar {% popover producer %} that sends messages asynchronously and
triggers the `send_callback` callback function whenever messages are {% popover acknowledged
%} by the {% popover broker %}:
-
-```python
-import pulsar
-
-client = pulsar.Client('pulsar://localhost:6650')
-
-producer = client.create_producer(
-                'persistent://sample/standalone/ns/my-topic',
-                block_if_queue_full=True,
-                batching_enabled=True,
-                batching_max_publish_delay_ms=10
-            )
-
-def send_callback(res, msg):
-    print('Message published res=%s', res)
-
-while True:
-    producer.send_async('Hello-%d' % i, send_callback)
-
-client.close()
-```


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message