Skip to content

Commit

Permalink
Upgraded vendored nocasedict/nocaselist to v2 to get rid of six
Browse files Browse the repository at this point in the history
Details:

* Increased the minimum versions of the vendored 'nocasedict' and 'nocaselist'
  packages to 2.0.x in order to get rid of the dependency to the 'six' package.
  (issue #3155)

* This added a dependency on the 'typing-extensions' package on Python<=3.9.

* Increased versions of vendored nocasedict and nocaselist to v2.x in order to
  get rid of dependency to six package. (issue #3155)

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed May 10, 2024
1 parent 7a5e5a6 commit 560cf7c
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 332 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ pytest_warning_opts := -W default
pytest_end2end_warning_opts := $(pytest_warning_opts)

# Versions of the vendorized packages:
nocasedict_version := 1.1.2
nocaselist_version := 1.1.1
nocasedict_version := 2.0.3
nocaselist_version := 2.0.2

# Dist info directories of the vendorized packages:
nocasedict_dist_dir := nocasedict-$(nocasedict_version).dist-info
Expand Down
3 changes: 0 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ tomlkit>=0.10.1
dill>=0.3.4; python_version <= '3.10'
dill>=0.3.6; python_version >= '3.11'

# rich 13.3.5 requires typing-extensions>=4.0.0,<5.0
typing-extensions>=4.0.0; python_version <= '3.10'

# Flake8 and dependents (no imports, invoked via flake8 script):
# flake8 5.x and 6.x report false positive E231 "missing whitespace after ':'"
# for ':' used in f-strings. This was fixed in pycodestyle 2.11.0, which
Expand Down
11 changes: 8 additions & 3 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ Released: not yet
archives on Pypi never had that directory, but a locally produced
source distribution archives had that directory. (issue #3177)

* Increased the minimum versions of the vendored 'nocasedict' and 'nocaselist'
packages to 2.0.x in order to get rid of the dependency on the 'six' package.
This added a dependency on the 'typing-extensions' package on Python<=3.9.
(issue #3155)

**Known issues:**

* See `list of open issues`_.
Expand Down Expand Up @@ -800,7 +805,7 @@ Released: 2021-04-26
in a non-default namespace because it tried to get the qualifiers from the
default namespace. (see issue #2502)

* Test: Changed dependency to 'typed-ast' to match the needs of 'astroid' and to
* Test: Changed dependency on 'typed-ast' to match the needs of 'astroid' and to
install it only on CPython. This allows re-enabling PyPy3 on Travis.

* Test: Pinned psutil to <=5.6.3 on PyPy2+3 to avoid an installation error.
Expand Down Expand Up @@ -1521,7 +1526,7 @@ below this list.
Python 2.6. For this reason, Python 2.6 support has been removed from pywbem
in its 1.0.0 version.
This allowed eliminating a lot of Python version dependent code,
eliminating the dependency to the unittest2 package, and lifting a number
eliminating the dependency on the unittest2 package, and lifting a number
of restrictions in test code.

* Migrated pywbem to use the 'requests' Python package for all HTTP/HTTPS
Expand Down Expand Up @@ -2059,7 +2064,7 @@ Released: 2019-12-01

* Docs: Fixed errors in description of CIMInstance.update_existing().

* Added dependency to pywin32 package for Windows, and pinned it to version 225
* Added dependency on pywin32 package for Windows, and pinned it to version 225
to work around an issue in its version 226. (See issue ##1946)

* Modified pywbem_mock to create the instance path of new instances
Expand Down
4 changes: 4 additions & 0 deletions minimum-constraints-develop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
# Direct dependencies for test and indirect dependencies for test that are
# needed for some reason (must be consistent with test-requirements.txt)

# six
six==1.14.0; python_version <= '3.9'
six==1.16.0; python_version >= '3.10'

# Unit test (imports into testcases):
packaging==21.3
pytest==4.6.0; python_version <= '3.9'
Expand Down
13 changes: 6 additions & 7 deletions minimum-constraints-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ PyYAML==5.3.1
requests==2.31.0
yamlloader==0.5.5

# The vendorized nocasedict and nocaselist use six
six==1.14.0; python_version <= '3.9'
six==1.16.0; python_version >= '3.10'

# typing-extensions
# nocaselist 2.x requires typing-extensions>=3.10 on Python<=3.9
# rich 12.0.0 requires Python>=3.6 and typing-extensions>=3.7.4,<5.0 on Python<=3.7
# rich 12.1.0 requires Python>=3.6 and typing-extensions>=4.0.0,<5.0 on Python<=3.8
# rich 13.x.x requires Python>=3.7 and typing-extensions>=4.0.0,<5.0 on Python<=3.8
typing-extensions==4.0.0; python_version <= '3.9'

# Indirect dependencies for install that are needed for some reason (must be consistent with requirements.txt)

Expand All @@ -45,6 +47,3 @@ chardet==3.0.2; python_version <= '3.9'
charset-normalizer==2.0.0; python_version >= '3.10'

# funcsigs; is covered in direct deps for develop, from mock

# rich 13.3.5 requires typing-extensions>=4.0.0,<5.0
typing-extensions==4.0.0
7 changes: 5 additions & 2 deletions pywbem/_vendor/nocasedict/_hashable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

from __future__ import print_function, absolute_import

from typing import Any
from ._nocasedict import NocaseDict

__all__ = ['HashableMixin']


class HashableMixin(object):
class HashableMixin(NocaseDict):
# pylint: disable=too-few-public-methods
"""
A mixin class that adds case-insensitive hashability to
Expand Down Expand Up @@ -51,7 +54,7 @@ class MyDict(HashableMixin, NocaseDict):
# 'foo'
"""

def __hash__(self):
def __hash__(self) -> Any:
"""
Return a case-insensitive and order-insensitive hash value for the
dictionary.
Expand Down
6 changes: 4 additions & 2 deletions pywbem/_vendor/nocasedict/_keyableby.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ class NocaseDict.

from __future__ import print_function, absolute_import

from typing import Type

__all__ = ['KeyableByMixin']


def KeyableByMixin(key_attr):
def KeyableByMixin(key_attr: str) -> Type:
# pylint: disable=invalid-name
"""
A generator function returning a mixin class that adds the ability to the
Expand Down Expand Up @@ -40,5 +42,5 @@ def __init__(self, name, thing):
# MyDict({'A': <__main__.Obj object at 0x10bc3d820>,
# 'B': <__main__.Obj object at 0x10bc89af0>})
"""
return type('KeyableByMixin_{}'.format(key_attr),
return type(f'KeyableByMixin_{key_attr}',
(), {'nocasedict_KeyableByMixin_key_attr': key_attr})

0 comments on commit 560cf7c

Please sign in to comment.