Skip to content

Commit

Permalink
Set up a basic build system
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWilsn authored and lightclient committed Jun 22, 2021
1 parent ab527a2 commit df6ff3c
Show file tree
Hide file tree
Showing 23 changed files with 136 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
.DS_Store
__pycache__
.AppleDouble
.LSOverride

__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

*.manifest
*.spec

pip-log.txt
pip-delete-this-directory.txt

.tox/
9 changes: 9 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[mypy]
disallow_incomplete_defs = True
disallow_untyped_defs = True

warn_unused_ignores = True
warn_unused_configs = True
warn_redundant_casts = True

ignore_missing_imports = True
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"
multi_line_output = 3

[tool.black]
line-length = 79
29 changes: 29 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[metadata]
name = eth1spec
description = Ethereum specification, provided as a Python package for tooling
and testing
version = 0.1.0
url = https://github.com/ethereum/eth2.0-specs

[options]
packages = eth1spec
package_dir =
=src

python_requires = >=3.7
install_requires =
pysha3>=1,<2
coincurve>=15,<16

[options.extras_require]
test =
pytest>=6.2,<7
pytest-cov>=2.12,<3

lint =
isort>=5.8,<6
mypy==0.812; implementation_name == "cpython"
black==21.5b2; implementation_name == "cpython"
flake8>=3.9,<4

# vim: set ft=dosini:
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pathlib

import setuptools

here = pathlib.Path(__file__).parent.resolve()

long_description = (here / "README.md").read_text(encoding="utf-8")

setuptools.setup(
long_description=long_description,
long_description_content_type="text/markdown",
)
2 changes: 0 additions & 2 deletions spec/requirements.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/__init__.py
Empty file.
1 change: 0 additions & 1 deletion tests/fixtures
Submodule fixtures deleted from 82f6a5
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions tests/test_spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from eth1spec.spec import Account, State, get_account


def test_get_account():
account = Account(
nonce=0,
balance=1,
code_hash=b"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
)

state = State()
state[b"aaaaaaaaaaaaaaaaaaaa"] = account

actual = get_account(state, b"aaaaaaaaaaaaaaaaaaaa")

assert actual.nonce == 0
assert actual.balance == 1
assert actual.code_hash == b"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
22 changes: 22 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tox]
envlist = py3,pypy3

[testenv]
extras =
test
lint
commands =
isort src tests setup.py --check --diff
black src tests setup.py --check --diff
pyflakes src tests setup.py
mypy src tests setup.py
pytest

[testenv:pypy3]
extras =
test
lint
commands =
isort src tests setup.py --check --diff
pyflakes src tests setup.py
pytest

0 comments on commit df6ff3c

Please sign in to comment.