Skip to content

Commit bac56bd

Browse files
authored
Prepared initial version Sphynx documentation, project cleanup (#18)
* refactoring package name * added initial documentation, examples * temporary fix status issue influxdata/influxdb#15274
1 parent ce81899 commit bac56bd

23 files changed

+5612
-82
lines changed

.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build:
2+
image: latest
3+
python:
4+
version: 3.6
5+
pip_install: true
6+
extra_requirements:
7+
- docs

README.rst

Lines changed: 81 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
influxdb-client-python
32
======================
43

4+
.. marker-index-start
55
66
.. image:: https://circleci.com/gh/influxdata/influxdb-client-python.svg?style=svg
77
:target: https://circleci.com/gh/influxdata/influxdb-client-python
@@ -12,48 +12,72 @@ influxdb-client-python
1212
:target: https://codecov.io/gh/influxdata/influxdb-client-python
1313
:alt: codecov
1414

15+
.. image:: https://img.shields.io/circleci/project/github/influxdata/influxdb-client-python/master.svg
16+
:target: https://circleci.com/gh/influxdata/influxdb-client-python
17+
:alt: CI status
1518

16-
InfluxDB 2.0 python client library.
17-
18-
19-
* `Requirements <#requirements>`_
20-
* `Getting Started <#getting-started>`_
21-
* `Features <#how-to-use>`_
22-
23-
* `Writing data <#writes>`_
24-
* `How to efficiently import large dataset <#how-to-efficiently-import-large-dataset>`_
25-
* `Efficiency write data from IOT sensor <#efficiency-write-data-from-iot-sensor>`_
26-
27-
* `Advanced Usage <#advanced-usage>`_
28-
29-
* `Gzip support <#gzip-support>`_
30-
31-
* InfluxDB 2.0 API client (generated from swagger)
32-
33-
* Bucket
34-
* Organizations
35-
* Authorizations
36-
* Labels
37-
* Tasks
38-
39-
Requirements
19+
.. image:: https://img.shields.io/codecov/c/github/influxdata/influxdb-client-python.svg
20+
:target: https://codecov.io/gh/influxdata/influxdb-client-python
21+
:alt: Coverage
22+
23+
.. image:: https://img.shields.io/pypi/v/influxdb-client-python.svg
24+
:target: https://pypi.python.org/pypi/influxdb-client-python
25+
:alt: PyPI package
26+
27+
.. image:: https://img.shields.io/pypi/pyversions/influxdb-client-python.svg
28+
:target: https://pypi.python.org/pypi/influxdb-client-python
29+
:alt: Supported Python versions
30+
31+
.. image:: https://readthedocs.org/projects/influxdb-client/badge/?version=latest
32+
:target: https://influxdb-client.readthedocs.io/en/stable/?badge=latest
33+
:alt: Documentation status
34+
35+
InfluxDB 2.0 python client library. The library covers InfluxDB 2.0
36+
37+
InfluxDB 2.0 client features
38+
----------------------------
39+
40+
- Querying data
41+
- using the Flux language
42+
- into csv, raw data, `flux_table <https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/flux_table.py#L5>`_ structure
43+
- Writing data using
44+
- `Line Protocol <https://docs.influxdata.com/influxdb/v1.6/write_protocols/line_protocol_tutorial>`_
45+
- `Data Point <https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/point.py#L16>`_
46+
- `RxPY`_ Observable
47+
- Not implemented yet
48+
- write user types using decorator
49+
- write Pandas DataFrame
50+
- `InfluxDB 2.0 API <https://github.com/influxdata/influxdb/blob/master/http/swagger.yml>`_ client for management
51+
- the client is generated from `swagger <https://github.com/influxdata/influxdb/blob/master/http/swagger.yml>`_ by using `openapi-generator <https://github.com/OpenAPITools/openapi-generator>`_
52+
- organizations & users management
53+
- buckets management
54+
- tasks management
55+
- authorizations
56+
- health check
57+
58+
Installation
4059
------------
60+
.. marker-install-start
61+
62+
InfluxDB python library uses `RxPY <https://github.com/ReactiveX/RxPY>`_ - The Reactive Extensions for Python (RxPY).
4163

42-
Python 3.6+
64+
**Python 3.6** or later is required.
4365

44-
Installation & Usage
45-
--------------------
4666

4767
pip install
4868
^^^^^^^^^^^
4969

50-
If the python package is hosted on Github, you can install directly from Github
70+
If the python package is hosted on Github, you can install latest version directly from Github
5171

5272
.. code-block:: sh
5373
54-
pip install git+https://github.com/influxdata/influxdb-client-python.git
74+
pip3 install git+https://github.com/influxdata/influxdb-client-python.git
75+
76+
(you may need to run ``pip`` with root permission:
5577

56-
(you may need to run ``pip`` with root permission: ``sudo pip install git+https://github.com/influxdata/influxdb-client-python.git``\ )
78+
.. code-block:: sh
79+
80+
sudo pip3 install git+https://github.com/influxdata/influxdb-client-python.git
5781
5882
Then import the package:
5983

@@ -78,10 +102,14 @@ Then import the package:
78102
79103
import influxdb_client
80104
105+
.. marker-install-end
106+
81107
Getting Started
82108
---------------
83109

84-
Please follow the `installation procedure <#installation--usage>`_ and then run the following:
110+
Please follow the `installation procedure <#installation>`_ and then run the following:
111+
112+
.. marker-query-start
85113
86114
.. code-block:: python
87115
@@ -115,19 +143,26 @@ Please follow the `installation procedure <#installation--usage>`_ and then run
115143
for cell in row:
116144
val_count += 1
117145
146+
.. marker-query-end
147+
.. marker-index-end
148+
149+
118150
How to use
119151
----------
120152

121153
Writes
122154
^^^^^^
155+
.. marker-writes-start
123156
124157
The `WriteApi <https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api.py>`_ supports synchronous, asynchronous and batching writes into InfluxDB 2.0.
125158
The data should be passed as a `InfluxDB Line Protocol <https://docs.influxdata.com/influxdb/v1.6/write_protocols/line_protocol_tutorial/>`_\ , `Data Point <https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/point.py>`_ or Observable stream.
126159

127160
*The default instance of ``WriteApi`` use batching.*
128161

129162
Batching
130-
~~~~~~~~
163+
""""""""
164+
165+
.. marker-batching-start
131166
132167
The batching is configurable by ``write_options``\ :
133168

@@ -195,6 +230,8 @@ The batching is configurable by ``write_options``\ :
195230
_write_client.__del__()
196231
_client.__del__()
197232
233+
.. marker-batching-end
234+
198235
Asynchronous client
199236
"""""""""""""""""""
200237

@@ -230,7 +267,7 @@ Data are writes in a synchronous HTTP request.
230267
client.__del__()
231268
232269
How to efficiently import large dataset
233-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270+
"""""""""""""""""""""""""""""""""""""""
234271

235272

236273
* sources - `import_data_set.py <https://github.com/influxdata/influxdb-client-python/blob/master/tests/import_data_set.py>`_
@@ -323,9 +360,12 @@ How to efficiently import large dataset
323360
"""
324361
client.__del__()
325362
326-
Efficiency write data from IOT sensor
327-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
363+
.. marker-writes-end
364+
328365
366+
Efficiency write data from IOT sensor
367+
"""""""""""""""""""""""""""""""""""""
368+
.. marker-iot-start
329369
330370
* sources - `iot_sensor.py <https://github.com/influxdata/influxdb-client-python/blob/master/tests/iot_sensor.py>`_
331371

@@ -408,11 +448,14 @@ Efficiency write data from IOT sensor
408448
409449
input()
410450
451+
.. marker-iot-end
452+
411453
Advanced Usage
412454
--------------
413455

414456
Gzip support
415457
^^^^^^^^^^^^
458+
.. marker-gzip-start
416459
417460
``InfluxDBClient`` does not enable gzip compress for http request by default. If you want to enable gzip to reduce transfer data's size, you can call:
418461

@@ -421,3 +464,5 @@ Gzip support
421464
from influxdb_client import InfluxDBClient
422465
423466
_db_client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", enable_gzip=True)
467+
468+
.. marker-gzip-end

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = influxdb_client
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/custom.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.wy-table-responsive table td {
2+
white-space: normal;
3+
}

0 commit comments

Comments
 (0)