merlimat closed pull request #1763: Document Python dependencies
URL: https://github.com/apache/incubator-pulsar/pull/1763
 
 
   

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/_data/deps.yaml b/site/_data/deps.yaml
new file mode 100644
index 0000000000..3717736c31
--- /dev/null
+++ b/site/_data/deps.yaml
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+- pulsar-client
+- protobuf
+- futures
+- grpcio
+- grpcio-tools
\ No newline at end of file
diff --git a/site/_includes/python-deps.html b/site/_includes/python-deps.html
new file mode 100644
index 0000000000..e7f7d29bdf
--- /dev/null
+++ b/site/_includes/python-deps.html
@@ -0,0 +1,29 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<ul>
+  {% for dep in site.data.deps %}
+  <li>
+    <a href="https://pypi.org/project/{{ dep }}">
+      <code>{{ dep }}</code>
+    </a>
+  </li>
+  {% endfor %}
+</ul>
\ No newline at end of file
diff --git a/site/docs/latest/functions/api.md 
b/site/docs/latest/functions/api.md
index 4f92012886..c9105f533e 100644
--- a/site/docs/latest/functions/api.md
+++ b/site/docs/latest/functions/api.md
@@ -506,14 +506,15 @@ Writing Pulsar Functions in Python entails implementing 
one of two things:
 
 ### Getting started
 
-The requirements for writing Pulsar Functions in Python depend on your 
[deployment mode](../deployment):
+Regardless of which [deployment mode](../deployment) you're using, you'll need 
to install the following Python libraries on any machine that's running Pulsar 
Functions written in Python:
 
-* If you're writing a [Python native function](#python-native), you won't need 
to install any external dependencies
-* If you're writing a [Python SDK function](#python-sdk), you'll need to 
install the the [`pulsar-client`](/api/python) Python library.
+{% include python-deps.html %}
 
-  ```bash
-  $ pip install pulsar-client=={{ site.python_latest }}
-  ```
+That could be your local machine for [local run mode](../deployment#local-run) 
or a machine running a Pulsar {% popover broker %} for [cluster 
mode](../deployment#cluster-mode). To install those libraries using pip:
+
+```bash
+$ pip install {% for dep in site.data.deps %}{% if forloop.last %}{{ dep }}{% 
else %}{{ dep }} {% endif %}{% endfor %}
+```
 
 ### Packaging
 
diff --git a/site/docs/latest/functions/quickstart.md 
b/site/docs/latest/functions/quickstart.md
index 2b6eed4f44..ea51029782 100644
--- a/site/docs/latest/functions/quickstart.md
+++ b/site/docs/latest/functions/quickstart.md
@@ -212,6 +212,14 @@ If you see `Deleted successfully` in the output, then 
you've succesfully run, up
 
 ## Writing and running a new function
 
+{% include admonition.html type="info" content="
+In order to write and run the [Python](../api#python) function below, you'll 
need to install a few dependencies:
+
+```bash
+$ pip install pulsar-client protobuf futures grpcio grpcio-tools
+```
+" %}
+
 In the above examples, we ran and managed a pre-written Pulsar Function and 
saw how it worked. To really get our hands dirty, let's write and our own 
function from scratch, using the Python API. This simple function will also 
take a string as input but it will reverse the string and publish the 
resulting, reversed string to the specified topic.
 
 First, create a new Python file:


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to