Skip to content

chore: add support for Python 3.12 #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions tests/test_InfluxDBClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_QueryApiDataFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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(
Expand All @@ -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 = \
Expand Down
1 change: 1 addition & 0 deletions tests/test_Warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
8 changes: 4 additions & 4 deletions tests/test_WriteApiDataFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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())

Expand All @@ -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(),
Expand All @@ -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(),
Expand Down