Skip to content

Commit

Permalink
Support Python 3.12 (#363)
Browse files Browse the repository at this point in the history
* support python 3.12

* remove filters

* handle pytest warning

* try to ignore all pytest warnings

* drop 3.7 support
  • Loading branch information
blink1073 authored May 30, 2023
1 parent 7312b7a commit 1b5e8e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
include:
- os: windows-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.8"
- os: ubuntu-latest
python-version: "3.10"
python-version: "3.12.0-beta.1"
- os: macos-latest
python-version: "3.8"
python-version: "3.10"
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
Expand Down
13 changes: 13 additions & 0 deletions nbformat/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@

try:
import sqlite3

# Use adapters recommended by Python 3.12 stdlib docs.
# https://docs.python.org/3.12/library/sqlite3.html#default-adapters-and-converters-deprecated
def adapt_datetime_iso(val):
"""Adapt datetime.datetime to timezone-naive ISO 8601 date."""
return val.isoformat()

def convert_datetime(val):
"""Convert ISO 8601 datetime to datetime.datetime object."""
return datetime.fromisoformat(val.decode())

sqlite3.register_adapter(datetime, adapt_datetime_iso)
sqlite3.register_converter("datetime", convert_datetime)
except ImportError:
try:
from pysqlite2 import dbapi2 as sqlite3 # type:ignore[no-redef]
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"fastjsonschema",
"jsonschema>=2.6",
"jupyter_core",
"traitlets>=5.1",
"importlib-metadata>=3.6;python_version<\"3.8\"",
"traitlets>=5.1"
]

[[project.authors]]
Expand Down Expand Up @@ -110,6 +108,8 @@ filterwarnings = [
"error",
"ignore:Using or importing the ABCs from 'collections':DeprecationWarning:jsonschema",
"module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning",
# ignore pytest warnings.
"ignore:::_pytest",
]

[tool.coverage.report]
Expand Down

0 comments on commit 1b5e8e4

Please sign in to comment.