diff --git a/.circleci/config.yml b/.circleci/config.yml index e471dfbb..a47bde06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -202,6 +202,9 @@ workflows: - tests-python: name: test-3.11 python-image: "cimg/python:3.11" + - tests-python: + name: test-3.12 + python-image: "cimg/python:3.12" nightly: when: diff --git a/CHANGELOG.md b/CHANGELOG.md index e542413a..284f8062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.41.0 [unreleased] +### Features +1. [#643](https://github.com/influxdata/influxdb-client-python/pull/643): Add a support for Python 3.12 + ### Bug Fixes 1. [#636](https://github.com/influxdata/influxdb-client-python/pull/636): Handle missing data in data frames 2. [#638](https://github.com/influxdata/influxdb-client-python/pull/638), [#642](https://github.com/influxdata/influxdb-client-python/pull/642): Refactor DataFrame operations to avoid chained assignment and resolve FutureWarning in pandas, ensuring compatibility with pandas 3.0. diff --git a/scripts/ci-test.sh b/scripts/ci-test.sh index 8e2cdd4e..dc7c9b59 100755 --- a/scripts/ci-test.sh +++ b/scripts/ci-test.sh @@ -8,13 +8,13 @@ ENABLED_CISO_8601="${ENABLED_CISO_8601:-true}" # Install requirements # python --version -pip install -e . --user -pip install -e .\[extra\] --user -pip install -e .\[test\] --user -pip install -e .\[async\] --user +pip install . --user +pip install .\[extra\] --user +pip install .\[test\] --user +pip install .\[async\] --user if [ "$ENABLED_CISO_8601" = true ] ; then echo "ciso8601 is enabled" - pip install -e .\[ciso\] --user + pip install .\[ciso\] --user else echo "ciso8601 is disabled" fi diff --git a/setup.py b/setup.py index e15b963e..ac1154d3 100644 --- a/setup.py +++ b/setup.py @@ -78,6 +78,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Database', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tests/test_InfluxDBClient.py b/tests/test_InfluxDBClient.py index c2f9b0a5..7fdf834f 100644 --- a/tests/test_InfluxDBClient.py +++ b/tests/test_InfluxDBClient.py @@ -248,8 +248,9 @@ def _start_http_server(self): urllib3.disable_warnings() # Configure HTTP server self.httpd = http.server.HTTPServer(('localhost', 0), ServerWithSelfSingedSSL) - self.httpd.socket = ssl.wrap_socket(self.httpd.socket, certfile=f'{os.path.dirname(__file__)}/server.pem', - server_side=True) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(f'{os.path.dirname(__file__)}/server.pem') + self.httpd.socket = context.wrap_socket(self.httpd.socket, server_side=True) # Start server at background self.httpd_thread = threading.Thread(target=self.httpd.serve_forever) self.httpd_thread.start() diff --git a/tests/test_QueryApiDataFrame.py b/tests/test_QueryApiDataFrame.py index 670074bc..31396be6 100644 --- a/tests/test_QueryApiDataFrame.py +++ b/tests/test_QueryApiDataFrame.py @@ -268,7 +268,7 @@ def test_query_with_warning(self): '|> range(start: -5s, stop: now()) ' '|> filter(fn: (r) => r._measurement == "mem") ' "my-org") - self.assertEqual(1, len(warnings)) + self.assertEqual(1, len([w for w in warnings if w.category == MissingPivotFunction])) def test_query_without_warning(self): httpretty.register_uri(httpretty.POST, uri="http://localhost/api/v2/query", status=200, body='\n') @@ -284,7 +284,7 @@ def test_query_without_warning(self): '|> filter(fn: (r) => r._measurement == "mem") ' '|> schema.fieldsAsCols() ' "my-org") - self.assertEqual(0, len(warns)) + self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction])) with warnings.catch_warnings(record=True) as warns: self.client.query_api().query_data_frame( @@ -293,7 +293,7 @@ def test_query_without_warning(self): '|> filter(fn: (r) => r._measurement == "mem") ' '|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")' "my-org") - self.assertEqual(0, len(warns)) + self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction])) def test_pivoted_data(self): query_response = \ diff --git a/tests/test_Warnings.py b/tests/test_Warnings.py index 9d32d368..f3bc3f20 100644 --- a/tests/test_Warnings.py +++ b/tests/test_Warnings.py @@ -27,4 +27,5 @@ def test_cloud_only_warning(self): with InfluxDBClient(url="http://localhost", token="my-token", org="my-org") as client: service = BucketSchemasService(api_client=client.api_client) service.get_measurement_schemas(bucket_id="01010101") + warnings = [w for w in warnings if w.category == CloudOnlyWarning] self.assertEqual(1, len(warnings)) diff --git a/tests/test_WriteApiDataFrame.py b/tests/test_WriteApiDataFrame.py index 3675519a..6ea7a98b 100644 --- a/tests/test_WriteApiDataFrame.py +++ b/tests/test_WriteApiDataFrame.py @@ -313,7 +313,7 @@ def test_with_period_index(self): data_frame = pd.DataFrame(data={ 'value': [1, 2], }, - index=pd.period_range(start='2020-04-05 01:00', freq='H', periods=2)) + index=pd.period_range(start='2020-04-05 01:00', freq='h', periods=2)) points = data_frame_to_list_of_points(data_frame=data_frame, point_settings=PointSettings(), @@ -498,7 +498,7 @@ def test_specify_timezone_period_time_index(self): data_frame = pd.DataFrame(data={ 'value1': [10, 20], 'value2': [30, 40], - }, index=pd.period_range(start='2020-05-24 10:00', freq='H', periods=2)) + }, index=pd.period_range(start='2020-05-24 10:00', freq='h', periods=2)) print(data_frame.to_string()) @@ -519,7 +519,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self): '2value': [30.0, np.nan, np.nan, np.nan, np.nan], '3value': [30.0, 30.0, 30.0, np.nan, np.nan], 'avalue': [30.0, 30.0, 30.0, 30.0, 30.0] - }, index=pd.period_range('2020-05-24 10:00', freq='H', periods=5)) + }, index=pd.period_range('2020-05-24 10:00', freq='h', periods=5)) points = data_frame_to_list_of_points(data_frame, PointSettings(), @@ -536,7 +536,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self): '1value': [np.nan], 'avalue': [30.0], 'bvalue': [30.0] - }, index=pd.period_range('2020-05-24 10:00', freq='H', periods=1)) + }, index=pd.period_range('2020-05-24 10:00', freq='h', periods=1)) points = data_frame_to_list_of_points(data_frame, PointSettings(),