Skip to content

Commit c430620

Browse files
authored
chore: add support for Python 3.12 (#643)
1 parent e82b016 commit c430620

8 files changed

+23
-14
lines changed

.circleci/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ workflows:
202202
- tests-python:
203203
name: test-3.11
204204
python-image: "cimg/python:3.11"
205+
- tests-python:
206+
name: test-3.12
207+
python-image: "cimg/python:3.12"
205208

206209
nightly:
207210
when:

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 1.41.0 [unreleased]
22

3+
### Features
4+
1. [#643](https://github.com/influxdata/influxdb-client-python/pull/643): Add a support for Python 3.12
5+
36
### Bug Fixes
47
1. [#636](https://github.com/influxdata/influxdb-client-python/pull/636): Handle missing data in data frames
58
1. [#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.

scripts/ci-test.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ ENABLED_CISO_8601="${ENABLED_CISO_8601:-true}"
88
# Install requirements
99
#
1010
python --version
11-
pip install -e . --user
12-
pip install -e .\[extra\] --user
13-
pip install -e .\[test\] --user
14-
pip install -e .\[async\] --user
11+
pip install . --user
12+
pip install .\[extra\] --user
13+
pip install .\[test\] --user
14+
pip install .\[async\] --user
1515
if [ "$ENABLED_CISO_8601" = true ] ; then
1616
echo "ciso8601 is enabled"
17-
pip install -e .\[ciso\] --user
17+
pip install .\[ciso\] --user
1818
else
1919
echo "ciso8601 is disabled"
2020
fi

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
'Programming Language :: Python :: 3.9',
7979
'Programming Language :: Python :: 3.10',
8080
'Programming Language :: Python :: 3.11',
81+
'Programming Language :: Python :: 3.12',
8182
'Topic :: Database',
8283
'Topic :: Software Development :: Libraries',
8384
'Topic :: Software Development :: Libraries :: Python Modules',

tests/test_InfluxDBClient.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ def _start_http_server(self):
248248
urllib3.disable_warnings()
249249
# Configure HTTP server
250250
self.httpd = http.server.HTTPServer(('localhost', 0), ServerWithSelfSingedSSL)
251-
self.httpd.socket = ssl.wrap_socket(self.httpd.socket, certfile=f'{os.path.dirname(__file__)}/server.pem',
252-
server_side=True)
251+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
252+
context.load_cert_chain(f'{os.path.dirname(__file__)}/server.pem')
253+
self.httpd.socket = context.wrap_socket(self.httpd.socket, server_side=True)
253254
# Start server at background
254255
self.httpd_thread = threading.Thread(target=self.httpd.serve_forever)
255256
self.httpd_thread.start()

tests/test_QueryApiDataFrame.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_query_with_warning(self):
268268
'|> range(start: -5s, stop: now()) '
269269
'|> filter(fn: (r) => r._measurement == "mem") '
270270
"my-org")
271-
self.assertEqual(1, len(warnings))
271+
self.assertEqual(1, len([w for w in warnings if w.category == MissingPivotFunction]))
272272

273273
def test_query_without_warning(self):
274274
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):
284284
'|> filter(fn: (r) => r._measurement == "mem") '
285285
'|> schema.fieldsAsCols() '
286286
"my-org")
287-
self.assertEqual(0, len(warns))
287+
self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction]))
288288

289289
with warnings.catch_warnings(record=True) as warns:
290290
self.client.query_api().query_data_frame(
@@ -293,7 +293,7 @@ def test_query_without_warning(self):
293293
'|> filter(fn: (r) => r._measurement == "mem") '
294294
'|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")'
295295
"my-org")
296-
self.assertEqual(0, len(warns))
296+
self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction]))
297297

298298
def test_pivoted_data(self):
299299
query_response = \

tests/test_Warnings.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ def test_cloud_only_warning(self):
2727
with InfluxDBClient(url="http://localhost", token="my-token", org="my-org") as client:
2828
service = BucketSchemasService(api_client=client.api_client)
2929
service.get_measurement_schemas(bucket_id="01010101")
30+
warnings = [w for w in warnings if w.category == CloudOnlyWarning]
3031
self.assertEqual(1, len(warnings))

tests/test_WriteApiDataFrame.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def test_with_period_index(self):
313313
data_frame = pd.DataFrame(data={
314314
'value': [1, 2],
315315
},
316-
index=pd.period_range(start='2020-04-05 01:00', freq='H', periods=2))
316+
index=pd.period_range(start='2020-04-05 01:00', freq='h', periods=2))
317317

318318
points = data_frame_to_list_of_points(data_frame=data_frame,
319319
point_settings=PointSettings(),
@@ -498,7 +498,7 @@ def test_specify_timezone_period_time_index(self):
498498
data_frame = pd.DataFrame(data={
499499
'value1': [10, 20],
500500
'value2': [30, 40],
501-
}, index=pd.period_range(start='2020-05-24 10:00', freq='H', periods=2))
501+
}, index=pd.period_range(start='2020-05-24 10:00', freq='h', periods=2))
502502

503503
print(data_frame.to_string())
504504

@@ -519,7 +519,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self):
519519
'2value': [30.0, np.nan, np.nan, np.nan, np.nan],
520520
'3value': [30.0, 30.0, 30.0, np.nan, np.nan],
521521
'avalue': [30.0, 30.0, 30.0, 30.0, 30.0]
522-
}, index=pd.period_range('2020-05-24 10:00', freq='H', periods=5))
522+
}, index=pd.period_range('2020-05-24 10:00', freq='h', periods=5))
523523

524524
points = data_frame_to_list_of_points(data_frame,
525525
PointSettings(),
@@ -536,7 +536,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self):
536536
'1value': [np.nan],
537537
'avalue': [30.0],
538538
'bvalue': [30.0]
539-
}, index=pd.period_range('2020-05-24 10:00', freq='H', periods=1))
539+
}, index=pd.period_range('2020-05-24 10:00', freq='h', periods=1))
540540

541541
points = data_frame_to_list_of_points(data_frame,
542542
PointSettings(),

0 commit comments

Comments
 (0)