Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.12 #363

Merged
merged 5 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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