{"id":23011487,"url":"https://github.com/bonitoo-io/ipython-flux","last_synced_at":"2025-08-14T06:31:57.800Z","repository":{"id":42977092,"uuid":"281421059","full_name":"bonitoo-io/ipython-flux","owner":"bonitoo-io","description":"Jupyter InfluxDB 2.0 Flux integration","archived":false,"fork":false,"pushed_at":"2022-11-06T20:50:09.000Z","size":917,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-26T20:45:35.963Z","etag":null,"topics":["flux","influxdb","ipython","jupyter","magic","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bonitoo-io.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-21T14:31:24.000Z","updated_at":"2024-03-10T14:27:08.000Z","dependencies_parsed_at":"2023-01-22T03:50:00.624Z","dependency_job_id":null,"html_url":"https://github.com/bonitoo-io/ipython-flux","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bonitoo-io/ipython-flux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonitoo-io%2Fipython-flux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonitoo-io%2Fipython-flux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonitoo-io%2Fipython-flux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonitoo-io%2Fipython-flux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bonitoo-io","download_url":"https://codeload.github.com/bonitoo-io/ipython-flux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonitoo-io%2Fipython-flux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270377433,"owners_count":24573409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flux","influxdb","ipython","jupyter","magic","python"],"created_at":"2024-12-15T10:09:07.409Z","updated_at":"2025-08-14T06:31:57.456Z","avatar_url":"https://github.com/bonitoo-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"============\nipython-flux\n============\n.. image:: https://circleci.com/gh/bonitoo-io/ipython-flux.svg?style=svg\n    :target: https://circleci.com/gh/bonitoo-io/ipython-flux\n\n:Author: Robert Hajek, Bonitoo.io\n\nIntroduces a %flux (or %%flux) magic.\n\nConnect to a InfluxDB and run Flux commands within IPython or IPython Notebook.\n\n.. image:: https://raw.github.com/bonitoo-io/ipython-flux/master/examples/example.png\n   :width: 600px\n   :alt: screenshot of ipython-flux in the Notebook\n\nExamples\n--------\n\n.. code-block:: python\n\n    In [1]: %load_ext flux\n\n    In [2]: %%flux http://localhost:9999 --token \"my-token\" --org my-org\n       ...: from(bucket: \"apm_metricset\")\n       ...:   |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n       ...:   |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"apm_metricset\")\n       ...:   |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"samples_system.process.cpu.total.norm.pct\")\n       ...:\n    Out[2]: ...\n\nAfter the first connection, connect info can be omitted::\n\n    In [3]: %flux\n       ...: from(bucket: \"apm_metricset\")\n       ...:   |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n       ...:   |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"apm_metricset\")\n       ...:   |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"samples_system.process.cpu.total.norm.pct\")\n\n    Out[8]: ...\n\n\nIf no connect string is supplied, ``%flux`` will use environment variables ``INFLUXDB_V2_URL``,\n``INFLUXDB_V2_ORG``, ``INFLUXDB_V2_TOKEN`` to create connection into InfluxDB.\n\nOrdinary IPython assignment works for single-line ``%flux`` queries:\n\n.. code-block:: python\n\n    In [12]: result = %flux from(bucket: \"my-bucket\")  |\u003e range(start: 0)\n\nThe ``\u003c\u003c`` operator captures query results in a local variable, and\ncan be used in multi-line ``%%flux``:\n\n.. code-block:: python\n\n    In [19]: %%flux my_dataset \u003c\u003c\n        ...: from(bucket: \"my-bucket\")\n        ...: |\u003e range(start: -30m)\n        ...: |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"cpu\")\n        ...: |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"usage_idle\" or r[\"_field\"] == \"usage_system\" or r[\"_field\"] == \"usage_user\")\n        ...: |\u003e filter(fn: (r) =\u003e r[\"cpu\"] == \"cpu-total\")\n        ...: |\u003e drop(columns: [\"_start\", \"_stop\", \"_result\", \"_measurement\", \"table\", \"_result\"])\n        ...: |\u003e pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n\n\nThe result of the Flux command is automatically converted into Pandas dataframe. It is often useful to use Flux\nfunctions ``fieldsAsCol()`` or ``pivot()`` to convert data containing multiple timeseries into one dataset.\n\nPersist dataframe\n-----------------\n\nThe ``--persist`` argument, with the name of a DataFrame object in memory will create a measurement\nin the database from the named DataFrame.  \n\n.. code-block:: python\n\n    In [1]: %flux --persist \u003cdata_frame_variable_name\u003e --bucket my-bucket --measurement \u003cnew measurement name\u003e --tags tag_column1,tag_column2\n\n.. _Pandas: http://pandas.pydata.org/\n\nOptions\n-------\n\n``-l`` / ``--connections``\n    List all active connections\n\n``-t`` / ``--token``\n    InfluxDB token\n\n\n``-o`` / ``--org``\n    InfluxDB org\n\n``--timeout``\n    InfluxDB query timeout in milliseconds (default timeout is 10_000 ms)\n\n``-f`` / ``--file \u003cpath\u003e``\n    Run Flux from file at this path\n\n``-x`` / ``--close \u003csession-name\u003e`` \n    Close named connection \n\nPersist options\n---------------\n\n``-p`` / ``--persist``\n    Create a measurement in the database from the named DataFrame\n\n``-b`` / ``--bucket``\n    target bucket name\n\n``-T`` / ``--tags``\n    comma separated list of columns that will be stored as tags, rest of columns will be stored as fields\n\n``-m`` / ``--measurement``\n    optional, target measurement name, if not specified measurement is taken from dataframe name\n\nInstalling\n----------\n\nInstall the lastest release with::\n\n    pip install ipython-flux\n\nor download from https://github.com/bonitoo-io/ipython-flux and::\n\n    cd ipython-flux\n    sudo python setup.py install\n\nEnable IPython flux magic extension in Jupyter notebook using\n\n.. code-block:: python\n\n    In [1]: %load_ext flux\n\nDevelopment\n-----------\n\nhttps://github.com/bonitoo-io/ipython-flux\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonitoo-io%2Fipython-flux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbonitoo-io%2Fipython-flux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonitoo-io%2Fipython-flux/lists"}