Skip to content

Commit

Permalink
Use packaging library to avoid DeprecationWarning from distutils (#435)
Browse files Browse the repository at this point in the history
* Use packaging library to avoid DeprecationWarning from distutils

`distutils.version.LooseVersion` has been deprecated since
pypa/distutils#75.

This instead replaces that with `packaging.version.Version` from the packaging
library: https://packaging.pypa.io/en/latest/.

* Bump Black version to include fix for new Click release with breaking changes

Click 8.1.0 was recently released which removed deprecated features. Black used
to depend on the deprecated features, but that was fixed in version 22.3.0 so
it again works with the latest version of Click.

* Update AUTHORS and CHANGELOG

Co-authored-by: Steven Loria <sloria1@gmail.com>
  • Loading branch information
Tenzer and sloria authored Jul 18, 2022
1 parent 29fda37 commit 1826a47
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/python/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
language_version: python3
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Contributors
- Martijn Pieters `@mjpieters <https://github.com/mjpieters>`_
- Bruce Adams `@bruceadams <https://github.com/bruceadams>`_
- Justin Crown `@mrname <https://github.com/mrname>`_
- Jeppe Fihl-Pearson `@Tenzer <https://github.com/Tenzer>`_
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
---------

0.28.1 (unreleased)
+++++++++++++++++++

Bug fixes:

* Address ``DeprecationWarning`` re: usage of ``distutils`` (:pr:`435`).
Thanks :user:`Tenzer` for the PR.

0.28.0 (2022-03-09)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import find_packages, setup

INSTALL_REQUIRES = ("marshmallow>=3.0.0", "SQLAlchemy>=1.3.0")
INSTALL_REQUIRES = ("marshmallow>=3.0.0", "SQLAlchemy>=1.3.0", "packaging>=21.3")
EXTRAS_REQUIRE = {
"tests": ["pytest", "pytest-lazy-fixture>=0.6.2"],
"lint": ["flake8==4.0.1", "flake8-bugbear==22.3.23", "pre-commit~=2.0"],
Expand Down
4 changes: 2 additions & 2 deletions src/marshmallow_sqlalchemy/convert.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import inspect
import functools
import warnings
from distutils.version import LooseVersion

import uuid
import marshmallow as ma
from marshmallow import validate, fields
from packaging.version import Version
from sqlalchemy.dialects import postgresql, mysql, mssql
from sqlalchemy.orm import SynonymProperty
import sqlalchemy as sa
Expand All @@ -14,7 +14,7 @@
from .fields import Related, RelatedList


_META_KWARGS_DEPRECATED = LooseVersion(ma.__version__) >= LooseVersion("3.10.0")
_META_KWARGS_DEPRECATED = Version(ma.__version__) >= Version("3.10.0")


def _is_field(value):
Expand Down

0 comments on commit 1826a47

Please sign in to comment.