Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypy.eest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[mypy]
disable_error_code = import-untyped
mypy_path = src, $MYPY_CONFIG_FILE_DIR/stubs
plugins = pydantic.mypy
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ fill = [
"eth-abi>=5.2.0",
"joblib>=1.4.2",
"ckzg>=2.1.1",
"platformdirs>=4.2,<5",
]

lint = [
Expand Down Expand Up @@ -313,6 +314,7 @@ ethereum-spec-new-fork = "ethereum_spec_tools.new_fork:main"
ethereum-spec-patch = "ethereum_spec_tools.patch_tool:main"
ethereum-spec-evm = "ethereum_spec_tools.evm_tools:main"
ethereum-spec-fill = "cli.pytest_commands.fill:fill"
ethereum-spec-consume = "cli.pytest_commands.consume:consume"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mainly to provoke a discussion though, so that everyone knows what we're getting into :)


[project.entry-points."docc.plugins"]
"ethereum_spec_tools.docc.discover" = "ethereum_spec_tools.docc:EthereumDiscover"
Expand Down Expand Up @@ -517,3 +519,6 @@ check-hidden = false # Don't check hidden files (starting with .)

[tool.uv]
required-version = ">=0.7.0"

[tool.mypy]
plugins = ["pydantic.mypy"]
6 changes: 6 additions & 0 deletions ruff.eest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
line-length = 99

[lint]
select = ["E", "F", "B", "W", "I", "A", "N", "D", "C"]
fixable = ["I", "B", "E", "F", "W", "D", "C"]
ignore = ["D205", "D203", "D212", "D415", "C901", "A005", "C420"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
console_output_style = count
minversion = 7.0
python_files = *.py
testpaths = tests/
testpaths = tests/eest/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and many other of these changes are not required for tox, right?

This is a task to be added to the Switch (similar to the line-length change), to avoid editing these sub-trees in EELS before the Switch?

That means that this command will be broken in EELS until the Switch and standalone uvx commands from EELS won't work, but that's ok, I think. By standalone, I mean things like uvx --from git+https://github.com/ethereum/execution-spec-tests \ execute ....

markers =
slow
pre_alloc_modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
console_output_style = count
minversion = 7.0
python_files = *.py
testpaths = tests/
testpaths = tests/eest/
markers =
slow
pre_alloc_modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
console_output_style = count
minversion = 7.0
python_files = *.py
testpaths = tests/
testpaths = tests/eest/
markers =
slow
pre_alloc_modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
console_output_style = count
minversion = 7.0
python_files = *.py
testpaths = tests/
testpaths = tests/eest/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could avoid this until the Switch by using -o testpaths=tests/eest on the tox command-line to override this ini file setting.

markers =
slow
pre_alloc_modify
Expand Down
5 changes: 5 additions & 0 deletions stubs/joblib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from typing import Any, Callable

class Memory:
def __init__(self, location: str, verbose: int = ...) -> None: ...
def cache(self, func: Callable[..., Any]) -> Callable[..., Any]: ...
3 changes: 3 additions & 0 deletions stubs/jwt/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .encode import encode

__all__ = ("encode",)
3 changes: 3 additions & 0 deletions stubs/jwt/encode.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typing import Any, Dict

def encode(payload: Dict[Any, Any], key: bytes, algorithm: str) -> str: ...
3 changes: 3 additions & 0 deletions stubs/trie/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .hexary import HexaryTrie as HexaryTrie

__all__ = ("HexaryTrie",)
8 changes: 8 additions & 0 deletions stubs/trie/hexary.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from typing import Dict

class HexaryTrie:
db: Dict
root_hash: bytes

def __init__(self, db: Dict) -> None: ...
def set(self, key: bytes, value: bytes) -> None: ...
3 changes: 3 additions & 0 deletions stubs/xdist/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .methods import is_xdist_worker

__all__ = ("is_xdist_worker",)
3 changes: 3 additions & 0 deletions stubs/xdist/methods.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pytest

def is_xdist_worker(session: pytest.Session) -> bool: ...
81 changes: 80 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
min_version = 4.0
requires =
tox-uv >=0.2.0
envlist = py3,pypy3,json_infra,static
envlist = py3,pypy3,json_infra,static,eest-lint,eest-typecheck,eest-pytest,eest-tests-deployed,eest-tests-deployed-benchmark,eest-tests-develop

[testenv]
package = uv
Expand Down Expand Up @@ -90,3 +90,82 @@ extras = doc
commands =
docc --output "{toxworkdir}/docs"
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs" / "index.html"))'


[eest]
runner = uv-venv-lock-runner
package = editable
wheel_build_env = .pkg
python_source_dirs = src/ethereum_spec_tests tests/eest # .github/scripts
ruff_config = ruff.eest.toml
mypy_config = mypy.eest.ini

[testenv:eest-lint]
runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Lint and code formatting checks (ruff)
extras = lint
commands =
ruff check --config {[eest]ruff_config} --no-fix --show-fixes {[eest]python_source_dirs}
ruff format --config {[eest]ruff_config} --check {[eest]python_source_dirs}

[testenv:eest-typecheck]
runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Run type checking (mypy)
extras = test,fill,lint
commands = mypy --config-file {[eest]mypy_config} {[eest]python_source_dirs}


[testenv:eest-pytest]
runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Run library and framework unit tests (pytest)
setenv =
# Use custom EELS_RESOLUTIONS_FILE if it is set via the environment (eg, in CI)
EELS_RESOLUTIONS_FILE = {env:EELS_RESOLUTIONS_FILE:}
CI = {env:CI:}
extras =
test
fill
lint # Required `gentest` for formatting tests
commands =
pytest -n auto ./src/ethereum_spec_tests


[forks]
develop = Osaka
eip7692 = EOFv1

[testenv:eest-tests-deployed]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we'll need this environment post-Weld. We fill until the fork that the EELS branch points to and this will typically be a develop branch, so we fill until there.

runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Fill test cases in ./tests/ for deployed mainnet forks, except for slow/benchmark tests.
extras = test,fill
setenv =
# Use custom EELS_RESOLUTIONS_FILE if it is set via the environment (eg, in CI)
EELS_RESOLUTIONS_FILE = {env:EELS_RESOLUTIONS_FILE:}
commands = ethereum-spec-fill -n auto -m "not slow" --output=/tmp/fixtures-tox --clean

[testenv:eest-tests-deployed-benchmark]
runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Fill benchmarking test cases in ./tests/ for deployed mainnet forks, using evmone-t8n.
extras = test,fill
commands = ethereum-spec-fill -n auto -m "benchmark" --gas-benchmark-values 5 --output=/tmp/fixtures-tox --clean --evm-bin=evmone-t8n

[testenv:eest-tests-develop]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This essentially duplicates the existing EELS py3 environment, right?

runner = {[eest]runner}
package = {[eest]package}
wheel_build_env = {[eest]wheel_build_env}
description = Fill test cases in ./tests/ for deployed and development mainnet forks
setenv =
# Use custom EELS_RESOLUTIONS_FILE if it is set via the environment (eg, in CI)
EELS_RESOLUTIONS_FILE = {env:EELS_RESOLUTIONS_FILE:}
Comment on lines +167 to +169
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we don't need the resolver here 😄 but perhaps I don't understand your intention of adding this here?

extras = test,fill
commands = ethereum-spec-fill -n auto --until={[forks]develop} -k "not slow" --output=/tmp/fixtures-tox --clean
2 changes: 2 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading