From 61d1d31e8911d21ef0c9111924e74fcfc90391db Mon Sep 17 00:00:00 2001 From: AJ Grubbs Date: Sun, 9 Jun 2019 17:35:18 -0500 Subject: [PATCH] Fix dependency management for pypi deploys, installs (#9) * Fix some path issues in setup.py Filepaths should be now resolved relative to `setup.py`. Previously this was causing issues when installing the module outside of the project dir. * Re-enable test pypi server * bump version for test release * Use proper dev release version syntax * Switch test release version to PEP440 compliant string * Fixing requirements management - Setup.py has minimal requirements specified within the file - No more test_requirements.txt - requirements.txt holds complete environment now (e.g. pip freeze) - For good measure, dependency versions brought up-to-date * Remove pkg-resources in requirements.txt * Finalize for official release --- README.md | 13 ++++++++++--- eip712_structs/__init__.py | 4 ---- requirements.txt | 40 +++++++++++++++++++++++++++++++++++++- setup.py | 35 ++++++++++++++++++++++----------- test_requirements.txt | 4 ---- 5 files changed, 73 insertions(+), 23 deletions(-) delete mode 100644 test_requirements.txt diff --git a/README.md b/README.md index 0bc465b..ae2948d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,12 @@ https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md pip install eip712-structs ``` -## Quickstart +## Usage +See [API.md](API.md) for a succinct summary of available methods. + +Examples/Details below. + +#### Quickstart Say we want to represent the following struct, convert it to a message and sign it: ```text struct MyStruct { @@ -48,6 +53,8 @@ my_msg = mine.to_message(domain) my_bytes = mine.signable_bytes(domain) ``` +See [Member Types](#member-types) for more information on supported types. + #### Dynamic construction Attributes may be added dynamically as well. This may be necessary if you want to use a reserved keyword like `from`. @@ -175,7 +182,7 @@ struct_array = Array(MyStruct, 10) # MyStruct[10] - again, don't instantiate s Contributions always welcome. Install dependencies: -- `pip install -r requirements.txt -r test_requirements.txt` +- `pip install -r requirements.txt` Run tests: - `python setup.py test` @@ -187,7 +194,7 @@ Run tests: - Cleanup containers when you're done: `docker-compose down` Deploying a new version: -- Set the version number in `eip712_structs/__init__.py` +- Bump the version number in `setup.py`, commit it into master. - Make a release tag on the master branch in Github. Travis should handle the rest. diff --git a/eip712_structs/__init__.py b/eip712_structs/__init__.py index 288c0c8..4b25f03 100644 --- a/eip712_structs/__init__.py +++ b/eip712_structs/__init__.py @@ -2,8 +2,4 @@ from eip712_structs.struct import EIP712Struct from eip712_structs.types import Address, Array, Boolean, Bytes, Int, String, Uint -name = 'eip712-structs' -version = '1.0.0' - - default_domain = None diff --git a/requirements.txt b/requirements.txt index 6ffd149..b793b34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,40 @@ -eth-utils==1.4.1 +atomicwrites==1.3.0 +attrdict==2.0.1 +attrs==19.1.0 +certifi==2019.3.9 +chardet==3.0.4 +coverage==4.5.3 +coveralls==1.8.0 +cytoolz==0.9.0.1 +docopt==0.6.2 +eth-abi==1.3.0 +eth-account==0.3.0 +eth-hash==0.2.0 +eth-keyfile==0.5.1 +eth-keys==0.2.3 +eth-rlp==0.1.2 +eth-typing==2.1.0 +eth-utils==1.6.0 +hexbytes==0.2.0 +idna==2.8 +importlib-metadata==0.17 +lru-dict==1.1.6 +more-itertools==7.0.0 +packaging==19.0 +parsimonious==0.8.1 +pluggy==0.12.0 +py==1.8.0 +pycryptodome==3.8.2 +pyparsing==2.4.0 pysha3==1.0.2 +pytest==4.6.2 +pytest-cov==2.7.1 +requests==2.22.0 +rlp==1.1.0 +six==1.12.0 +toolz==0.9.0 +urllib3==1.25.3 +wcwidth==0.1.7 +web3==4.9.2 +websockets==6.0 +zipp==0.5.1 diff --git a/setup.py b/setup.py index acfc957..215771c 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,37 @@ import shlex import sys +from pathlib import Path from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand -from eip712_structs import name, version +NAME = 'eip712-structs' +VERSION = '1.0.1' -def filter_empties(l): - return [i for i in l if i] +install_requirements = [ + 'eth-utils>=1.4.0', + 'pysha3>=1.0.2', +] +test_requirements = [ + 'coveralls==1.8.0', + 'pytest==4.6.2', + 'pytest-cov==2.7.1', + 'web3==4.9.2', +] -with open('requirements.txt', 'r') as f: - install_requirements = filter_empties(f.readlines()) -with open('test_requirements.txt', 'r') as f: - test_requirements = filter_empties(f.readlines()) +def get_file_text(filename): + file_path = Path(__file__).parent / filename + if not file_path.exists(): + return '' + else: + file_text = file_path.read_text().strip() + return file_text -with open('README.md', 'r') as f: - long_description = f.read() + +long_description = get_file_text('README.md') class PyTest(TestCommand): @@ -51,8 +64,8 @@ def run_tests(self): setup( - name=name, - version=version, + name=NAME, + version=VERSION, author='AJ Grubbs', packages=find_packages(), install_requires=install_requirements, diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index bea0452..0000000 --- a/test_requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -coveralls==1.8.0 -pytest==4.3.0 -pytest-cov==2.7.1 -web3==4.9.2 \ No newline at end of file