Skip to content

Commit 2ec1d4e

Browse files
authored
Merge pull request #190 from bkemper24/main
prepare for python 3.12
2 parents 3b10c1b + 6d61f12 commit 2ec1d4e

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

doc/source/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Installation
77
The SWAT package is installed using the ``pip`` command. The requirements
88
for using the binary protocol of CAS (recommended) are as follows.
99

10-
* **64-bit** Python 3.7 - 3.11 on Linux or Windows
10+
* **64-bit** Python 3.7 - 3.12 on Linux or Windows
1111

1212
See additional shared library notes below.
1313

@@ -19,7 +19,7 @@ amounts of data. It also offers more advanced data loading from the client
1919
and data formatting features.
2020

2121
To access the CAS REST interface only, you can use the pure Python code which
22-
runs in Python 2.7/3.5+. You will still need Pandas installed. While not as
22+
runs in Python 3.7 - 3.12. You will still need Pandas installed. While not as
2323
fast as the binary protocol, the pure Python interface is more portable.
2424
For more information, see :ref:`Binary vs. REST <binaryvsrest>`.
2525

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_file(fname):
4343
license='Apache v2.0 (SWAT) + SAS Additional Functionality (SAS TK)',
4444
packages=find_packages(),
4545
package_data={
46-
'swat': ['lib/*/*.*', 'tests/datasources/*.*'],
46+
'swat': ['lib/*/*.*', 'tests/datasources/*.*', 'readme.md'],
4747
},
4848
install_requires=[
4949
'pandas >= 0.16.0',
@@ -68,6 +68,7 @@ def get_file(fname):
6868
'Programming Language :: Python :: 3.9',
6969
'Programming Language :: Python :: 3.10',
7070
'Programming Language :: Python :: 3.11',
71+
'Programming Language :: Python :: 3.12',
7172
'Topic :: Scientific/Engineering',
7273
],
7374
)

swat/readme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
For **Python 3.12 on Windows only**, the following modification was made to the `pyport.h` file while building the SWAT C extensions:
2+
3+
* Updated the `#define` for `ALWAYS_INLINE`
4+
<br>**Previous Definition :**
5+
```c
6+
#elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
7+
```
8+
**Updated Definition :**
9+
```c
10+
#elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_LLVM_COMPILER) || (defined(__INTEL_COMPILER) && !defined(_WIN32))
11+
```
12+
13+
This change addresses a compiler error encountered when using the Intel compiler on Windows.

swat/tests/cas/test_table.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,10 @@ def test_drop_duplicates(self):
878878
df_dropped = df.drop_duplicates(subset='Make')
879879

880880
# Equivalent to pandas in size
881-
self.assertEquals(len(tbl_dropped), len(df_dropped))
881+
self.assertEqual(len(tbl_dropped), len(df_dropped))
882882
# Number of elements in 'Make' column should be same as number of unique elements
883-
self.assertEquals(tbl_dropped['Make'].nunique(), len(tbl_dropped['Make']))
884-
self.assertEquals(tbl_dropped['Make'].nunique(), len(tbl_dropped))
883+
self.assertEqual(tbl_dropped['Make'].nunique(), len(tbl_dropped['Make']))
884+
self.assertEqual(tbl_dropped['Make'].nunique(), len(tbl_dropped))
885885

886886
# drop duplicates for multi-element subset
887887
tbl_dropped_multi = tbl.drop_duplicates(casout={'replace': True,
@@ -890,7 +890,7 @@ def test_drop_duplicates(self):
890890
df_dropped_multi = df.drop_duplicates(subset=['Origin', 'Type'])
891891

892892
# Equivalent to pandas in size
893-
self.assertEquals(len(tbl_dropped_multi), len(df_dropped_multi))
893+
self.assertEqual(len(tbl_dropped_multi), len(df_dropped_multi))
894894

895895
# We need some rows where all values for each col are duplicate
896896
nDuplicates = 7
@@ -915,8 +915,8 @@ def test_drop_duplicates(self):
915915
'name': 'drop-test-4'})
916916

917917
# Make sure that the correct amount of rows were dropped
918-
self.assertEquals(len(tbl), len(tbl_dropped_all))
919-
self.assertEquals(len(duplicate_table), len(tbl_dropped_all) + nDuplicates)
918+
self.assertEqual(len(tbl), len(tbl_dropped_all))
919+
self.assertEqual(len(duplicate_table), len(tbl_dropped_all) + nDuplicates)
920920

921921
def test_column_iter(self):
922922
df = self.get_cars_df()
@@ -3314,23 +3314,23 @@ def test_nunique(self):
33143314
tbl_nunique = tbl.nunique()
33153315
df_nunique = df.nunique()
33163316
# Length of Series are equal
3317-
self.assertEquals(len(tbl_nunique), len(df_nunique))
3317+
self.assertEqual(len(tbl_nunique), len(df_nunique))
33183318
# Indices are equal
33193319
self.assertTrue(sorted(tbl_nunique) == sorted(df_nunique))
33203320
# Values are equal
33213321
for col in tbl.columns:
3322-
self.assertEquals(tbl_nunique[col], df_nunique[col])
3322+
self.assertEqual(tbl_nunique[col], df_nunique[col])
33233323

33243324
# Now counting NaN
33253325
tbl_nunique_nan = tbl.nunique(dropna=False)
33263326
df_nunique_nan = df.nunique(dropna=False)
33273327
# Length of Series are equal
3328-
self.assertEquals(len(tbl_nunique_nan), len(df_nunique_nan))
3328+
self.assertEqual(len(tbl_nunique_nan), len(df_nunique_nan))
33293329
# Indices are equal
3330-
self.assertEquals(sorted(tbl_nunique_nan), sorted(df_nunique_nan))
3330+
self.assertEqual(sorted(tbl_nunique_nan), sorted(df_nunique_nan))
33313331
# Values are equal
33323332
for col in tbl.columns:
3333-
self.assertEquals(tbl_nunique_nan[col], df_nunique_nan[col])
3333+
self.assertEqual(tbl_nunique_nan[col], df_nunique_nan[col])
33343334

33353335
def test_column_unique(self):
33363336
df = self.get_cars_df()

0 commit comments

Comments
 (0)