Skip to content

Commit

Permalink
dependencies check and up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
solarw committed Aug 15, 2022
1 parent 43ce59f commit 0ba5f4d
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 175 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ Pipfile.lock: Pipfile setup.py
pipenv lock --dev

requirements.txt: Pipfile.lock
pipenv lock -r > $@
pipenv requirements > $@

requirements-dev.txt: Pipfile.lock
pipenv lock -r --dev > $@
pipenv requirements --dev-only > $@

.PHONY: requirements
requirements: $(REQUIREMENTS_FILES)
Expand Down
38 changes: 7 additions & 31 deletions cosmpy/crypto/hashfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,8 @@

import hashlib

from _hashlib import HASH # type: ignore # pylint: disable=no-name-in-module

# Detect if ripemd160 can actually be used in the system. Querying `hashlib.algorithms_available`
# does not mean much and will fail on 22.04 LTS
try:
hashlib.new("ripemd160")
_ripemd160_present = True
except ValueError:
_ripemd160_present = False
# pycryptodome, a dependency of bip-utils
from Crypto.Hash import RIPEMD160 # type: ignore # nosec


def sha256(contents: bytes) -> bytes:
Expand All @@ -40,37 +33,20 @@ def sha256(contents: bytes) -> bytes:
:return: bytes sha256 hash.
"""
h: HASH = hashlib.sha256()
h.update(contents)
return h.digest()


def _ripemd160_stdlib(contents: bytes) -> bytes:
h: HASH = hashlib.new("ripemd160")
h.update(contents)
return h.digest()


def _ripemd160_mbedtls(contents: bytes) -> bytes:
from mbedtls import hashlib as alt_hashlib

h: HASH = alt_hashlib.new("ripemd160")
h = hashlib.sha256()
h.update(contents)
return h.digest()


def ripemd160(contents: bytes) -> bytes:
"""
Get ripemd160 hash.
Get ripemd160 hash using PyCryptodome.
:param contents: bytes contents.
:return: bytes ripemd160 hash.
"""

# Check if we need to use the fallback hashlib
if not _ripemd160_present:
return _ripemd160_mbedtls(contents)

# Prefer the stdlib implementation
return _ripemd160_stdlib(contents)
h = RIPEMD160.new()
h.update(contents)
return h.digest()
188 changes: 96 additions & 92 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,102 +1,106 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements --dev
#

# Note: in pipenv 2020.x, "--dev" changed to emit both default and development
# requirements. To emit only development requirements, pass "--dev-only".

-i https://pypi.org/simple
-e .
alabaster==0.7.12
appdirs==1.4.4
astroid==2.6.6; python_version ~= '3.6'
attrs==21.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
babel==2.9.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
backports.entry-points-selectable==1.1.0; python_version >= '2.7'
bandit==1.7.0
asn1crypto==1.5.1
astroid==2.11.7; python_full_version >= '3.6.2'
attrs==22.1.0; python_version >= '3.5'
bandit==1.7.4; python_version >= '3.7'
bech32==1.2.0; python_version >= '3.5'
black==21.6b0; python_full_version >= '3.6.2'
build==0.7.0; python_version >= '3.6'
cachetools==4.2.4; python_version ~= '3.5'
certifi==2021.5.30
charset-normalizer==2.0.6; python_version >= '3'
check-manifest==0.47; python_version >= '3.6'
click==8.0.1; python_version >= '3.6'
configparser==5.0.2; python_version >= '3.4'
coverage==6.0.1; python_version >= '3.6'
bip-utils==2.6.0; python_version >= '3.7'
black==22.6.0; python_full_version >= '3.6.2'
blspy==1.0.14; python_version >= '3.7'
build==0.8.0; python_version >= '3.6'
cachetools==5.2.0; python_version ~= '3.7'
cbor2==5.4.3; python_version >= '3.7'
certifi==2022.6.15; python_version >= '3.6'
cffi==1.15.1
charset-normalizer==2.1.0; python_version >= '3.6'
check-manifest==0.48; python_version >= '3.6'
click==8.1.3; python_version >= '3.7'
coincurve==17.0.0; python_version >= '3.7'
configparser==5.2.0; python_version >= '3.4'
-e .
coverage==6.4.3; python_version >= '3.7'
crcmod==1.7
darglint==1.8.1; python_version >= '3.6' and python_version < '4.0'
distlib==0.3.3
docutils==0.17.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
dparse==0.5.1; python_version >= '3.5'
ecdsa==0.18.0b1; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
filelock==3.3.0; python_version >= '3.6'
flake8-copyright==0.2.2
flake8==3.9.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
gitdb==4.0.7; python_version >= '3.4'
gitpython==3.1.24; python_version >= '3.7'
google-api-core==2.1.0; python_version >= '3.6'
google-api-python-client==2.24.0; python_version >= '3.6'
dill==0.3.5.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
distlib==0.3.5
dparse==0.5.2; python_version >= '3.5'
ecdsa==0.18.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
ed25519-blake2b==1.4
filelock==3.8.0; python_version >= '3.7'
flake8==5.0.4; python_full_version >= '3.6.1'
flake8-copyright==0.2.3
ghp-import==2.1.0
gitdb==4.0.9; python_version >= '3.6'
gitpython==3.1.27; python_version >= '3.7'
google-api-core==2.8.2; python_version >= '3.6'
google-api-python-client==2.56.0; python_version >= '3.7'
google-auth==2.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
google-auth-httplib2==0.1.0
google-auth==2.2.1; python_version >= '3.6'
googleapis-common-protos==1.53.0; python_version >= '3.6'
grpcio-tools==1.47.0
grpcio==1.47.0
httplib2==0.20.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
idna==3.2; python_version >= '3'
imagesize==1.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
googleapis-common-protos==1.56.4; python_version >= '3.7'
grpcio==1.47.0; python_version >= '3.6'
grpcio-tools==1.47.0; python_version >= '3.6'
httplib2==0.20.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
idna==3.3; python_version >= '3.5'
importlib-metadata==4.3.0; python_version >= '3.7'
iniconfig==1.1.1
isort==5.9.3; python_version < '4.0' and python_full_version >= '3.6.1'
jinja2==3.0.2; python_version >= '3.6'
lazy-object-proxy==1.6.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
liccheck==0.6.2; python_version >= '2.7'
markupsafe==2.0.1; python_version >= '3.6'
mccabe==0.6.1
isort==5.10.1; python_version < '4.0' and python_full_version >= '3.6.1'
jinja2==3.1.2; python_version >= '3.7'
lazy-object-proxy==1.7.1; python_version >= '3.6'
liccheck==0.7.2; python_version >= '2.7'
markdown==3.3.7; python_version >= '3.6'
markupsafe==2.1.1; python_version >= '3.7'
mccabe==0.7.0; python_version >= '3.6'
mergedeep==1.3.4; python_version >= '3.6'
mkdocs==1.3.1; python_version >= '3.6'
mkdocs-material==8.2.11; python_version >= '3.6'
mkdocs-material-extensions==1.0.3; python_version >= '3.6'
mypy==0.971; python_version >= '3.6'
mypy-extensions==0.4.3
mypy==0.910; python_version >= '3.5'
packaging==21.0; python_version >= '3.6'
packaging==21.3; python_version >= '3.6'
pathspec==0.9.0
pbr==5.6.0; python_version >= '2.6'
pep517==0.11.0
platformdirs==2.4.0; python_version >= '3.6'
pbr==5.10.0; python_version >= '2.6'
pep517==0.13.0; python_version >= '3.6'
platformdirs==2.5.2; python_version >= '3.7'
pluggy==1.0.0; python_version >= '3.6'
protobuf>=3.19.4,<4; python_version >= '3.5'
py==1.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pyasn1-modules==0.2.8
pyasn1==0.4.8
pycodestyle==2.7.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pyflakes==2.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pygments==2.10.0; python_version >= '3.5'
pylint==2.9.6; python_version ~= '3.6'
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
pytest==6.2.5; python_version >= '3.6'
pytz==2021.3
pyyaml==6.0b1; python_version >= '3.6'
regex==2021.9.30
requests==2.26.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
rsa==4.7.2; python_version >= '3.5' and python_version < '4'
safety==1.10.3; python_version >= '3.5'
semantic-version==2.8.5; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
protobuf==3.20.1; python_version >= '3.7'
py==1.11.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
py-sr25519-bindings==0.1.4
pyasn1==0.5.0rc1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pyasn1-modules==0.3.0rc1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pycodestyle==2.9.1; python_version >= '3.6'
pycparser==2.21
pycryptodome==3.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pyflakes==2.5.0; python_version >= '3.6'
pygments==2.11.2; python_version >= '3.5'
pylint==2.14.5; python_full_version >= '3.7.2'
pymdown-extensions==9.3; python_version >= '3.7'
pynacl==1.5.0; python_version >= '3.6'
pyparsing==3.0.9; python_version >= '3.1'
pytest==7.1.2; python_version >= '3.7'
pytest-rerunfailures==10.2; python_version >= '3.6'
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pyyaml==6.0; python_version >= '3.6'
pyyaml-env-tag==0.1; python_version >= '3.6'
requests==2.28.1; python_version >= '3.7' and python_version < '4'
rsa==4.9; python_version >= '3.6'
ruamel.yaml==0.17.21; python_version >= '3'
ruamel.yaml.clib==0.2.6; python_version < '3.11' and platform_python_implementation == 'CPython'
safety==2.1.1
semantic-version==2.10.0; python_version >= '2.7'
setuptools==65.0.0; python_version >= '3.7'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
smmap==4.0.0; python_version >= '3.5'
snowballstemmer==2.1.0
sphinx==4.1.2; python_version >= '3.6'
sphinxcontrib-applehelp==1.0.2; python_version >= '3.5'
sphinxcontrib-devhelp==1.0.2; python_version >= '3.5'
sphinxcontrib-htmlhelp==2.0.0; python_version >= '3.6'
sphinxcontrib-jsmath==1.0.1; python_version >= '3.5'
sphinxcontrib-qthelp==1.0.3; python_version >= '3.5'
sphinxcontrib-serializinghtml==1.1.5; python_version >= '3.5'
stevedore==3.4.0; python_version >= '3.6'
smmap==5.0.0; python_version >= '3.6'
stevedore==4.0.0; python_version >= '3.8'
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
tomli==1.2.1; python_version >= '3.6'
tox==3.24.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
typing-extensions==3.10.0.2; python_version < '3.10'
uritemplate==3.0.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
urllib3==1.26.7; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
virtualenv==20.8.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
vulture==2.3; python_version >= '3.6'
websocket-client==1.2.1; python_version >= '3.6'
wrapt==1.12.1
tomli==2.0.1; python_version < '3.11'
tomlkit==0.11.4; python_version >= '3.6' and python_version < '4.0'
tox==3.25.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
typing-extensions==4.3.0; python_version >= '3.7'
uritemplate==4.1.1; python_version >= '3.6'
urllib3==1.26.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'
virtualenv==20.16.3; python_version >= '3.6'
vulture==2.5; python_version >= '3.6'
watchdog==2.1.9; python_version >= '3.6'
wheel==0.37.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
wrapt==1.14.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
zipp==3.8.1; python_version >= '3.7'
60 changes: 33 additions & 27 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#

-i https://pypi.org/simple
-e .
asn1crypto==1.5.1
bech32==1.2.0; python_version >= '3.5'
cachetools==4.2.4; python_version ~= '3.5'
certifi==2021.5.30
charset-normalizer==2.0.6; python_version >= '3'
ecdsa==0.18.0b1; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
google-api-core==2.1.0; python_version >= '3.6'
google-api-python-client==2.24.0; python_version >= '3.6'
bip-utils==2.6.0; python_version >= '3.7'
blspy==1.0.14; python_version >= '3.7'
cachetools==5.2.0; python_version ~= '3.7'
cbor2==5.4.3; python_version >= '3.7'
certifi==2022.6.15; python_version >= '3.6'
cffi==1.15.1
charset-normalizer==2.1.0; python_version >= '3.6'
coincurve==17.0.0; python_version >= '3.7'
-e .
crcmod==1.7
ecdsa==0.18.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
ed25519-blake2b==1.4
google-api-core==2.8.2; python_version >= '3.6'
google-api-python-client==2.56.0; python_version >= '3.7'
google-auth==2.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
google-auth-httplib2==0.1.0
google-auth==2.2.1; python_version >= '3.6'
googleapis-common-protos==1.53.0; python_version >= '3.6'
grpcio==1.47.0
httplib2==0.20.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
idna==3.2; python_version >= '3'
protobuf>=3.19.4,<4; python_version >= '3.5'
pyasn1-modules==0.2.8
pyasn1==0.4.8
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
requests==2.26.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
rsa==4.7.2; python_version >= '3.5' and python_version < '4'
googleapis-common-protos==1.56.4; python_version >= '3.7'
grpcio==1.47.0; python_version >= '3.6'
httplib2==0.20.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
idna==3.3; python_version >= '3.5'
protobuf==3.20.1; python_version >= '3.7'
py-sr25519-bindings==0.1.4
pyasn1==0.5.0rc1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pyasn1-modules==0.3.0rc1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pycparser==2.21
pycryptodome==3.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
pynacl==1.5.0; python_version >= '3.6'
pyparsing==3.0.9; python_version >= '3.1'
requests==2.28.1; python_version >= '3.7' and python_version < '4'
rsa==4.9; python_version >= '3.6'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
uritemplate==3.0.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
urllib3==1.26.7; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
uritemplate==4.1.1; python_version >= '3.6'
urllib3==1.26.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'
wheel==0.37.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
39 changes: 16 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,33 @@
"ecdsa",
"bech32",
"requests",
"google-api-python-client",
"protobuf>=3.19.4,<4",
"python-mbedtls==2.2.0",
"grpcio",
"click",
"types-certifi",
"grpcio==1.47.0",
"bip-utils",
"blspy",
"google-api-python-client",
],
extras_require={
"dev": [
"check-manifest",
"tox==3.24.1",
"flake8==3.9.2",
"black==22.3",
"mypy==0.910",
"mkdocs==1.3",
"tox==3.25.1",
"flake8==5.0.4",
"black==22.6",
"mypy==0.971",
"mkdocs-material==8.2.11",
"bandit==1.7.0",
"safety==1.10.3",
"isort==5.9.3",
"bandit==1.7.4",
"safety==2.1.1",
"isort==5.10.1",
"darglint==1.8.1",
"vulture==2.3",
"pylint==2.9.6",
"liccheck==0.6.2",
"flake8-copyright==0.2.2",
"flake8-bugbear==22.7.1",
"flake8-eradicate==1.2.1",
"flake8-docstrings==1.6.0",
"pydocstyle==6.1.1",
"vulture==2.5",
"pylint==2.14.5",
"liccheck==0.7.2",
"flake8-copyright==0.2.3",
"grpcio==1.47.0",
"importlib-metadata==4.3.0",
"grpcio-tools==1.47.0",
"pytest-rerunfailures==10.2",
],
"test": ["coverage", "pytest"],
"test": ["coverage", "pytest", "pytest-rerunfailures"],
},
project_urls={
"Bug Reports": "https://github.com/fetchai/cosmpy/issues",
Expand Down
Loading

0 comments on commit 0ba5f4d

Please sign in to comment.