From 6d61f125a87d112f126fd030a2988409b2956cc6 Mon Sep 17 00:00:00 2001 From: Barbara Kemper Date: Wed, 4 Dec 2024 11:16:48 -0500 Subject: [PATCH] prepare for python 3.12 Signed-off-by: Barbara Kemper --- doc/source/install.rst | 4 ++-- setup.py | 3 ++- swat/readme.md | 13 +++++++++++++ swat/tests/cas/test_table.py | 22 +++++++++++----------- 4 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 swat/readme.md diff --git a/doc/source/install.rst b/doc/source/install.rst index cecb4c8d..e39f669e 100755 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -7,7 +7,7 @@ Installation The SWAT package is installed using the ``pip`` command. The requirements for using the binary protocol of CAS (recommended) are as follows. -* **64-bit** Python 3.7 - 3.11 on Linux or Windows +* **64-bit** Python 3.7 - 3.12 on Linux or Windows See additional shared library notes below. @@ -19,7 +19,7 @@ amounts of data. It also offers more advanced data loading from the client and data formatting features. To access the CAS REST interface only, you can use the pure Python code which -runs in Python 2.7/3.5+. You will still need Pandas installed. While not as +runs in Python 3.7 - 3.12. You will still need Pandas installed. While not as fast as the binary protocol, the pure Python interface is more portable. For more information, see :ref:`Binary vs. REST `. diff --git a/setup.py b/setup.py index b7aab7b6..4f06b285 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ def get_file(fname): license='Apache v2.0 (SWAT) + SAS Additional Functionality (SAS TK)', packages=find_packages(), package_data={ - 'swat': ['lib/*/*.*', 'tests/datasources/*.*'], + 'swat': ['lib/*/*.*', 'tests/datasources/*.*', 'readme.md'], }, install_requires=[ 'pandas >= 0.16.0', @@ -68,6 +68,7 @@ def get_file(fname): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Scientific/Engineering', ], ) diff --git a/swat/readme.md b/swat/readme.md new file mode 100644 index 00000000..d2568a80 --- /dev/null +++ b/swat/readme.md @@ -0,0 +1,13 @@ +For **Python 3.12 on Windows only**, the following modification was made to the `pyport.h` file while building the SWAT C extensions: + +* Updated the `#define` for `ALWAYS_INLINE` +
**Previous Definition :** + ```c + #elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER) + ``` + **Updated Definition :** + ```c + #elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_LLVM_COMPILER) || (defined(__INTEL_COMPILER) && !defined(_WIN32)) + ``` + +This change addresses a compiler error encountered when using the Intel compiler on Windows. diff --git a/swat/tests/cas/test_table.py b/swat/tests/cas/test_table.py index acf3d6e0..c339bcdc 100755 --- a/swat/tests/cas/test_table.py +++ b/swat/tests/cas/test_table.py @@ -878,10 +878,10 @@ def test_drop_duplicates(self): df_dropped = df.drop_duplicates(subset='Make') # Equivalent to pandas in size - self.assertEquals(len(tbl_dropped), len(df_dropped)) + self.assertEqual(len(tbl_dropped), len(df_dropped)) # Number of elements in 'Make' column should be same as number of unique elements - self.assertEquals(tbl_dropped['Make'].nunique(), len(tbl_dropped['Make'])) - self.assertEquals(tbl_dropped['Make'].nunique(), len(tbl_dropped)) + self.assertEqual(tbl_dropped['Make'].nunique(), len(tbl_dropped['Make'])) + self.assertEqual(tbl_dropped['Make'].nunique(), len(tbl_dropped)) # drop duplicates for multi-element subset tbl_dropped_multi = tbl.drop_duplicates(casout={'replace': True, @@ -890,7 +890,7 @@ def test_drop_duplicates(self): df_dropped_multi = df.drop_duplicates(subset=['Origin', 'Type']) # Equivalent to pandas in size - self.assertEquals(len(tbl_dropped_multi), len(df_dropped_multi)) + self.assertEqual(len(tbl_dropped_multi), len(df_dropped_multi)) # We need some rows where all values for each col are duplicate nDuplicates = 7 @@ -915,8 +915,8 @@ def test_drop_duplicates(self): 'name': 'drop-test-4'}) # Make sure that the correct amount of rows were dropped - self.assertEquals(len(tbl), len(tbl_dropped_all)) - self.assertEquals(len(duplicate_table), len(tbl_dropped_all) + nDuplicates) + self.assertEqual(len(tbl), len(tbl_dropped_all)) + self.assertEqual(len(duplicate_table), len(tbl_dropped_all) + nDuplicates) def test_column_iter(self): df = self.get_cars_df() @@ -3314,23 +3314,23 @@ def test_nunique(self): tbl_nunique = tbl.nunique() df_nunique = df.nunique() # Length of Series are equal - self.assertEquals(len(tbl_nunique), len(df_nunique)) + self.assertEqual(len(tbl_nunique), len(df_nunique)) # Indices are equal self.assertTrue(sorted(tbl_nunique) == sorted(df_nunique)) # Values are equal for col in tbl.columns: - self.assertEquals(tbl_nunique[col], df_nunique[col]) + self.assertEqual(tbl_nunique[col], df_nunique[col]) # Now counting NaN tbl_nunique_nan = tbl.nunique(dropna=False) df_nunique_nan = df.nunique(dropna=False) # Length of Series are equal - self.assertEquals(len(tbl_nunique_nan), len(df_nunique_nan)) + self.assertEqual(len(tbl_nunique_nan), len(df_nunique_nan)) # Indices are equal - self.assertEquals(sorted(tbl_nunique_nan), sorted(df_nunique_nan)) + self.assertEqual(sorted(tbl_nunique_nan), sorted(df_nunique_nan)) # Values are equal for col in tbl.columns: - self.assertEquals(tbl_nunique_nan[col], df_nunique_nan[col]) + self.assertEqual(tbl_nunique_nan[col], df_nunique_nan[col]) def test_column_unique(self): df = self.get_cars_df()