python-openobserve 0.5.0__tar.gz → 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-openobserve
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: OpenObserve client for Python
5
5
  License-File: LICENSES/CC-BY-4.0.txt
6
6
  License-File: LICENSES/CC-BY-SA-4.0.txt
@@ -8,41 +8,42 @@ License-File: LICENSES/GPL-3.0-or-later.txt
8
8
  Keywords: openobserve,elasticsearch,logging,unstructured data
9
9
  Author: Justin Guese
10
10
  Author-email: guese.justin@gmail.com
11
- Requires-Python: >=3.10,<3.14
11
+ Requires-Python: >=3.10,<3.15
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Provides-Extra: ci
14
14
  Provides-Extra: docs
15
- Provides-Extra: fireducks
16
15
  Provides-Extra: pandas
17
16
  Provides-Extra: polars
18
17
  Provides-Extra: tests
19
- Requires-Dist: cryptography (>=46.0.5)
20
- Requires-Dist: fireducks (==1.4.4) ; extra == "fireducks"
21
- Requires-Dist: guarddog (==2.7.1) ; extra == "ci"
18
+ Requires-Dist: cryptography (>=50.0.0,<50.1.0)
19
+ Requires-Dist: h11 (>=0.16.0,<0.17.0)
20
+ Requires-Dist: httpcore (>=1.0.9,<1.1.0)
22
21
  Requires-Dist: httpx (>=0.28,<1.0)
23
- Requires-Dist: jmespath (==1.0.1) ; extra == "ci"
24
- Requires-Dist: jmespath (==1.0.1) ; extra == "tests"
25
- Requires-Dist: memray (==1.17.2) ; extra == "ci"
22
+ Requires-Dist: jmespath (==1.1.0) ; extra == "ci"
23
+ Requires-Dist: jmespath (==1.1.0) ; extra == "tests"
24
+ Requires-Dist: memray (==1.20.0) ; extra == "ci"
26
25
  Requires-Dist: mkdocs (==1.6.1) ; extra == "docs"
27
- Requires-Dist: mkdocs-material (==9.6.15) ; extra == "docs"
28
- Requires-Dist: mkdocstrings (==0.29.1) ; extra == "docs"
29
- Requires-Dist: mypy (==1.15.0) ; extra == "ci"
30
- Requires-Dist: mypy-extensions (==1.0.0) ; extra == "ci"
31
- Requires-Dist: pandas (==2.2.3) ; extra == "ci"
26
+ Requires-Dist: mkdocs-material (==9.7.7) ; extra == "docs"
27
+ Requires-Dist: mkdocstrings (==0.30.1) ; extra == "docs"
28
+ Requires-Dist: mypy (==1.20.2) ; extra == "ci"
29
+ Requires-Dist: mypy-extensions (==1.1.0) ; extra == "ci"
30
+ Requires-Dist: pandas (==2.3.3) ; extra == "ci"
32
31
  Requires-Dist: pandas (>=2.2) ; extra == "pandas"
33
- Requires-Dist: pandas-stubs (==2.2.2.240807) ; extra == "ci"
34
- Requires-Dist: polars (==1.30.0) ; extra == "polars"
35
- Requires-Dist: protobuf (>=6.33.5)
32
+ Requires-Dist: pandas-stubs (==2.3.3.260113) ; extra == "ci"
33
+ Requires-Dist: polars (==1.43.2) ; extra == "polars"
34
+ Requires-Dist: protobuf (>=7.35.1)
36
35
  Requires-Dist: pydantic (>=2.10,<3.0)
