Skip to content

Commit

Permalink
Upgrade dev dependencies.
Browse files Browse the repository at this point in the history
* Update _orderedbidict.py with an additional type annotation
  required by the lastest version of pyright.
* Pin to docutils 0.17.1 while sphinx-doc/sphinx#10531 is unfixed.
  • Loading branch information
jab committed Jul 1, 2022
1 parent 045f8bf commit f185571
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -16,7 +16,7 @@ repos:
- id: codespell

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.960
rev: v0.961
hooks:
- id: mypy
exclude: setup.py|docs/conf.py|tests
Expand Down
3 changes: 2 additions & 1 deletion bidict/_orderedbidict.py
Expand Up @@ -141,7 +141,8 @@ def method(self: t.Union[_OrderedBidictKeysView[KT], _OrderedBidictItemsView[KT,
# Use arg's backing dict's corresponding view instead of arg. Otherwise, e.g. `ob1.keys() < ob2.keys()` would give
# "TypeError: '<' not supported between instances of '_OrderedBidictKeysView' and '_OrderedBidictKeysView'", because
# both `dict_keys(ob1).__lt__(ob2.keys()) is NotImplemented` and `dict_keys(ob2).__gt__(ob1.keys()) is NotImplemented`.
arg_dict_view = getattr(args[0]._mapping._fwdm, viewname)()
arg_dict: t.Dict[t.Any, t.Any] = args[0]._mapping._fwdm
arg_dict_view = getattr(arg_dict, viewname)()

This comment has been minimized.

Copy link
@jab

jab Jul 1, 2022

Author Owner

@erictraut, in case this seems like a possible recent regression in pyright:

As part of monthly maintenance, this PR upgrades pyright from version 1.1.252 to 1.1.256, and this caused the following new error to be emitted here on line 144 without the changes on these two lines:

/workspaces/bidict/bidict/_orderedbidict.py:144:37 - error: Argument type is partially unknown
Argument corresponds to parameter "__o" in function "getattr"
Argument type is "dict[Unknown, Unknown]" (reportUnknownArgumentType)

Seems like this could be a case of pyright's type inference either getting better or worse, so I'm not reporting this as a bug in pyright while I don't know which.

Hope the ping here is helpful in any case!

This comment has been minimized.

Copy link
@erictraut

erictraut Jul 1, 2022

Thanks for the ping. This is indeed a regression in pyright 1.1.256. It was already reported by another pyright user, and I've introduced a fix that will appear in 1.1.257. Apologies for the inconvenience.

I guess this is another argument in favor of using bidict for pyright regression testing.

This comment has been minimized.

Copy link
@jab

jab Jul 2, 2022

Author Owner

Thanks for the quick reply! Opened a draft PR (#249) to remove this workaround and upgrade to pyright 1.1.257 once it's been released.

Would be great if bidict could help prevent regressions in pyright in the future! I sketched out a low-effort proposal in microsoft/pyright#3530 (reply in thread), in case that might be helpful.

This comment has been minimized.

Copy link
@jab

jab Jul 3, 2022

Author Owner

Upgraded to pyright 1.1.257 now that it's been released and confirmed this workaround is no longer necessary.

I may not have time to continue keeping up with new pyright releases on a monthly basis for at least the next couple months, but in the meantime, hopefully bidict can be integrated into pyright's CI in some way to help prevent future regressions in a more automated fashion. If you need any help with that process on the bidict side, don't hesitate to send an issue or PR bidict's way -- someone (either I or @johnzeringue, bidict's backup maintainer) should still be responsive within a reasonable timeframe.

return fwdm_dict_view_method(arg_dict_view)
method.__name__ = methodname
method.__qualname__ = f'{cls.__qualname__}.{methodname}'
Expand Down
12 changes: 6 additions & 6 deletions requirements/dev.txt
Expand Up @@ -9,24 +9,24 @@
-r lint.txt
-r tests.txt
build==0.8.0
# via check-manifest
# via
# check-manifest
# pip-tools
check-manifest==0.48
# via -r requirements/dev.in
click==8.1.3
# via
# pip-compile-multi
# pip-tools
pep517==0.12.0
# via
# build
# pip-tools
# via build
pip-compile-multi==2.4.5
# via -r requirements/dev.in
pip-tools==6.6.2
pip-tools==6.8.0
# via pip-compile-multi
toposort==1.7
# via pip-compile-multi
tox==3.25.0
tox==3.25.1
# via -r requirements/dev.in
wheel==0.37.1
# via pip-tools
Expand Down
1 change: 1 addition & 0 deletions requirements/docs.in
@@ -1,3 +1,4 @@
furo
sphinx
docutils==0.17.1 # TODO: remove this line once https://github.com/sphinx-doc/sphinx/issues/10531 is fixed
sphinx-copybutton
23 changes: 14 additions & 9 deletions requirements/docs.txt
@@ -1,4 +1,4 @@
# SHA1:8eac8303d3f8f56a476fe673bdee9e142c5b17ef
# SHA1:3b8f653ca81104a8d30304699dc579746cfa3266
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand All @@ -7,21 +7,23 @@
#
alabaster==0.7.12
# via sphinx
babel==2.10.1
babel==2.10.3
# via sphinx
beautifulsoup4==4.11.1
# via furo
certifi==2022.5.18.1
certifi==2022.6.15
# via requests
charset-normalizer==2.0.12
charset-normalizer==2.1.0
# via requests
docutils==0.17.1
# via sphinx
furo==2022.4.7
# via
# -r requirements/docs.in
# sphinx
furo==2022.6.21
# via -r requirements/docs.in
idna==3.3
# via requests
imagesize==1.3.0
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
# via sphinx
Expand All @@ -37,17 +39,20 @@ pyparsing==3.0.9
# via packaging
pytz==2022.1
# via babel
requests==2.27.1
requests==2.28.1
# via sphinx
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.3.2.post1
# via beautifulsoup4
sphinx==4.5.0
sphinx==5.0.2
# via
# -r requirements/docs.in
# furo
# sphinx-basic-ng
# sphinx-copybutton
sphinx-basic-ng==0.0.1a12
# via furo
sphinx-copybutton==0.5.0
# via -r requirements/docs.in
sphinxcontrib-applehelp==1.0.2
Expand Down
14 changes: 8 additions & 6 deletions requirements/lint.txt
Expand Up @@ -5,7 +5,7 @@
#
# pip-compile-multi
#
astroid==2.11.5
astroid==2.11.6
# via pylint
attrs==21.4.0
# via
Expand All @@ -17,9 +17,11 @@ dill==0.3.5.1
# via pylint
distlib==0.3.4
# via virtualenv
exceptiongroup==1.0.0rc8
# via hypothesis
filelock==3.7.1
# via virtualenv
hypothesis==6.46.11
hypothesis==6.48.2
# via -r requirements/lint.in
identify==2.5.1
# via pre-commit
Expand All @@ -31,7 +33,7 @@ lazy-object-proxy==1.7.1
# via astroid
mccabe==0.7.0
# via pylint
nodeenv==1.6.0
nodeenv==1.7.0
# via
# pre-commit
# pyright
Expand All @@ -47,11 +49,11 @@ pre-commit==2.19.0
# via -r requirements/lint.in
py==1.11.0
# via pytest
pylint==2.14.0
pylint==2.14.4
# via -r requirements/lint.in
pyparsing==3.0.9
# via packaging
pyright==1.1.252
pyright==1.1.256
# via -r requirements/lint.in
pytest==7.1.2
# via -r requirements/lint.in
Expand All @@ -69,7 +71,7 @@ tomli==2.0.1
# pytest
tomlkit==0.11.0
# via pylint
virtualenv==20.14.1
virtualenv==20.15.1
# via pre-commit
wrapt==1.14.1
# via astroid
Expand Down
4 changes: 3 additions & 1 deletion requirements/tests.txt
Expand Up @@ -14,7 +14,9 @@ coverage[toml]==6.4.1
# via
# -r requirements/tests.in
# pytest-cov
hypothesis==6.46.11
exceptiongroup==1.0.0rc8
# via hypothesis
hypothesis==6.48.2
# via -r requirements/tests.in
icdiff==2.0.5
# via pytest-icdiff
Expand Down

0 comments on commit f185571

Please sign in to comment.