Skip to content

Commit

Permalink
Bump typing-extensions and typeapi (#60)
Browse files Browse the repository at this point in the history
* Bump the permitted typeapi version

* typing-extensions version depending on Python version

* Enter changelog entry

* PR 60

* Fix dependency specification and add changelogs

* Conform to previous Tomli format

* Bump poetry-core build backend, avoid `six.moves` error

```
> import six.moves.urllib.parse as urllib_parse
ModuleNotFoundError: No module named 'six.moves'
```

* `slap test` stops erroring on py3.10

* The assert does not fail in any supported Python version, so we just
remove it

* types is not used anymore, so we remove it

* Drop support for python 3.6 and 3.7

* bin dev dependencies and run black fmt

* add flake8 ignore

* pin black 23 for now to reduce diff

* push docs on develop only

---------

Co-authored-by: Niklas Rosenstein <[email protected]>
  • Loading branch information
rhaps0dy and NiklasRosenstein authored Mar 19, 2024
1 parent 68361ed commit a976fb2
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 40 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.x"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.x"]
steps:
- uses: actions/checkout@v2
- uses: NiklasRosenstein/slap@gha/install/v1
Expand All @@ -28,4 +28,5 @@ jobs:
- run: slap --version && slap install --only-extras docs --no-venv-check
- run: slap run --no-venv-check docs:build
- uses: JamesIves/[email protected]
with: { branch: gh-pages, folder: docs/_site, ssh-key: "${{ secrets.DEPLOY_KEY }}" }
with: { branch: gh-pages, folder: docs/_site, ssh-key: "${{ secrets.DEPLOY_KEY }}" }
if: github.ref == 'refs/heads/develop'
9 changes: 9 additions & 0 deletions databind.core/.changelog/_unreleased.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[[entries]]
id = "04482ac4-46c4-461d-962c-d7998cd01548"
type = "breaking change"
description = "Support typing-extensions>4.7 for Python 3.8 or greater"
author = "@rhaps0dy"
pr = "https://github.com/NiklasRosenstein/python-databind/pull/60"
issues = [
"https://github.com/NiklasRosenstein/python-databind/issues/59",
]
22 changes: 11 additions & 11 deletions databind.core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "databind.core"
version = "4.4.2"
description = "Databind is a library inspired by jackson-databind to de-/serialize Python dataclasses. Compatible with Python 3.7 and newer."
description = "Databind is a library inspired by jackson-databind to de-/serialize Python dataclasses. Compatible with Python 3.8 and newer."
authors = ["Niklas Rosenstein <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand All @@ -14,20 +14,20 @@ Documentation = "https://niklasrosenstein.github.io/python-databind/"
Repository = "https://github.com/NiklasRosenstein/python-databind"

[tool.poetry.dependencies]
python = "^3.6.3"
python = "^3.8.0"
Deprecated = "^1.2.12"
nr-date = "^2.0.0"
nr-stream = "^1.0.0"
setuptools = { version = ">=40.8.0", markers = "python_version < '3.10'" }
typeapi = "^2.0.1"
typing-extensions = ">=3.10.0,<4.7" # See https://github.com/python/typing_extensions/issues/265#issuecomment-1616809112
typeapi = ">=2.0.1,<3"
typing-extensions = ">=3.10.0,<5"

[tool.poetry.dev-dependencies]
black = "*"
flake8 = "*"
isort = "*"
pytest = "*"
mypy = "*"
black = ">=23.0.0,<24.0.0"
flake8 = ">=5.0.4,<8.0.0"
isort = ">=5.13.2,<6.0.0"
pytest = ">=8.1.1,<9.0.0"
mypy = ">=1.9.0,<2.0.0"
types-dataclasses = "*"
types-deprecated = "*"
types-setuptools = "*"
Expand All @@ -37,7 +37,7 @@ types-termcolor = "*"
typed = true

[build-system]
requires = ["poetry-core==1.0.8"]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"

[tool.slap.test]
Expand All @@ -52,7 +52,7 @@ flake8 = "flake8 src/"
fmt = "black src/ && isort src/"

[tool.mypy]
python_version = "3.6"
python_version = "3.8"
explicit_package_bases = true
mypy_path = ["src"]
namespace_packages = true
Expand Down
6 changes: 0 additions & 6 deletions databind.core/src/databind/core/tests/schema_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# In Python 3.6, we get a warning about an unused ignore later in the file, but not in other versions of Python.
# Let's ignore that warning for the whole file, there doesn't seem to be a better way to have Mypy ignore the unused
# ignore comment.

# mypy: no-warn-unused-ignores

import dataclasses
import typing as t

Expand Down
9 changes: 9 additions & 0 deletions databind.json/.changelog/_unreleased.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[[entries]]
id = "6aab96f1-c6c0-4afe-bd73-0071d5dedebb"
type = "breaking change"
description = "Support typing-extensions>4.7 for Python 3.8 or greater"
author = "@rhaps0dy"
pr = "https://github.com/NiklasRosenstein/python-databind/pull/60"
issues = [
"https://github.com/NiklasRosenstein/python-databind/issues/59",
]
1 change: 1 addition & 0 deletions databind.json/.flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
max-line-length = 120
extend-ignore = W503,W504,E203,E704,E701
22 changes: 11 additions & 11 deletions databind.json/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "databind.json"
version = "4.4.2"
description = "De-/serialize Python dataclasses to or from JSON payloads. Compatible with Python 3.7 and newer."
description = "De-/serialize Python dataclasses to or from JSON payloads. Compatible with Python 3.8 and newer."
authors = ["Niklas Rosenstein <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand All @@ -14,21 +14,21 @@ Documentation = "https://niklasrosenstein.github.io/python-databind/"
Repository = "https://github.com/NiklasRosenstein/python-databind"

[tool.poetry.dependencies]
python = "^3.6.3"
python = "^3.8.0"
"databind.core" = "^4.4.2"
nr-date = "^2.0.0"
typeapi = "^2.0.1"
typing-extensions = ">=3.10.0,<4.7" # See https://github.com/python/typing_extensions/issues/265#issuecomment-1616809112
typeapi = ">=2.0.1,<3"
typing-extensions = ">=3.10.0,<5"

[tool.poetry.dev-dependencies]
black = "*"
flake8 = "*"
isort = "*"
pytest = "*"
mypy = "*"
black = ">=23.0.0,<24.0.0"
flake8 = ">=5.0.4,<8.0.0"
isort = ">=5.13.2,<6.0.0"
pytest = ">=8.1.1,<9.0.0"
mypy = ">=1.9.0,<2.0.0"

[build-system]
requires = ["poetry-core==1.0.8"]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"

[tool.slap]
Expand All @@ -46,7 +46,7 @@ flake8 = "flake8 src/"
fmt = "black src/ && isort src/"

[tool.mypy]
python_version = "3.6"
python_version = "3.8"
explicit_package_bases = true
mypy_path = ["src"]
namespace_packages = true
Expand Down
14 changes: 7 additions & 7 deletions databind.json/src/databind/json/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import datetime
import decimal
import enum
import types
import typing as t

from databind.core import (
Expand Down Expand Up @@ -167,7 +166,6 @@ def _length_check() -> None:
try:
return python_type(values)
except TypeError:
assert not isinstance(values, types.GeneratorType), (type(values), python_type)
# We assume that the native list is an appropriate placeholder for whatever specific Collection type
# was chosen in the value's datatype.
return values
Expand All @@ -193,11 +191,13 @@ def convert(self, ctx: Context) -> t.Any:
datefmt = ctx.get_setting(DateFormat) or (
self.DEFAULT_DATE_FMT
if date_type == datetime.date
else self.DEFAULT_TIME_FMT
if date_type == datetime.time
else self.DEFAULT_DATETIME_FMT
if date_type == datetime.datetime
else None
else (
self.DEFAULT_TIME_FMT
if date_type == datetime.time
else self.DEFAULT_DATETIME_FMT
if date_type == datetime.datetime
else None
)
)
assert datefmt is not None

Expand Down
6 changes: 3 additions & 3 deletions databind/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[tool.poetry]
name = "databind"
version = "4.4.2"
description = "Databind is a library inspired by jackson-databind to de-/serialize Python dataclasses. The `databind` package will install the full suite of databind packages. Compatible with Python 3.7 and newer."
description = "Databind is a library inspired by jackson-databind to de-/serialize Python dataclasses. The `databind` package will install the full suite of databind packages. Compatible with Python 3.8 and newer."
authors = ["Niklas Rosenstein <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [{ include="databind/_version", from="src" }]

[tool.poetry.dependencies]
python = "^3.6.3"
python = "^3.8.0"
"databind.core" = "^4.4.2"
"databind.json" = "^4.4.2"

[build-system]
requires = ["poetry-core==1.0.8"]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit a976fb2

Please sign in to comment.