37
- Requires-Dist: pytest (==8.3.5) ; extra == "ci"
38
- Requires-Dist: pytest (==8.3.5) ; extra == "tests"
39
- Requires-Dist: pytest-cov (==6.0.0) ; extra == "ci"
40
- Requires-Dist: pytest-memray (==1.7.0) ; extra == "ci"
41
- Requires-Dist: python-dotenv (==1.0.1) ; extra == "ci"
42
- Requires-Dist: python-dotenv (==1.0.1) ; extra == "tests"
36
+ Requires-Dist: pyjwt (>=2.12.1,<3.0.0)
37
+ Requires-Dist: pytest (==9.1.1) ; extra == "ci"
38
+ Requires-Dist: pytest (==9.1.1) ; extra == "tests"
39
+ Requires-Dist: pytest-cov (==6.3.0) ; extra == "ci"
40
+ Requires-Dist: pytest-memray (==1.10.0) ; extra == "ci"
41
+ Requires-Dist: python-dotenv (==1.2.2) ; extra == "ci"
42
+ Requires-Dist: python-dotenv (==1.2.2) ; extra == "tests"
43
43
  Requires-Dist: python-multipart (>=0.0.22)
44
- Requires-Dist: sqlglot (>=26.4.0,<26.5.0)
45
- Requires-Dist: types-jmespath (==1.0.2.20240106) ; extra == "ci"
44
+ Requires-Dist: requests (>=2.33.0,<3.0.0)
45
+ Requires-Dist: sqlglot (>=26.33.0,<26.34.0)
46
+ Requires-Dist: types-jmespath (==1.1.0.20260724) ; extra == "ci"
46
47
  Project-URL: Homepage, https://github.com/JustinGuese/python-openobserve
47
48
  Project-URL: Repository, https://github.com/JustinGuese/python-openobserve
48
49
  Description-Content-Type: text/markdown
@@ -56,6 +57,7 @@ Description-Content-Type: text/markdown
56
57
 
