From e59344568125147f0ccc421c13ddfeecb1a837b1 Mon Sep 17 00:00:00 2001 From: "Michael G. Noll" Date: Fri, 10 Jun 2016 15:27:01 +0200 Subject: [PATCH] Use consistent syntax highlighting (e.g. prefix commands with `$`) This commit updates README to be consistent with other CP documentation with regards to syntax highlights and code examples. --- README.md | 59 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 80b186b2c..23bf7ea12 100644 --- a/README.md +++ b/README.md @@ -17,33 +17,34 @@ Usage **Producer:** - from confluent_kafka import Producer +```python +from confluent_kafka import Producer - p = Producer({'bootstrap.servers': 'mybroker,mybroker2'}) - for data in some_data_source: - p.produce('mytopic', data.encode('utf-8')) - p.flush() +p = Producer({'bootstrap.servers': 'mybroker,mybroker2'}) +for data in some_data_source: + p.produce('mytopic', data.encode('utf-8')) +p.flush() +``` **High-level Consumer:** - from confluent_kafka import Consumer - - c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup', - 'default.topic.config': {'auto.offset.reset': 'smallest'}}) - c.subscribe(['mytopic']) - while running: - msg = c.poll() - if not msg.error(): - print('Received message: %s' % msg.value().decode('utf-8')) - c.close() - +```python +from confluent_kafka import Consumer +c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup', + 'default.topic.config': {'auto.offset.reset': 'smallest'}}) +c.subscribe(['mytopic']) +while running: + msg = c.poll() + if not msg.error(): + print('Received message: %s' % msg.value().decode('utf-8')) +c.close() +``` See [examples](examples) for more examples. - Prerequisites ============= @@ -51,28 +52,27 @@ Prerequisites * [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.1 - Install ======= **Install from PyPi:** - pip install confluent-kafka + $ pip install confluent-kafka **Install from source / tarball:** - pip install . + $ pip install . Build ===== - python setup.by build + $ python setup.by build If librdkafka is installed in a non-standard location provide the include and library directories with: - CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ... + $ CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ... Tests @@ -81,14 +81,14 @@ Tests **Run unit-tests:** - py.test + $ py.test -**NOTE**: Requires py.test, install by `pip install pytest` +**NOTE**: Requires `py.test`, install by `pip install pytest` **Run integration tests:** - examples/integration_test.py + $ examples/integration_test.py **WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'. @@ -99,13 +99,10 @@ Generate documentation ====================== Install sphinx and sphinx_rtd_theme packages and then: - make docs + $ make docs or: - python setup.by build_sphinx - - -Documentation will be generated in `docs/_build/` - + $ python setup.by build_sphinx +Documentation will be generated in `docs/_build/`.