This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push: new e6bcae5 Document Python dependencies (#1763) e6bcae5 is described below commit e6bcae5428a122a2fcd51f59731191eff1712ecb Author: Luc Perkins <lucperk...@gmail.com> AuthorDate: Thu May 17 16:30:12 2018 -0700 Document Python dependencies (#1763) * add installation instructions for Python libs * update list of python dependencies * add pulsar-client lib to deps list * add missing license headers * add missing line to deps.yaml file under license header --- site/_data/deps.yaml | 24 ++++++++++++++++++++++++ site/_includes/python-deps.html | 29 +++++++++++++++++++++++++++++ site/docs/latest/functions/api.md | 13 +++++++------ site/docs/latest/functions/quickstart.md | 8 ++++++++ 4 files changed, 68 insertions(+), 6 deletions(-) diff --git a/site/_data/deps.yaml b/site/_data/deps.yaml new file mode 100644 index 0000000..3717736 --- /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 0000000..e7f7d29 --- /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 4f92012..c9105f5 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 2b6eed4..ea51029 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: -- To stop receiving notification emails like this one, please contact mme...@apache.org.