From 52e818edf6f9e82bc7dce967c15eb500a68a6363 Mon Sep 17 00:00:00 2001 From: "Stephen J. Fuhry" Date: Tue, 2 Apr 2024 15:03:57 +0000 Subject: [PATCH] run python 3.12 in the build, formatting tweaks --- .github/workflows/black.yml | 1 + .github/workflows/build.yml | 29 +++++++++++++++-------------- .github/workflows/mypy.yml | 5 +++-- marshmallow_jsonschema/__init__.py | 6 +++--- marshmallow_jsonschema/base.py | 6 +++--- pyproject.toml | 2 +- setup.py | 4 ++-- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index b04fb15..1525a38 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,3 +1,4 @@ +--- name: Lint on: [push, pull_request] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f0ed76..2bad979 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,4 @@ +--- name: Test Coverage on: ["push", "pull_request"] @@ -12,18 +13,18 @@ jobs: # # Please bump to the latest unreleased candidate # when you come across this and have a moment to spare! - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@master - - name: set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -U tox tox-gh-actions - pip install -r requirements-tox.txt -r requirements-test.txt - - name: Run tox - run: | - tox -e py + - uses: actions/checkout@master + - name: set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U tox tox-gh-actions + pip install -r requirements-tox.txt -r requirements-test.txt + - name: Run tox + run: | + tox -e py diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index c3b5bd7..323ee9b 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,3 +1,4 @@ +--- name: Lint on: @@ -10,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.11.2 + python-version: '3.11' architecture: x64 - name: Checkout uses: actions/checkout@v1 diff --git a/marshmallow_jsonschema/__init__.py b/marshmallow_jsonschema/__init__.py index 3e60b2a..fa254c7 100644 --- a/marshmallow_jsonschema/__init__.py +++ b/marshmallow_jsonschema/__init__.py @@ -1,9 +1,9 @@ -from pkg_resources import get_distribution +from importlib.metadata import version -__version__ = get_distribution("marshmallow-jsonschema").version +__version__ = version("marshmallow-jsonschema") __license__ = "MIT" from .base import JSONSchema from .exceptions import UnsupportedValueError -__all__ = ("JSONSchema", "UnsupportedValueError") +__all__ = ("JSONSchema", "UnsupportedValueError", "__version__", "__license__") diff --git a/marshmallow_jsonschema/base.py b/marshmallow_jsonschema/base.py index 2db5a3d..928303b 100644 --- a/marshmallow_jsonschema/base.py +++ b/marshmallow_jsonschema/base.py @@ -166,9 +166,9 @@ def get_properties(self, obj) -> typing.Dict[str, typing.Dict[str, typing.Any]]: for field_name, field in fields_items_sequence: schema = self._get_schema_for_field(obj, field) - properties[ - field.metadata.get("name") or field.data_key or field.name - ] = schema + properties[field.metadata.get("name") or field.data_key or field.name] = ( + schema + ) return properties diff --git a/pyproject.toml b/pyproject.toml index 461e58a..960b197 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [tool.black] -target-version = ['py39', 'py310'] +target-version = ['py39', 'py310', 'py311', 'py312'] diff --git a/setup.py b/setup.py index 4974e20..60d52df 100644 --- a/setup.py +++ b/setup.py @@ -60,11 +60,11 @@ def read(fname): "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "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", + "Programming Language :: Python :: 3.12", ], test_suite="tests", )