diff --git a/Makefile b/Makefile index 1d38638..8f1d1bf 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,15 @@ protobufs: $(PY) %_pb2.py: %.proto protoc --python_out=. --mypy_out=. $< -.PHONY: clean +clean-proto: + rm -f $(PY) $(PYI) clean: - rm -f $(PY) $(PYI) + find . -name '__pycache__' -exec rm -rf {} + + rm -fr build/ + rm -fr dist/ + rm -fr *.egg-info + +package: clean + python setup.py sdist bdist_wheel + python scripts/release/test_package.py diff --git a/libp2p/crypto/rsa.py b/libp2p/crypto/rsa.py index ec636ca..b059a18 100644 --- a/libp2p/crypto/rsa.py +++ b/libp2p/crypto/rsa.py @@ -24,8 +24,7 @@ class RSAPublicKey(PublicKey): def verify(self, data: bytes, signature: bytes) -> bool: h = SHA256.new(data) try: - # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``verify``. - pkcs1_15.new(self.impl).verify(h, signature) # type: ignore + pkcs1_15.new(self.impl).verify(h, signature) except (ValueError, TypeError): return False return True @@ -48,8 +47,7 @@ class RSAPrivateKey(PrivateKey): def sign(self, data: bytes) -> bytes: h = SHA256.new(data) - # NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``sign``. - return pkcs1_15.new(self.impl).sign(h) # type: ignore + return pkcs1_15.new(self.impl).sign(h) def get_public_key(self) -> PublicKey: return RSAPublicKey(self.impl.publickey()) diff --git a/setup.py b/setup.py index 3a430c3..633a10a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import setuptools -classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]] +py_classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]] extras_require = { @@ -18,7 +18,14 @@ extras_require = { "flake8>=3.7.7,<4.0.0", "flake8-bugbear", ], - "dev": ["tox>=3.13.2,<4.0.0", "docformatter"], + "dev": [ + "bumpversion>=0.5.3,<1", + "docformatter", + "setuptools>=36.2.0", + "tox>=3.13.2,<4.0.0", + "twine", + "wheel", + ], } extras_require["dev"] = ( @@ -26,13 +33,30 @@ extras_require["dev"] = ( ) +with open("./README.md") as readme: + long_description = readme.read() + + setuptools.setup( name="libp2p", description="libp2p implementation written in python", version="0.1.2", + long_description=long_description, + long_description_content_type="text/markdown", + maintainer="The Ethereum Foundation", + maintainer_email="snakecharmers@ethereum.org", + url="https://github.com/ethereum/py-libp2p", license="MIT/APACHE2.0", platforms=["unix", "linux", "osx"], - classifiers=classifiers, + classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + ] + + py_classifiers, + python_requires=">=3.7,<4", install_requires=[ "pycryptodome>=3.8.2,<4.0.0", "base58>=1.0.3,<2.0.0", @@ -48,4 +72,5 @@ setuptools.setup( extras_require=extras_require, packages=setuptools.find_packages(exclude=["tests", "tests.*"]), zip_safe=False, + keywords="libp2p p2p", )