From 752eb40d816355dcb07d518139c6179eb53101fc Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Thu, 21 Nov 2024 11:21:00 -0500 Subject: [PATCH 1/7] Remove 3.8 support --- .github/workflows/python-checks.yml | 4 ++-- README.md | 2 +- pyproject.toml | 2 +- setup.py | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index a0835217e0..7f07cd6c42 100644 --- a/.github/workflows/python-checks.yml +++ b/.github/workflows/python-checks.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] os: ["ubuntu-latest", "windows-latest", "macos-latest"] limited-dependencies: ["", "TRUE"] @@ -140,7 +140,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] os: ["ubuntu-latest", "windows-latest", "macos-latest"] limited-dependencies: ["", "TRUE"] diff --git a/README.md b/README.md index 28aa23a716..b006ecb445 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This project is maintained by [The Movement Cooperative](https://movementcoopera after [Lucy Parsons](https://en.wikipedia.org/wiki/Lucy_Parsons). The Movement Cooperative is a member-led organization focused on providing data, tools, and strategic support for the progressive community. -Parsons is only supported for Python 3.8-12. +Parsons is only supported for Python 3.9-12. ## Table of Contents diff --git a/pyproject.toml b/pyproject.toml index e51bdeb3ed..7435f9614e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ line-length = 100 indent-width = 4 # Assume Python 3.8 -target-version = "py38" +target-version = "py39" [tool.ruff.lint] # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. diff --git a/setup.py b/setup.py index 706b360a7f..88f11c30ab 100644 --- a/setup.py +++ b/setup.py @@ -94,13 +94,12 @@ def main(): classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ], - python_requires=">=3.8.0,<3.13.0", + python_requires=">=3.9.0,<3.13.0", long_description=long_description, long_description_content_type="text/markdown", ) From a6812d078c04576fe37416ed8c2991ebfa2126ac Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 16:42:06 -0500 Subject: [PATCH 2/7] Remove md5 security workaround (see issue #1138) --- parsons/etl/etl.py | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/parsons/etl/etl.py b/parsons/etl/etl.py index 84563a4a88..beb7238018 100644 --- a/parsons/etl/etl.py +++ b/parsons/etl/etl.py @@ -659,21 +659,13 @@ def unpack_nested_columns_as_rows(self, column, key="id", expand_original=False) orig.concat(melted_list) # Add unique id column by hashing all the other fields if "uid" not in self.columns: - if sys.version_info.minor >= 9: - orig.add_column( - "uid", - lambda row: hashlib.md5( - str.encode("".join([str(x) for x in row])), usedforsecurity=False - ).hexdigest(), - ) - elif sys.version_info.minor < 9: - orig.add_column( - "uid", - lambda row: hashlib.md5( # nosec B324 - str.encode("".join([str(x) for x in row])) - ).hexdigest(), - ) - orig.move_column("uid", 0) + orig.add_column( + "uid", + lambda row: hashlib.md5( + str.encode("".join([str(x) for x in row])), usedforsecurity=False + ).hexdigest(), + ) + orig.move_column("uid", 0) # Rename value column in case this is done again to this Table orig.rename_column("value", f"{column}_value") @@ -684,18 +676,12 @@ def unpack_nested_columns_as_rows(self, column, key="id", expand_original=False) else: orig = self.remove_column(column) # Add unique id column by hashing all the other fields - if sys.version_info.minor >= 9: - melted_list.add_column( - "uid", - lambda row: hashlib.md5( - str.encode("".join([str(x) for x in row])), usedforsecurity=False - ).hexdigest(), - ) - elif sys.version_info.minor < 9: - melted_list.add_column( - "uid", - lambda row: hashlib.md5(str.encode("".join([str(x) for x in row]))).hexdigest(), # nosec B324 - ) + melted_list.add_column( + "uid", + lambda row: hashlib.md5( + str.encode("".join([str(x) for x in row])), usedforsecurity=False + ).hexdigest(), + ) melted_list.move_column("uid", 0) output = melted_list From c32fa7ac9dc451247a7df46c72afdff8859b86e3 Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 16:57:39 -0500 Subject: [PATCH 3/7] Attempt to Mac OS Python 3.9 limited dependencies issue --- .github/workflows/python-checks.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index 7f07cd6c42..e13fb00ae0 100644 --- a/.github/workflows/python-checks.yml +++ b/.github/workflows/python-checks.yml @@ -32,6 +32,10 @@ jobs: - name: Install uv uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 + - name: Patch install error when using Python 3.9, limited dependencies, and MacOS + if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9" + run: uv pip install --system psycopg2-binary==2.9.9 + - name: Install dependencies env: PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }} @@ -160,6 +164,10 @@ jobs: python-version: ${{ matrix.python-version }} cache: pip + - name: Patch install error when using Python 3.9, limited dependencies, and MacOS + if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9" + run: uv pip install --system psycopg2-binary==2.9.9 + - name: Install dependencies env: PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }} From cd3af5e938e5912f223314945bfa35cbda166df4 Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 17:00:10 -0500 Subject: [PATCH 4/7] Remove uv from pip-install check --- .github/workflows/python-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index e13fb00ae0..56885e33a2 100644 --- a/.github/workflows/python-checks.yml +++ b/.github/workflows/python-checks.yml @@ -166,7 +166,7 @@ jobs: - name: Patch install error when using Python 3.9, limited dependencies, and MacOS if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9" - run: uv pip install --system psycopg2-binary==2.9.9 + run: pip install --system psycopg2-binary==2.9.9 - name: Install dependencies env: From 11d3ec15f559f0c75f704b6d63f1fc8674de3ae0 Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 17:01:22 -0500 Subject: [PATCH 5/7] Remove uv from pip-install check --- .github/workflows/python-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index 56885e33a2..bf3a427526 100644 --- a/.github/workflows/python-checks.yml +++ b/.github/workflows/python-checks.yml @@ -166,7 +166,7 @@ jobs: - name: Patch install error when using Python 3.9, limited dependencies, and MacOS if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9" - run: pip install --system psycopg2-binary==2.9.9 + run: pip install psycopg2-binary==2.9.9 - name: Install dependencies env: From ccd06321d5c9a2163ce9af4859351333fe93183e Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 17:04:26 -0500 Subject: [PATCH 6/7] Remove unused inmport --- parsons/etl/etl.py | 1 - 1 file changed, 1 deletion(-) diff --git a/parsons/etl/etl.py b/parsons/etl/etl.py index beb7238018..2716777a63 100644 --- a/parsons/etl/etl.py +++ b/parsons/etl/etl.py @@ -1,5 +1,4 @@ import logging -import sys import petl From 57409f9af277cc98348186ff1f21be31ce01e1f4 Mon Sep 17 00:00:00 2001 From: Shauna Gordon-McKeon Date: Mon, 2 Dec 2024 17:06:08 -0500 Subject: [PATCH 7/7] Remove extra spaces --- parsons/etl/etl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsons/etl/etl.py b/parsons/etl/etl.py index 2716777a63..d1675eab97 100644 --- a/parsons/etl/etl.py +++ b/parsons/etl/etl.py @@ -664,7 +664,7 @@ def unpack_nested_columns_as_rows(self, column, key="id", expand_original=False) str.encode("".join([str(x) for x in row])), usedforsecurity=False ).hexdigest(), ) - orig.move_column("uid", 0) + orig.move_column("uid", 0) # Rename value column in case this is done again to this Table orig.rename_column("value", f"{column}_value")