Skip to content

Commit 4119d57

Browse files
committed
support py3.10+
1 parent 44907fa commit 4119d57

File tree

8 files changed

+43
-33
lines changed

8 files changed

+43
-33
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@ repos:
33
rev: v2.5.0
44
hooks:
55
- id: flake8
6-
language_version: python3.6
6+
language_version: python3
77
args: [
88
--max-line-length=100,
99
# We did some funky thing in __init__.py, skip them for now.
1010
--exclude=*__init__.py
1111
]
1212
- id: trailing-whitespace
13-
language_version: python3.6
13+
language_version: python3
1414
- id: end-of-file-fixer
15-
language_version: python3.6
15+
language_version: python3
1616
- id: check-merge-conflict
17-
language_version: python3.6
17+
language_version: python3
1818
- id: requirements-txt-fixer
19-
language_version: python3.6
19+
language_version: python3
2020
- id: name-tests-test
21-
language_version: python3.6
21+
language_version: python3
2222
- id: double-quote-string-fixer
23-
language_version: python3.6
23+
language_version: python3
2424
- id: forbid-new-submodules
25-
language_version: python3.6
25+
language_version: python3
2626
- id: check-yaml
27-
language_version: python3.6
27+
language_version: python3
2828
files: (\.(yaml|yml|eyaml))$
2929
- id: check-json
3030
files: \.(jshintrc|json)$
3131
- repo: https://github.com/pre-commit/mirrors-autopep8
3232
rev: v1.5.1
3333
hooks:
3434
- id: autopep8
35-
language_version: python3.6
35+
language_version: python3
3636
- repo: https://github.com/asottile/add-trailing-comma
3737
rev: v2.0.1
3838
hooks:
@@ -41,11 +41,11 @@ repos:
4141
rev: v2.2.0
4242
hooks:
4343
- id: reorder-python-imports
44-
language_version: python3.6
44+
language_version: python3
4545
- repo: https://github.com/asottile/pyupgrade
4646
rev: v2.1.1
4747
hooks:
4848
- id: pyupgrade
4949
args:
5050
- --py3-plus
51-
language_version: python3.6
51+
language_version: python3

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212

1313
- <PR-#ISSUE> ...
1414

15+
## `1.2.0` - 04/16/2024
16+
17+
#### Changed
18+
19+
- Support for up to python 3.11:
20+
- Bump web3 dependencies, bump some dev dependencies.
21+
- Replace deprecated eth_account methods on the account recovery.
22+
- Bump websockets to 10.0 to support python 3.10+
23+
24+
1525
## `1.0.0` - 07/05/2023
1626

1727
#### Added

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ development: virtualenv_run install_prod_requirements install_dev_requirements i
66

77
.PHONY: virtualenv_run
88
virtualenv_run:
9-
virtualenv -p python3.6 virtualenv_run
9+
virtualenv -p python3.11 virtualenv_run
1010
virtualenv_run/bin/pip install --upgrade pip
1111

1212
.PHONY: install_prod_requirements

magic_admin/resources/token.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import base64
22
import json
33

4-
from eth_account.messages import defunct_hash_message
4+
from eth_account.messages import encode_defunct
55
from web3.auto import w3
66

77
import magic_admin
@@ -147,8 +147,8 @@ def validate(cls, did_token):
147147
'with a suitable value.',
148148
)
149149

150-
recovered_address = w3.eth.account.recoverHash(
151-
defunct_hash_message(
150+
recovered_address = w3.eth.account.recover_message(
151+
encode_defunct(
152152
text=json.dumps(claim, separators=(',', ':')),
153153
),
154154
signature=proof,

magic_admin/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '1.0.0'
1+
VERSION = '1.2.0'

requirements-dev.txt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
appnope==0.1.0
22
aspy.yaml==1.3.0
3-
attrs==19.3.0
3+
attrs==22.2.0
44
backcall==0.1.0
55
cfgv==3.1.0
6-
coverage==4.5.1
6+
coverage==5.2.1
77
decorator==4.4.2
88
identify==1.4.14
99
importlib-metadata==1.6.0
@@ -14,26 +14,25 @@ ipython-genutils==0.2.0
1414
jedi==0.16.0
1515
more-itertools==8.2.0
1616
nodeenv==1.3.5
17-
packaging==21.3
17+
packaging==23.2
1818
parso==0.6.2
1919
pexpect==4.8.0
2020
pickleshare==0.7.5
21-
pluggy==0.13.1
21+
pluggy==1.4
2222
pre-commit==1.21.0
2323
pretend==1.0.8
2424
prompt-toolkit==3.0.5
2525
ptyprocess==0.6.0
26-
py==1.8.1
26+
py==1.11.0
2727
Pygments==2.7.4
2828
pyparsing==2.4.7
29-
pytest==5.4.1
30-
pytest-cov==2.8.1
31-
pytest-mock==3.6.1
32-
PyYAML==5.4.1
29+
pytest== 8.1.1
30+
pytest-cov==5.0.0
31+
pytest-mock==3.14.0
3332
six==1.14.0
3433
toml==0.10.0
35-
tox==3.0.0
34+
tox==4.14.0
3635
traitlets==4.3.3
37-
virtualenv==16.7.9
36+
virtualenv==20.25
3837
wcwidth==0.1.9
3938
zipp==3.1.0

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
requests >= 2.22.0, <3
2-
web3 >= 4.8.1, <6
2+
web3 >= 6
3+
websockets >= 10.0

tests/unit/resources/token_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ class TestTokenValidate:
151151
'proof',
152152
'claim',
153153
'decode',
154-
'recoverHash',
155-
'defunct_hash_message',
154+
'recover_message',
155+
'encode_defunct',
156156
'get_public_address',
157157
'epoch_time_now',
158158
'apply_did_token_nbf_grace_period',
@@ -173,10 +173,10 @@ def setup_mocks(self):
173173
'decode',
174174
return_value=(proof, claim),
175175
) as decode, mock.patch(
176-
'magic_admin.resources.token.w3.eth.account.recoverHash',
176+
'magic_admin.resources.token.w3.eth.account.recover_message',
177177
return_value=self.public_address,
178178
) as recoverHash, mock.patch(
179-
'magic_admin.resources.token.defunct_hash_message',
179+
'magic_admin.resources.token.encode_defunct',
180180
) as defunct_hash_message, mock.patch.object(
181181
Token,
182182
'get_public_address',

0 commit comments

Comments
 (0)