Skip to content

(feat)ci: pypy3.11 support #1854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .github/workflows/tox_verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
include:
- os: macos-latest
python: "3.11"
- os: macos-latest
python: "pypy3.11"
- os: ubuntu-latest
python: "3.12"
steps:
Expand Down Expand Up @@ -155,6 +157,9 @@ jobs:
- os: [self-hosted-ghr, size-xl-x64]
name: self-hosted-ghr-xl-x64
python: "3.11"
- os: [self-hosted-ghr, size-xl-x64]
name: self-hosted-ghr-xl-x64-pypy
python: "pypy3.11"
- os: macos-latest
name: macos-latest
python: "3.12"
Expand All @@ -175,6 +180,9 @@ jobs:
cache-dependency-glob: "uv.lock"
version: ${{ vars.UV_VERSION }}
python-version: ${{ matrix.python }}
- name: Install linux dependencies
if: matrix.python == 'pypy3.11' && contains(matrix.os, 'self-hosted-ghr')
run: sudo apt-get install -y pkg-config libsecp256k1-dev libjpeg-dev libxml2-dev libxslt1-dev
- name: Update eels_resolutions.json
run: |
sed -i -e "s|\$GITHUB_WORKSPACE|${GITHUB_WORKSPACE}|g" .github/configs/eels_resolutions.json
Expand All @@ -190,6 +198,8 @@ jobs:
include:
- os: ubuntu-latest
python: "3.11"
- os: ubuntu-latest
python: "pypy3.11"
- os: macos-latest
python: "3.12"
steps:
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Users can select any of the artifacts depending on their testing needs for their

### 📋 Misc

- ✨ Add pypy3.11 support ([#1854](https://github.com/ethereum/execution-spec-tests/pull/1854)).
- 🔀 Use only relative imports in `tests/` directory ([#1848](https://github.com/ethereum/execution-spec-tests/pull/1848)).
- 🔀 Misc. doc updates, including a navigation footer ([#1846](https://github.com/ethereum/execution-spec-tests/pull/1846)).
- 🔀 Remove Python 3.10 support ([#1808](https://github.com/ethereum/execution-spec-tests/pull/1808)).
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
"coincurve>=20.0.0,<21",
"trie>=3.1.0,<4",
"semver>=3.0.1,<4",
"pydantic>=2.10.0,<3",
"pydantic>=2.11.0,<3",
"rich>=13.7.0,<14",
"filelock>=3.15.1,<4",
"ethereum-types>=0.2.1,<0.3",
Expand Down Expand Up @@ -79,6 +79,7 @@ docs = [
"mkdocstrings-python>=1.0.0,<2",
"pillow>=10.0.1,<11",
"pyspelling>=2.8.2,<3",
"lxml>=6.0.0,<7", # needs to be >= 6.0 for pypy
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a dependency of pyspelling, and needs to be >=6.0 for pypy. pyspelling doesn't have any restriction on the version, so need to specify here. Could get more specific if we wanted - something along the lines of "lxml>=6.0.0,<7; implementation_name == 'pypy'",

"setuptools==78.0.2",
]

Expand Down
22 changes: 20 additions & 2 deletions src/ethereum_clis/transition_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from requests import Response
from requests.exceptions import ConnectionError as RequestsConnectionError
from requests.exceptions import ReadTimeout
from requests_unixsocket import Session # type: ignore

from ethereum_test_base_types import BlobSchedule
Expand Down Expand Up @@ -297,6 +298,18 @@ def _evaluate_filesystem(

return output

def _check_server_health(self, session: Session):
"""Check if the server is still responsive and restart if needed."""
try:
session.post(self.server_url, json={}, timeout=2)
return True
except Exception:
self.shutdown()
time.sleep(0.1)
self.start_server()
time.sleep(0.5)
return False

def _server_post(
self,
data: Dict[str, Any],
Expand All @@ -308,15 +321,20 @@ def _server_post(
if url_args is None:
url_args = {}
post_delay = 0.1

while True:
try:
response = Session().post(
session = Session()
response = session.post(
f"{self.server_url}?{urlencode(url_args, doseq=True)}",
json=data,
timeout=timeout,
)
break
except RequestsConnectionError as e:
except (RequestsConnectionError, ReadTimeout) as e:
if not self._check_server_health(session):
# Server was restarted, try again
continue
retries -= 1
if retries == 0:
raise e
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum_test_fixtures/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def model_post_init(self, __context):
# if so, check if the field is required for the given fork.
annotated_hints = get_type_hints(self, include_extras=True)

for field in self.model_fields:
for field in self.__class__.model_fields:
if field == "fork":
continue

Expand All @@ -197,7 +197,7 @@ def model_post_init(self, __context):
def rlp_encode_list(self) -> List:
"""Compute the RLP of the header."""
header_list = []
for field in self.model_fields:
for field in self.__class__.model_fields:
if field == "fork":
continue
value = getattr(self, field)
Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ setenv =
# Required for `cairosvg` so tox can find `libcairo-2`.
# https://squidfunk.github.io/mkdocs-material/plugins/requirements/image-processing/?h=cairo#cairo-library-was-not-found
DYLD_FALLBACK_LIBRARY_PATH = /opt/homebrew/lib
commands =
commands =
ruff check --no-fix --show-fixes docs/scripts
ruff format --check docs/scripts
mkdocs build --strict
Expand All @@ -67,7 +67,7 @@ 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 =
extras =
test
lint # Required `gentest` for formatting tests
commands =
Expand Down Expand Up @@ -113,9 +113,9 @@ extras =
{[testenv:typecheck]extras}
{[testenv:spellcheck]extras}
{[testenv:pytest]extras}
setenv =
setenv =
{[testenv:pytest]setenv}
commands_pre =
commands_pre =
{[testenv:pytest]:commands_pre}
commands =
{[testenv:lint]commands}
Expand All @@ -133,10 +133,10 @@ extras =
{[testenv:spellcheck]extras}
{[testenv:tests-deployed]extras}
{[testenv:tests-deployed-benchmark]extras}
setenv =
setenv =
{[testenv:pytest]setenv}
commands_pre =
{[testenv:tests-deployed]:commands_pre}
commands_pre =
{[testenv:tests-deployed]:commands_pre}
{[testenv:tests-deployed-benchmark]:commands_pre}
commands =
{[testenv:lint]commands}
Expand Down
4 changes: 3 additions & 1 deletion uv.lock

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

Loading