Skip to content

Commit

Permalink
Merge pull request #51 from questionlp/develop
Browse files Browse the repository at this point in the history
Support Python 3.12, Drop Python < 3.10
  • Loading branch information
questionlp authored Nov 26, 2023
2 parents d937b8f + 39a0f55 commit d3c4f76
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 13 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changes

## 5.7.0

**Starting with version 5.7.0, support for all versions of Python prior to 3.10 have been deprecated.**

### Application Changes

- Replace `dateutil.parser.parse` with `datetime.datetime.strptime`

### Component Changes

- Upgrade wwdtm from 2.4.0 to 2.5.0, which drops supports for Python versions prior to 3.10 and includes:
- Upgrade MySQL Connector/Python from 8.0.33 to 8.2.0
- Upgrade numpy from 1.24.4 to 1.26.0

### Development Changes

- Upgrade black from 23.10.1 to 23.11.0
- Remove `py38` and `py39` from `tool.black` in `pyproject.toml`

## 5.6.0

### Component Changes
Expand Down
2 changes: 1 addition & 1 deletion INSTALLING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# INSTALLING

The following instructions target Ubuntu 20.04 LTS and Ubuntu 22.04 LTS; but, with some minor changes, should also apply to Linux distribution that uses `systemd` to manage services. Python 3.8 or newer is required and the system must already have a working installation available.
The following instructions target Ubuntu 20.04 LTS and Ubuntu 22.04 LTS; but, with some minor changes, should also apply to Linux distribution that uses `systemd` to manage services. Python 3.10 or newer is required and the system must already have a working installation available.

This document provides instructions on how to serve the application through [Gunicorn](https://gunicorn.org) and use [NGINX](https://nginx.org/) as a front-end HTTP server. Other options are available for serving up applications built using Flask, but those options will not be covered here.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flask-based web application that serves up statistics and details for the NPR we

## Requirements

- Python 3.8 or newer
- Python 3.10 or newer
- MySQL Server 8.0 or newer, or another MySQL Server distribution based on MySQL Server 8.0 or newer, hosting a version of the aforementioned Wait Wait Don't Tell Me! Stats database

## Installation
Expand Down
6 changes: 3 additions & 3 deletions app/shows/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# stats.wwdt.me is released under the terms of the Apache License 2.0
"""Shows Routes for Wait Wait Stats Page"""
from datetime import date
import datetime

from dateutil import parser
from flask import Blueprint, current_app, render_template, url_for
import mysql.connector
from typing import Union
Expand Down Expand Up @@ -58,7 +58,7 @@ def index():
def date_string(date_string: int):
"""View: Show Details for a given ISO Date String"""
try:
parsed_date = parser.parse(date_string)
parsed_date = datetime.datetime.strptime(date_string, "%Y-%m-%d")
database_connection = mysql.connector.connect(**current_app.config["database"])
show_utility = ShowUtility(database_connection=database_connection)
if not show_utility.date_exists(
Expand All @@ -75,7 +75,7 @@ def date_string(date_string: int):
),
301,
)
except parser.ParserError:
except ValueError:
return redirect_url(url_for("shows.index"))
except OverflowError:
return redirect_url(url_for("shows.index"))
Expand Down
3 changes: 1 addition & 2 deletions app/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import json

from datetime import datetime
from dateutil import parser
from flask import current_app
import markdown
import pytz
Expand All @@ -23,7 +22,7 @@ def date_string_to_date(**kwargs):
"""Used to convert an ISO-style date string into a datetime object"""
if "date_string" in kwargs and kwargs["date_string"]:
try:
date_object = parser.parse(kwargs["date_string"])
date_object = datetime.strptime(kwargs["date_string"], "%Y-%m-%d")
return date_object

except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion app/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Copyright (c) 2018-2023 Linh Pham
# stats.wwdt.me is released under the terms of the Apache License 2.0
"""Application Version for Wait Wait Stats Page"""
APP_VERSION = "5.6.0"
APP_VERSION = "5.7.0"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
required-version = "23.10.1"
target-version = ["py38", "py39", "py310", "py311", "py312"]
required-version = "23.11.0"
target-version = ["py310", "py311", "py312"]

[tool.pytest.ini_options]
minversion = "7.4"
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
flake8==6.1.0
pycodestyle==2.11.1
pytest==7.4.3
black==23.10.1
black==23.11.0

Flask==3.0.0
gunicorn==21.2.0
Markdown==3.4.3

wwdtm==2.4.0
wwdtm==2.5.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Flask==3.0.0
gunicorn==21.2.0
Markdown==3.4.3

wwdtm==2.4.0
wwdtm==2.5.0

0 comments on commit d3c4f76

Please sign in to comment.