Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support python 3.10+ #92

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v4.4.0
hooks:
- id: flake8
language_version: python3.6
args: [
--max-line-length=100,
# We did some funky thing in __init__.py, skip them for now.
--exclude=*__init__.py
]
- id: trailing-whitespace
language_version: python3.6
language_version: python3
- id: end-of-file-fixer
language_version: python3.6
language_version: python3
- id: check-merge-conflict
language_version: python3.6
language_version: python3
- id: requirements-txt-fixer
language_version: python3.6
language_version: python3
- id: name-tests-test
language_version: python3.6
language_version: python3
- id: double-quote-string-fixer
language_version: python3.6
language_version: python3
- id: forbid-new-submodules
language_version: python3.6
language_version: python3
- id: check-yaml
language_version: python3.6
language_version: python3
files: (\.(yaml|yml|eyaml))$
- id: check-json
files: \.(jshintrc|json)$
- repo: https://github.com/pycqa/flake8
rev: ''
hooks:
- id: flake8
language_version: python3
args: [
--max-line-length=100,
# We did some funky thing in __init__.py, skip them for now.
--exclude=*__init__.py
]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.1
hooks:
- id: autopep8
language_version: python3.6
language_version: python3
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.0.1
hooks:
Expand All @@ -41,11 +44,11 @@ repos:
rev: v2.2.0
hooks:
- id: reorder-python-imports
language_version: python3.6
language_version: python3
- repo: https://github.com/asottile/pyupgrade
rev: v2.1.1
hooks:
- id: pyupgrade
args:
- --py3-plus
language_version: python3.6
language_version: python3
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@

- <PR-#ISSUE> ...

## `1.2.0` - 04/16/2024

#### Changed

- Support for up to python 3.11:
- Bump web3 dependencies, bump some dev dependencies.
- Replace deprecated eth_account methods on the account recovery.
- Bump websockets to 10.0 to support python 3.10+


## `1.0.0` - 07/05/2023

#### Added
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ development: virtualenv_run install_prod_requirements install_dev_requirements i

.PHONY: virtualenv_run
virtualenv_run:
virtualenv -p python3.6 virtualenv_run
virtualenv -p python3.11 virtualenv_run
virtualenv_run/bin/pip install --upgrade pip

.PHONY: install_prod_requirements
Expand Down
6 changes: 3 additions & 3 deletions magic_admin/resources/token.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import base64
import json

from eth_account.messages import defunct_hash_message
from eth_account.messages import encode_defunct
from web3.auto import w3

import magic_admin
Expand Down Expand Up @@ -147,8 +147,8 @@ def validate(cls, did_token):
'with a suitable value.',
)

recovered_address = w3.eth.account.recoverHash(
defunct_hash_message(
recovered_address = w3.eth.account.recover_message(
encode_defunct(
text=json.dumps(claim, separators=(',', ':')),
),
signature=proof,
Expand Down
2 changes: 1 addition & 1 deletion magic_admin/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.0.0'
VERSION = '1.2.0'
23 changes: 11 additions & 12 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
appnope==0.1.0
aspy.yaml==1.3.0
attrs==19.3.0
attrs==22.2.0
backcall==0.1.0
cfgv==3.1.0
coverage==4.5.1
coverage==5.2.1
decorator==4.4.2
identify==1.4.14
importlib-metadata==1.6.0
Expand All @@ -14,26 +14,25 @@ ipython-genutils==0.2.0
jedi==0.16.0
more-itertools==8.2.0
nodeenv==1.3.5
packaging==21.3
packaging==23.2
parso==0.6.2
pexpect==4.8.0
pickleshare==0.7.5
pluggy==0.13.1
pre-commit==1.21.0
pluggy==1.4
pre-commit==3.7.0
pretend==1.0.8
prompt-toolkit==3.0.5
ptyprocess==0.6.0
py==1.8.1
py==1.11.0
Pygments==2.7.4
pyparsing==2.4.7
pytest==5.4.1
pytest-cov==2.8.1
pytest-mock==3.6.1
PyYAML==5.4.1
pytest== 8.1.1
pytest-cov==5.0.0
pytest-mock==3.14.0
six==1.14.0
toml==0.10.0
tox==3.0.0
tox==4.14.0
traitlets==4.3.3
virtualenv==16.7.9
virtualenv==20.25
wcwidth==0.1.9
zipp==3.1.0
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests >= 2.22.0, <3
web3 >= 4.8.1, <6
web3 >= 6
websockets >= 10.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def load_requirements():
),
zip_safe=False,
install_requires=load_requirements(),
python_requires='>=3.6',
python_requires='>=3.11',
project_urls={
'Website': 'https://magic.link',
},
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.11',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/resources/token_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def setup_mocks(self):
'decode',
return_value=(proof, claim),
) as decode, mock.patch(
'magic_admin.resources.token.w3.eth.account.recoverHash',
'magic_admin.resources.token.w3.eth.account.recover_message',
return_value=self.public_address,
) as recoverHash, mock.patch(
'magic_admin.resources.token.defunct_hash_message',
'magic_admin.resources.token.encode_defunct',
) as defunct_hash_message, mock.patch.object(
Token,
'get_public_address',
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist = py36
envlist = py311,py39,py310
skipsdist=True

[testenv]
passenv = HOME SSH_AUTH_SOCK USER
passenv = HOME,SSH_AUTH_SOCK,USER
envdir = .virtualenv_run_test
commands =
pip install -r requirements.txt
Expand Down