Fixed missed version of zlib (#17)

2 files changed
tree: 7d60f6c8502fa2f2152410888046f14eabdb2120
  1. .github/
  2. build-support/
  3. cmake_modules/
  4. examples/
  5. pkg/
  6. pulsar/
  7. src/
  8. tests/
  9. .asf.yaml
  10. .clang-format
  11. .gitignore
  12. CMakeLists.txt
  13. CONTRIBUTING.md
  14. dependencies.yaml
  15. LICENSE
  16. NOTICE
  17. pulsar-client-cpp-version.txt
  18. README.md
  19. SECURITY.md
  20. setup.py
  21. version.txt
README.md

Pulsar Python client library

Requirements

Install the Python wheel

cmake -B build
cmake --build build -j8
cp build/_pulsar.so .
./setup.py bdist_wheel
pip3 install dist/pulsar_client-*.whl --force-reinstall
rm _pulsar.so

NOTE

  1. Here a separate build directory is created to store all CMake temporary files. However, the setup.py requires the _pulsar.so is under the project directory.
  2. Add the --force-reinstall option to overwrite the existing Python wheel in case your system has already installed a wheel before.

You can run python3 -c 'import pulsar' to see whether the wheel has been installed successfully. If it failed, check whether dependencies (e.g. libpulsar.so) are in the system path. If not, make sure the dependencies are in LD_LIBRARY_PATH (on Linux) or DYLD_LIBRARY_PATH (on macOS).

Then you can run examples as a simple end-to-end test.

# In terminal 1
python3 ./examples/consumer.py
# In terminal 2
python3 ./examples/producer.py

Before executing the commands above, you must ensure the Pulsar service is running. See here for quick start.

Unit tests

Before running the unit tests, you must run a Pulsar service with all things set up:

./build-support/pulsar-test-service-start.sh

The command above runs a Pulsar standalone in a Docker container. You can run ./build-support/pulsar-test-service-stop.sh to stop it.

Run all unit tests:

./tests/run-unit-tests.sh

Run a single unit test (e.g. PulsarTest.test_tls_auth):

python3 ./tests/pulsar_test.py 'PulsarTest.test_tls_auth'