Skip to content

Commit

Permalink
Fix dependency management for pypi deploys, installs (#9)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ajrgrubbs authored Jun 9, 2019
1 parent 5ce0261 commit 61d1d31
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 23 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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`
Expand All @@ -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.


Expand Down
4 changes: 0 additions & 4 deletions eip712_structs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 39 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
35 changes: 24 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions test_requirements.txt

This file was deleted.

0 comments on commit 61d1d31

Please sign in to comment.