57
58
  [![Actions Status - Main](https://github.com/JustinGuese/python-openobserve/workflows/pytest/badge.svg)](https://github.com/JustinGuese/python-openobserve/actions?query=branch%3Amain)
58
59
  [![PyPI Downloads](https://static.pepy.tech/badge/python-openobserve/week)](https://pepy.tech/projects/python-openobserve)
60
+ <!-- markdown-link-check-disable-next-line -->
59
61
  [![Documentation build status](https://img.shields.io/readthedocs/python-openobserve?logo=read-the-docs)](https://python-openobserve.readthedocs.org/en/latest/)
60
62
  [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JustinGuese/python-openobserve/badge)](https://scorecard.dev/viewer/?uri=github.com/JustinGuese/python-openobserve)
61
63
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  [![Actions Status - Main](https://github.com/JustinGuese/python-openobserve/workflows/pytest/badge.svg)](https://github.com/JustinGuese/python-openobserve/actions?query=branch%3Amain)
9
9
  [![PyPI Downloads](https://static.pepy.tech/badge/python-openobserve/week)](https://pepy.tech/projects/python-openobserve)
10
+ <!-- markdown-link-check-disable-next-line -->
10
11
  [![Documentation build status](https://img.shields.io/readthedocs/python-openobserve?logo=read-the-docs)](https://python-openobserve.readthedocs.org/en/latest/)
11
12
  [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JustinGuese/python-openobserve/badge)](https://scorecard.dev/viewer/?uri=github.com/JustinGuese/python-openobserve)
12
13
 
@@ -3,10 +3,10 @@
3
3
 
4
4
  [project]
5
5
  name = "python-openobserve"
6
- version = "0.5.0"
6
+ version = "0.5.2"
7
7
  description = "OpenObserve client for Python"
8
8
  readme = "README.md"
9
- requires-python = ">=3.10,<3.14"
9
+ requires-python = ">=3.10,<3.15"
10
10
  license-files = [
11
11
  "LICENSES/CC-BY-4.0.txt",
12
12
  "LICENSES/CC-BY-SA-4.0.txt",
@@ -19,12 +19,16 @@ classifiers = [
19
19
  ]
20
20
 
21
21
  dependencies = [
22
- "cryptography>=46.0.5",
22
+ "cryptography (>=50.0.0,<50.1.0)",
23
+ "h11~=0.16.0",
24
+ "httpcore~=1.0.9",
23
25
  "httpx~=0.28",
24
- "protobuf>=6.33.5",
26
+ "protobuf>=7.35.1",
25
27
  "pydantic~=2.10",
26
28
  "python-multipart>=0.0.22",
27
- "sqlglot~=26.4.0",
29
+ "sqlglot~=26.33.0",
30
+ "pyjwt (>=2.12.1,<3.0.0)",
31
+ "requests (>=2.33.0,<3.0.0)",
28
32
  ]
29
33
 
30
34
  [project.urls]
@@ -36,61 +40,56 @@ python_openobserve = "python_openobserve:openobserve"
36
40
 
37
41
  [project.optional-dependencies]
38
42
  ci = [
39
- "jmespath==1.0.1",
40
- "memray==1.17.2",
41
- "pytest-memray==1.7.0",
42
- "mypy==1.15.0",
43
- "mypy-extensions==1.0.0",
44
- "pandas==2.2.3",
45
- "pandas-stubs==2.2.2.240807",
46
- "pytest==8.3.5",
47
- "pytest-cov==6.0.0",
48
- "python-dotenv==1.0.1",
49
- "types-jmespath==1.0.2.20240106",
50
- "guarddog==2.7.1",
43
+ "jmespath==1.1.0",
44
+ "memray==1.20.0",
45
+ "pytest-memray==1.10.0",
46
+ "mypy==1.20.2",
47
+ "mypy-extensions==1.1.0",
48
+ "pandas==2.3.3",
49
+ "pandas-stubs==2.3.3.260113",
50
+ "pytest==9.1.1",
51
+ "pytest-cov==6.3.0",
52
+ "python-dotenv==1.2.2",
53
+ "types-jmespath==1.1.0.20260724",
51
54
  ]
52
55
  docs = [
53
56
  "mkdocs==1.6.1",
54
- "mkdocs-material==9.6.15",
55
- "mkdocstrings==0.29.1",
57
+ "mkdocs-material==9.7.7",
58
+ "mkdocstrings==0.30.1",
56
59
  ]
57
- tests = ["pytest==8.3.5", "jmespath==1.0.1", "python-dotenv==1.0.1"]
60
+ tests = ["pytest==9.1.1", "jmespath==1.1.0", "python-dotenv==1.2.2"]
58
61
  pandas = ["pandas>=2.2"]
59
- polars = ["polars==1.30.0"]
60
- fireducks = ["fireducks==1.4.4"]
62
+ polars = ["polars==1.43.2"]
61
63
 
62
64
  [tool.poetry.group.test.dependencies]
63
- pytest = "8.3.5"
64
- jmespath = "1.0.1"
65
- python-dotenv = "1.0.1"
65
+ pytest = "9.1.1"
66
+ jmespath = "1.1.0"
67
+ python-dotenv = "1.2.2"
66
68
 
67
69
  [tool.poetry.group.docs.dependencies]
68
70
  mkdocs = "1.6.1"
69
- mkdocs-material = "9.6.15"
70
- mkdocstrings = "0.29.1"
71
+ mkdocs-material = "9.7.7"
72
+ mkdocstrings = "0.30.1"
71
73
 
72
74
  [tool.poetry.group.ci.dependencies]
73
- jmespath = "1.0.1"
74
- memray = "1.17.2"
75
- pytest-memray = "1.7.0"
76
- mypy = "1.15.0"
77
- mypy-extensions = "1.0.0"
78
- pandas = "2.2.3"
75
+ jmespath = "1.1.0"
76
+ memray = "1.20.0"
77
+ pytest-memray = "1.10.0"
78
+ mypy = "1.20.2"
79
+ mypy-extensions = "1.1.0"
80
+ pandas = "2.3.3"
79
81
  openpyxl = "3.1.5"
80
- pandas-stubs = "2.2.2.240807"
81
- pytest = "8.3.5"
82
- pytest-cov = "6.0.0"
83
- python-dotenv = "1.0.1"
84
- types-jmespath = "1.0.2.20240106"
85
- guarddog = "2.7.1"
82
+ pandas-stubs = "2.3.3.260113"
83
+ pytest = "9.1.1"
84
+ pytest-cov = "6.3.0"
85
+ python-dotenv = "1.2.2"
86
+ types-jmespath = "1.1.0.20260724"
86
87
 
87
88
  [tool.poetry.group.pandas.dependencies]
88
89
  pandas = ">2.2"
89
90
 
90
91
  [tool.poetry.group.polars.dependencies]
91
- polars = "1.30.0"
92
- [tool.poetry.group.fireducks.dependencies]
93
- fireducks = "1.4.4"
92
+ polars = "1.43.2"
94
93
 
95
94
  [build-system]
96
95
  requires = ["poetry-core"]
@@ -19,7 +19,7 @@ from datetime import datetime
19
19
  from typing import List, Dict, Union, Optional, Any, cast
20
20
  from pathlib import Path
21
21
 
22
- import httpx
22
+ import httpx # type: ignore
23
23
  import sqlglot # type: ignore
24
24
 
25
25
  try:
@@ -33,21 +33,13 @@ except ImportError:
33
33
  HAVE_MODULE_PANDAS = False
34
34
 
35
35
  try:
36
- import polars
36
+ import polars # type: ignore
37
37
 
38
38
  HAVE_MODULE_POLARS = True
39
39
  except ImportError:
40
40
  print("Can't import polars. some functions may be unavailable.")
41
41
  HAVE_MODULE_POLARS = False
42
42
 
43
- try:
44
- import fireducks # type: ignore
45
-
46
- HAVE_MODULE_FIREDUCKS = True
47
- except ImportError:
48
- print("Can't import fireducks. Some functions may be unavailable.")
49
- HAVE_MODULE_FIREDUCKS = False
50
-
51
43
  key_mapping = {
52
44
  "dashboards": "dashboards",
53
45
  "users": "data",
@@ -223,10 +215,10 @@ class OpenObserve:
223
215
  )
224
216
  response_json = self._handle_response(res, "index")
225
217
 
226
- if response_json["status"][0]["failed"] > 0: # type:ignore[call-overload]
218
+ if response_json["status"][0]["failed"] > 0: # type: ignore[call-overload]
227
219
  raise Exception(
228
220
  "Openobserve index failed. "
229
- f"{response_json['status'][0]['error']}" # type:ignore[call-overload]
221
+ f"{response_json['status'][0]['error']}" # type: ignore[call-overload]
230
222
  f". document: {document}"
231
223
  )
232
224
  return response_json
@@ -297,7 +289,7 @@ class OpenObserve:
297
289
  )
298
290
 
299
291
  response_json = self._handle_response(res, "search")
300
- res_hits = response_json["hits"] # type:ignore[call-overload]
292
+ res_hits = response_json["hits"] # type: ignore[call-overload]
301
293
  self._debug(res_hits, verbosity, 3)
302
294
 
303
295
  if timestamp_conversion_auto or timestamp_columns is not None:
@@ -445,58 +437,7 @@ class OpenObserve:
445
437
  try:
446
438
  # ensure timestamp format
447
439
  if col in ["_timestamp"] + timestamp_columns:
448
- df_res[col] = polars.to_datetime(df_res[col])
449
- except Exception as err:
450
- raise Exception(
451
- err,
452
- "query",
453
- f"query column type conversion: {col} -> {df_res[col]}",
454
- ) from err
455
- return df_res
456
-
457
- def search2df_fireducks(
458
- self,
459
- sql: str,
460
- *,
461
- start_time: Union[datetime, int] = 0,
462
- end_time: Union[datetime, int] = 0,
463
- verbosity: int = 0,
464
- timeout: int = 300,
465
- timestamp_conversion_auto: bool = False,
466
- timestamp_columns: Union[List[str], None] = None,
467
- ) -> fireducks.core.pandas.DataFrame:
468
- """
469
- OpenObserve search function with fireducks df output
470
-
471
- Args:
472
- sql: input sql query
473
- start_time: start of search interval, either datetime, either int/epoch
474
- end_time: end of search interval, either datetime, either int/epoch
475
- verbosity: how verbose to run from 0/less to 5/more
476
- timeout: http timeout
477
- timestamp_conversion_auto: try to convert automatically column containing time as name
478
- timestamp_columns: convert given columns to timestamp
479
- """
480
- res_json_hits = self.search(
481
- sql,
482
- start_time=start_time,
483
- end_time=end_time,
484
- verbosity=verbosity,
485
- timeout=timeout,
486
- timestamp_conversion_auto=timestamp_conversion_auto,
487
- # leaving conversion to pandas
488
- # timestamp_columns=timestamp_columns,
489
- )
490
- df_res = fireducks.core.pandas.json_normalize(res_json_hits)
491
-
492
- if timestamp_columns is not None:
493
- for col in list(
494
- set(df_res.columns) & set(["_timestamp"] + timestamp_columns)
495
- ):
496
- try:
497
- # ensure timestamp format
498
- if col in ["_timestamp"] + timestamp_columns:
499
- df_res[col] = fireducks.pandas.to_datetime(df_res[col])
440
+ df_res = df_res.with_columns(polars.col(col).str.to_datetime())
500
441
  except Exception as err:
501
442
  raise Exception(
502
443
  err,
@@ -669,14 +610,14 @@ class OpenObserve:
669
610
  name: [
670
611
  api_path,
671
612
  self.list_objects(api_path, verbosity=verbosity),
672
- ] # type:ignore[misc]
613
+ ] # type: ignore[misc]
673
614
  for name, api_path in object_types.items()
674
615
  }
675
616
 
676
617
  for name, object_data in data.items():
677
618
  self.export_objects_split(
678
- object_data[0], # type:ignore[arg-type]
679
- object_data[1], # type:ignore[arg-type]
619
+ object_data[0], # type: ignore[arg-type]
620
+ object_data[1], # type: ignore[arg-type]
680
621
  file_path,
681
622
  verbosity=verbosity,
682
623
  strip=strip,
@@ -688,7 +629,7 @@ class OpenObserve:
688
629
  data = {
689
630
  name: self.list_objects(
690
631
  api_path, verbosity=verbosity
691
- ) # type:ignore[misc]
632
+ ) # type: ignore[misc]
692
633
  for name, api_path in object_types.items()
693
634
  }
694
635
 
@@ -780,7 +721,7 @@ class OpenObserve:
780
721
  count_update = 0
781
722
  current = self.list_objects(object_type, verbosity)
782
723
  self._debug(f"Create/Update by name objects list: {current}", verbosity, 4)
783
- for obj in current[key]: # type:ignore[call-overload]
724
+ for obj in current[key]: # type: ignore[call-overload]
784
725
  if key_name in obj and object_name.strip() == obj[key_name].strip():
785
726
  if overwrite:
786
727
  object_json[key_id] = obj[key_id]
@@ -843,7 +784,7 @@ class OpenObserve:
843
784
  count_delete = 0
844
785
  current = self.list_objects(object_type, verbosity)
845
786
  self._debug(f"Delete by name objects list: {current}", verbosity, 3)
846
- for obj in current[key]: # type:ignore[call-overload]
787
+ for obj in current[key]: # type: ignore[call-overload]
847
788
  if "name" in obj and object_name == obj[key_name]:
848
789
  self._debug(f"Delete by name matching object: {obj}", verbosity)
849
790
  self.delete_object(object_type, obj[key_id], verbosity)