Skip to content

Commit e33c90d

Browse files
Feature: Support python 3.10+ (#92)
* support py3.10+ * fix tests and precommit config * update setup.py * add manifest.in for building package --------- Co-authored-by: Damian Jachyra <[email protected]>
1 parent 2691a1a commit e33c90d

File tree

11 files changed

+57
-43
lines changed

11 files changed

+57
-43
lines changed

.pre-commit-config.yaml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.5.0
3+
rev: v4.4.0
44
hooks:
5-
- id: flake8
6-
language_version: python3.6
7-
args: [
8-
--max-line-length=100,
9-
# We did some funky thing in __init__.py, skip them for now.
10-
--exclude=*__init__.py
11-
]
125
- id: trailing-whitespace
13-
language_version: python3.6
6+
language_version: python3
147
- id: end-of-file-fixer
15-
language_version: python3.6
8+
language_version: python3
169
- id: check-merge-conflict
17-
language_version: python3.6
10+
language_version: python3
1811
- id: requirements-txt-fixer
19-
language_version: python3.6
12+
language_version: python3
2013
- id: name-tests-test
21-
language_version: python3.6
14+
language_version: python3
2215
- id: double-quote-string-fixer
23-
language_version: python3.6
16+
language_version: python3
2417
- id: forbid-new-submodules
25-
language_version: python3.6
18+
language_version: python3
2619
- id: check-yaml
27-
language_version: python3.6
20+
language_version: python3
2821
files: (\.(yaml|yml|eyaml))$
2922
- id: check-json
3023
files: \.(jshintrc|json)$
24+
- repo: https://github.com/pycqa/flake8
25+
rev: ''
26+
hooks:
27+
- id: flake8
28+
language_version: python3
29+
args: [
30+
--max-line-length=100,
31+
# We did some funky thing in __init__.py, skip them for now.
32+
--exclude=*__init__.py
33+
]
3134
- repo: https://github.com/pre-commit/mirrors-autopep8
3235
rev: v1.5.1
3336
hooks:
3437
- id: autopep8
35-
language_version: python3.6
38+
language_version: python3
3639
- repo: https://github.com/asottile/add-trailing-comma
3740
rev: v2.0.1
3841
hooks:
@@ -41,11 +44,11 @@ repos:
4144
rev: v2.2.0
4245
hooks:
4346
- id: reorder-python-imports
44-
language_version: python3.6
47+
language_version: python3
4548
- repo: https://github.com/asottile/pyupgrade
4649
rev: v2.1.1
4750
hooks:
4851
- id: pyupgrade
4952
args:
5053
- --py3-plus
51-
language_version: python3.6
54+
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

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include requirements.txt

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: 11 additions & 12 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
22-
pre-commit==1.21.0
21+
pluggy==1.4
22+
pre-commit==3.7.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

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ def load_requirements():
5353
),
5454
zip_safe=False,
5555
install_requires=load_requirements(),
56-
python_requires='>=3.6',
56+
python_requires='>=3.11',
5757
project_urls={
5858
'Website': 'https://magic.link',
5959
},
6060
classifiers=[
6161
'Development Status :: 3 - Alpha',
6262
'Programming Language :: Python',
63-
'Programming Language :: Python :: 3.6',
63+
'Programming Language :: Python :: 3.11',
6464
'Intended Audience :: Developers',
6565
'License :: OSI Approved :: MIT License',
6666
'Operating System :: OS Independent',

tests/unit/resources/token_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)