Skip to content

Commit

Permalink
Drop Python 3.7 support (implicit 3.11 now) (#1857)
Browse files Browse the repository at this point in the history
However, pyupgrade is still targeting 3.7 to avoid typing syntax changes until other major PRs are merged.
  • Loading branch information
jace committed Aug 22, 2023
1 parent 9002e5f commit 46fe3c4
Show file tree
Hide file tree
Showing 19 changed files with 3,035 additions and 9,478 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest] # TODO: Figure out macos-latest and Docker
python-version: ['3.7', '3.11']
python-version: ['3.11']

services:
redis:
Expand Down Expand Up @@ -77,11 +77,7 @@ jobs:
path: ${{ env.pythonLocation }}
key: ${{ matrix.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements.txt/test.txt') }}
- name: Install Python dependencies
if: ${{ matrix.python-version != '3.7' }}
run: make install-python-test
- name: Install Python dependencies (3.7)
if: ${{ matrix.python-version == '3.7' }}
run: make install-python-test-37
- name: Install Node
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [commit]
# Enable this to enforce a common Python version:
# default_language_version:
# python: python3.9
default_language_version:
python: python3.11
ci:
skip: [
'pip-audit',
Expand Down
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

16 changes: 1 addition & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
all:
@echo "You must have an active Python virtualenv (3.7+) before using any of these."
@echo "You must have an active Python virtualenv (3.11+) before using any of these."
@echo
@echo "For production deployment:"
@echo " make install # For first time setup and after dependency upgrades"
Expand Down Expand Up @@ -75,11 +75,6 @@ deps-python: deps-editable
pip install --upgrade pip pip-tools pip-compile-multi
pip-compile-multi --backtracking --use-cache

deps-python-37: deps-editable
# pip 23.2 breaks pip-tools 6, but pip-tools 7 doesn't support Python 3.7
pip install --upgrade 'pip<23.2' pip-tools pip-compile-multi
pip-compile-multi --backtracking --use-cache -o py37.txt

deps-python-noup:
pip-compile-multi --backtracking --use-cache --no-upgrade

Expand Down Expand Up @@ -123,15 +118,6 @@ install-python-test: install-python-pip deps-editable
install-python: install-python-pip deps-editable
pip install --use-pep517 -r requirements/base.txt

install-python-dev-37: install-python-pip deps-editable
pip install --use-pep517 -r requirements/dev.py37.txt

install-python-test-37: install-python-pip deps-editable
pip install --use-pep517 -r requirements/test.py37.txt

install-python-37: install-python-pip deps-editable
pip install --use-pep517 -r requirements/base.py37.txt

install-dev: deps-editable install-python-dev install-npm assets

install-test: deps-editable install-python-test install-npm assets
Expand Down
3 changes: 1 addition & 2 deletions funnel/forms/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def __call__(self, form, field) -> None:

def pwned_password_validator(_form, field) -> None:
"""Validate password against the pwned password API."""
# Add usedforsecurity=False when migrating to Python 3.9+
phash = sha1(field.data.encode()).hexdigest().upper() # nosec
phash = sha1(field.data.encode(), usedforsecurity=False).hexdigest().upper()
prefix, suffix = phash[:5], phash[5:]

try:
Expand Down
5 changes: 2 additions & 3 deletions funnel/models/email_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,9 @@ def email_hash(self) -> str:
@with_roles(call={'all'})
def md5(self) -> Optional[str]:
"""MD5 hash of :property:`email_normalized`, for legacy use only."""
# TODO: After upgrading to Python 3.9, use usedforsecurity=False
return (
hashlib.md5( # nosec # skipcq: PTC-W1003
self.email_normalized.encode('utf-8')
hashlib.md5(
self.email_normalized.encode('utf-8'), usedforsecurity=False
).hexdigest()
if self.email_normalized
else None
Expand Down
5 changes: 1 addition & 4 deletions funnel/models/phone_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,8 @@ def phone_hash(self) -> str:
@with_roles(call={'all'})
def md5(self) -> Optional[str]:
"""MD5 hash of :attr:`phone`, for legacy use only."""
# TODO: After upgrading to Python 3.9, use usedforsecurity=False
return (
hashlib.md5( # nosec # skipcq: PTC-W1003
self.number.encode('utf-8')
).hexdigest()
hashlib.md5(self.number.encode('utf-8'), usedforsecurity=False).hexdigest()
if self.number
else None
)
Expand Down
Loading

0 comments on commit 46fe3c4

Please sign in to comment.