Skip to content

Commit 61d1d31

Browse files
authored
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
1 parent 5ce0261 commit 61d1d31

File tree

5 files changed

+73
-23
lines changed

5 files changed

+73
-23
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md
1717
pip install eip712-structs
1818
```
1919

20-
## Quickstart
20+
## Usage
21+
See [API.md](API.md) for a succinct summary of available methods.
22+
23+
Examples/Details below.
24+
25+
#### Quickstart
2126
Say we want to represent the following struct, convert it to a message and sign it:
2227
```text
2328
struct MyStruct {
@@ -48,6 +53,8 @@ my_msg = mine.to_message(domain)
4853
my_bytes = mine.signable_bytes(domain)
4954
```
5055

56+
See [Member Types](#member-types) for more information on supported types.
57+
5158
#### Dynamic construction
5259
Attributes may be added dynamically as well. This may be necessary if you
5360
want to use a reserved keyword like `from`.
@@ -175,7 +182,7 @@ struct_array = Array(MyStruct, 10) # MyStruct[10] - again, don't instantiate s
175182
Contributions always welcome.
176183

177184
Install dependencies:
178-
- `pip install -r requirements.txt -r test_requirements.txt`
185+
- `pip install -r requirements.txt`
179186

180187
Run tests:
181188
- `python setup.py test`
@@ -187,7 +194,7 @@ Run tests:
187194
- Cleanup containers when you're done: `docker-compose down`
188195

189196
Deploying a new version:
190-
- Set the version number in `eip712_structs/__init__.py`
197+
- Bump the version number in `setup.py`, commit it into master.
191198
- Make a release tag on the master branch in Github. Travis should handle the rest.
192199

193200

eip712_structs/__init__.py

-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@
22
from eip712_structs.struct import EIP712Struct
33
from eip712_structs.types import Address, Array, Boolean, Bytes, Int, String, Uint
44

5-
name = 'eip712-structs'
6-
version = '1.0.0'
7-
8-
95
default_domain = None

requirements.txt

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
1-
eth-utils==1.4.1
1+
atomicwrites==1.3.0
2+
attrdict==2.0.1
3+
attrs==19.1.0
4+
certifi==2019.3.9
5+
chardet==3.0.4
6+
coverage==4.5.3
7+
coveralls==1.8.0
8+
cytoolz==0.9.0.1
9+
docopt==0.6.2
10+
eth-abi==1.3.0
11+
eth-account==0.3.0
12+
eth-hash==0.2.0
13+
eth-keyfile==0.5.1
14+
eth-keys==0.2.3
15+
eth-rlp==0.1.2
16+
eth-typing==2.1.0
17+
eth-utils==1.6.0
18+
hexbytes==0.2.0
19+
idna==2.8
20+
importlib-metadata==0.17
21+
lru-dict==1.1.6
22+
more-itertools==7.0.0
23+
packaging==19.0
24+
parsimonious==0.8.1
25+
pluggy==0.12.0
26+
py==1.8.0
27+
pycryptodome==3.8.2
28+
pyparsing==2.4.0
229
pysha3==1.0.2
30+
pytest==4.6.2
31+
pytest-cov==2.7.1
32+
requests==2.22.0
33+
rlp==1.1.0
34+
six==1.12.0
35+
toolz==0.9.0
36+
urllib3==1.25.3
37+
wcwidth==0.1.7
38+
web3==4.9.2
39+
websockets==6.0
40+
zipp==0.5.1

setup.py

+24-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
import shlex
22
import sys
3+
from pathlib import Path
34

45
from setuptools import setup, find_packages
56
from setuptools.command.test import test as TestCommand
67

7-
from eip712_structs import name, version
88

9+
NAME = 'eip712-structs'
10+
VERSION = '1.0.1'
911

10-
def filter_empties(l):
11-
return [i for i in l if i]
12+
install_requirements = [
13+
'eth-utils>=1.4.0',
14+
'pysha3>=1.0.2',
15+
]
1216

17+
test_requirements = [
18+
'coveralls==1.8.0',
19+
'pytest==4.6.2',
20+
'pytest-cov==2.7.1',
21+
'web3==4.9.2',
22+
]
1323

14-
with open('requirements.txt', 'r') as f:
15-
install_requirements = filter_empties(f.readlines())
1624

17-
with open('test_requirements.txt', 'r') as f:
18-
test_requirements = filter_empties(f.readlines())
25+
def get_file_text(filename):
26+
file_path = Path(__file__).parent / filename
27+
if not file_path.exists():
28+
return ''
29+
else:
30+
file_text = file_path.read_text().strip()
31+
return file_text
1932

20-
with open('README.md', 'r') as f:
21-
long_description = f.read()
33+
34+
long_description = get_file_text('README.md')
2235

2336

2437
class PyTest(TestCommand):
@@ -51,8 +64,8 @@ def run_tests(self):
5164

5265

5366
setup(
54-
name=name,
55-
version=version,
67+
name=NAME,
68+
version=VERSION,
5669
author='AJ Grubbs',
5770
packages=find_packages(),
5871
install_requires=install_requirements,

test_requirements.txt

-4
This file was deleted.

0 commit comments

Comments
 (0)