Skip to content

Commit ad91a83

Browse files
authored
Update python to 3.12.4 (#3880)
* update python to 3.12 * drop down to 3.12.4 for compatibility * setup rust toolchain for deps * fix typo * fix linter * fixing linter * adding rust dep * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying to fix circleci * trying new image * trying new image * trying new image * trying new image * invalidate cache * bump reqs * remove cache invalidation * fix cache name * update to use latest image
1 parent 01aab85 commit ad91a83

11 files changed

Lines changed: 62 additions & 59 deletions

File tree

.circleci/config.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ commands:
6060
jobs:
6161
checkout_specs:
6262
docker:
63-
- image: circleci/python:3.9
63+
- image: cimg/python:3.12.4
6464
working_directory: ~/specs-repo
6565
steps:
6666
# Restore git repo at point close to target branch/revision, to speed up checkout
@@ -80,19 +80,19 @@ jobs:
8080
- ~/specs-repo
8181
install_pyspec_test:
8282
docker:
83-
- image: circleci/python:3.9
83+
- image: ethpandaops/circleci-python-rust:latest
8484
working_directory: ~/specs-repo
8585
steps:
8686
- restore_cache:
8787
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
8888
- restore_pyspec_cached_venv
8989
- run:
9090
name: Install pyspec requirements
91-
command: make install_test
91+
command: make install_test && make preinstallation
9292
- save_pyspec_cached_venv
9393
test-phase0:
9494
docker:
95-
- image: circleci/python:3.9
95+
- image: cimg/python:3.12.4
9696
working_directory: ~/specs-repo
9797
steps:
9898
- restore_cache:
@@ -105,7 +105,7 @@ jobs:
105105
path: tests/core/pyspec/test-reports
106106
test-altair:
107107
docker:
108-
- image: circleci/python:3.9
108+
- image: cimg/python:3.12.4
109109
working_directory: ~/specs-repo
110110
steps:
111111
- restore_cache:
@@ -118,7 +118,7 @@ jobs:
118118
path: tests/core/pyspec/test-reports
119119
test-bellatrix:
120120
docker:
121-
- image: circleci/python:3.9
121+
- image: cimg/python:3.12.4
122122
working_directory: ~/specs-repo
123123
steps:
124124
- restore_cache:
@@ -131,7 +131,7 @@ jobs:
131131
path: tests/core/pyspec/test-reports
132132
test-capella:
133133
docker:
134-
- image: circleci/python:3.9
134+
- image: cimg/python:3.12.4
135135
working_directory: ~/specs-repo
136136
steps:
137137
- restore_cache:
@@ -144,7 +144,7 @@ jobs:
144144
path: tests/core/pyspec/test-reports
145145
test-deneb:
146146
docker:
147-
- image: circleci/python:3.9
147+
- image: cimg/python:3.12.4
148148
working_directory: ~/specs-repo
149149
steps:
150150
- restore_cache:
@@ -157,7 +157,7 @@ jobs:
157157
path: tests/core/pyspec/test-reports
158158
test-electra:
159159
docker:
160-
- image: circleci/python:3.9
160+
- image: cimg/python:3.12.4
161161
working_directory: ~/specs-repo
162162
steps:
163163
- restore_cache:
@@ -170,7 +170,7 @@ jobs:
170170
path: tests/core/pyspec/test-reports
171171
test-whisk:
172172
docker:
173-
- image: circleci/python:3.9
173+
- image: cimg/python:3.12.4
174174
working_directory: ~/specs-repo
175175
steps:
176176
- restore_cache:
@@ -183,7 +183,7 @@ jobs:
183183
path: tests/core/pyspec/test-reports
184184
test-eip7594:
185185
docker:
186-
- image: circleci/python:3.9
186+
- image: cimg/python:3.12.4
187187
working_directory: ~/specs-repo
188188
steps:
189189
- restore_cache:
@@ -205,7 +205,7 @@ jobs:
205205
command: sudo npm install -g doctoc@2.2.0 && make check_toc
206206
codespell:
207207
docker:
208-
- image: circleci/python:3.9
208+
- image: cimg/python:3.12.4
209209
working_directory: ~/specs-repo
210210
steps:
211211
- checkout
@@ -214,7 +214,7 @@ jobs:
214214
command: pip install 'codespell<3.0.0,>=2.0.0' --user && make codespell
215215
lint:
216216
docker:
217-
- image: circleci/python:3.9
217+
- image: cimg/python:3.12.4
218218
working_directory: ~/specs-repo
219219
steps:
220220
- restore_cache:
@@ -270,7 +270,7 @@ jobs:
270270
- /nix
271271
install_deposit_contract_web3_tester:
272272
docker:
273-
- image: circleci/python:3.9
273+
- image: cimg/python:3.12.4
274274
working_directory: ~/specs-repo
275275
steps:
276276
- restore_cache:
@@ -282,7 +282,7 @@ jobs:
282282
- save_deposit_contract_tester_cached_venv
283283
test_deposit_contract_web3_tests:
284284
docker:
285-
- image: circleci/python:3.9
285+
- image: cimg/python:3.12.4
286286
working_directory: ~/specs-repo
287287
steps:
288288
- restore_cache:

.github/workflows/generate_vectors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Setup Python
3333
uses: actions/setup-python@v5
3434
with:
35-
python-version: '3.10'
35+
python-version: '3.12.4'
3636
cache: ''
3737
- name: Clean up Spec Repository
3838
run: |

.github/workflows/run-tests.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Setup Python
4646
uses: actions/setup-python@v5
4747
with:
48-
python-version: '3.10'
48+
python-version: '3.12.4'
4949
cache: ''
5050
- name: Check codespell
5151
run: make codespell
@@ -55,10 +55,12 @@ jobs:
5555
steps:
5656
- name: Checkout repository
5757
uses: actions/checkout@v4
58+
- name: Setup Rust for dependencies
59+
uses: actions-rust-lang/setup-rust-toolchain@v1
5860
- name: Setup Python
5961
uses: actions/setup-python@v5
6062
with:
61-
python-version: '3.10'
63+
python-version: '3.12.4'
6264
cache: ''
6365
- name: Install pyspec requirements
6466
run: make install_test
@@ -76,10 +78,12 @@ jobs:
7678
steps:
7779
- name: Checkout repository
7880
uses: actions/checkout@v4
81+
- name: Setup Rust for dependencies
82+
uses: actions-rust-lang/setup-rust-toolchain@v1
7983
- name: Setup Python
8084
uses: actions/setup-python@v5
8185
with:
82-
python-version: '3.10'
86+
python-version: '3.12.4'
8387
cache: ''
8488
- name: set TEST_PRESET_TYPE
8589
if: github.event.inputs.test_preset_type != ''

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Rename the build stage from 'base' to 'builder' for clarification and code readability
2-
FROM python:3.11.0-slim-bullseye as builder
2+
FROM python:3.12.4-slim-bullseye as builder
33

44
ENV DEBIAN_FRONTEND=noninteractive \
55
WORKDIR=/consensus-specs \

requirements_preinstallation.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pip>=23.1.2
2-
wheel>=0.40.0
3-
setuptools>=68.0.0
4-
pylint>=3.0.0
1+
pip>=24.0.0
2+
wheel>=0.44.0
3+
setuptools>=72.0.0
4+
pylint>=3.2.0

tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def should_skip_case_dir(case_dir, is_force, diagnostics_obj):
132132
print(f'Skipping already existing test: {case_dir}')
133133
is_skip = True
134134
else:
135-
print(f'Warning, output directory {case_dir} already exist,'
135+
print(f'Warning, output directory {case_dir} already exist, '
136136
' old files will be deleted and it will generate test vector files with the latest version')
137137
# Clear the existing case_dir folder
138138
shutil.rmtree(case_dir)
@@ -356,7 +356,7 @@ def generate_test_vector(test_case, case_dir, log_file, file_mode):
356356
test_end = time.time()
357357
span = round(test_end - test_start, 2)
358358
if span > TIME_THRESHOLD_TO_PRINT:
359-
print(f' - generated in {span} seconds')
359+
print(f'- generated in {span} seconds')
360360

361361
return result
362362

tests/generators/ssz_generic/ssz_basic_vector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def valid_cases():
3333
for length in [1, 2, 3, 4, 5, 8, 16, 31, 512, 513]:
3434
for mode in random_modes:
3535
yield f'vec_{name}_{length}_{mode.to_name()}', \
36-
valid_test_case(lambda: basic_vector_case_fn(rng, mode, typ, length))
36+
valid_test_case(lambda: basic_vector_case_fn(rng, mode, typ, length))
3737

3838

3939
def invalid_cases():
@@ -52,14 +52,14 @@ def invalid_cases():
5252
if length == 1:
5353
# empty bytes, no elements. It may seem valid, but empty fixed-size elements are not valid SSZ.
5454
yield f'vec_{name}_{length}_{mode.to_name()}_one_less', \
55-
invalid_test_case(lambda: b"")
55+
invalid_test_case(lambda: b"")
5656
else:
5757
yield f'vec_{name}_{length}_{mode.to_name()}_one_less', \
58-
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length - 1)))
58+
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length - 1)))
5959
yield f'vec_{name}_{length}_{mode.to_name()}_one_more', \
60-
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length + 1)))
60+
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length + 1)))
6161
yield f'vec_{name}_{length}_{mode.to_name()}_one_byte_less', \
62-
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length))[:-1])
62+
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length))[:-1])
6363
yield f'vec_{name}_{length}_{mode.to_name()}_one_byte_more', \
64-
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length))
65-
+ serialize(basic_vector_case_fn(rng, mode, uint8, 1)))
64+
invalid_test_case(lambda: serialize(basic_vector_case_fn(rng, mode, typ, length))
65+
+ serialize(basic_vector_case_fn(rng, mode, uint8, 1)))

tests/generators/ssz_generic/ssz_bitlist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def valid_cases():
2222
RandomizationMode.mode_zero,
2323
RandomizationMode.mode_max]:
2424
yield f'bitlist_{size}_{mode.to_name()}_{variation}', \
25-
valid_test_case(lambda: bitlist_case_fn(rng, mode, size))
25+
valid_test_case(lambda: bitlist_case_fn(rng, mode, size))
2626

2727

2828
def invalid_cases():
@@ -33,5 +33,5 @@ def invalid_cases():
3333
for (typ_limit, test_limit) in [(1, 2), (1, 8), (1, 9), (2, 3), (3, 4), (4, 5),
3434
(5, 6), (8, 9), (32, 64), (32, 33), (512, 513)]:
3535
yield f'bitlist_{typ_limit}_but_{test_limit}', \
36-
invalid_test_case(lambda: serialize(
37-
bitlist_case_fn(rng, RandomizationMode.mode_max_count, test_limit)))
36+
invalid_test_case(lambda: serialize(
37+
bitlist_case_fn(rng, RandomizationMode.mode_max_count, test_limit)))

tests/generators/ssz_generic/ssz_bitvector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ def invalid_cases():
3838
(5, 6), (8, 9), (9, 8), (16, 8), (32, 33), (512, 513)]:
3939
for mode in [RandomizationMode.mode_random, RandomizationMode.mode_zero, RandomizationMode.mode_max]:
4040
yield f'bitvec_{typ_size}_{mode.to_name()}_{test_size}', \
41-
invalid_test_case(lambda: serialize(bitvector_case_fn(rng, mode, test_size,
42-
invalid_making_pos=typ_size)))
41+
invalid_test_case(lambda: serialize(bitvector_case_fn(rng, mode, test_size,
42+
invalid_making_pos=typ_size)))

tests/generators/ssz_generic/ssz_container.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BitsStruct(Container):
4646
E: Bitvector[8]
4747

4848

49-
def container_case_fn(rng: Random, mode: RandomizationMode, typ: Type[View], chaos: bool=False):
49+
def container_case_fn(rng: Random, mode: RandomizationMode, typ: Type[View], chaos: bool = False):
5050
return get_random_ssz_object(rng, typ,
5151
max_bytes_length=2000,
5252
max_list_length=2000,
@@ -77,15 +77,15 @@ def valid_cases():
7777
for mode in modes:
7878
for variation in range(3):
7979
yield f'{name}_{mode.to_name()}_chaos_{variation}', \
80-
valid_test_case(lambda: container_case_fn(rng, mode, typ, chaos=True))
80+
valid_test_case(lambda: container_case_fn(rng, mode, typ, chaos=True))
8181
# Notes: Below is the second wave of iteration, and only the random mode is selected
8282
# for container without offset since ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max``
8383
# are deterministic.
8484
modes = [RandomizationMode.mode_random] if len(offsets) == 0 else list(RandomizationMode)
8585
for mode in modes:
8686
for variation in range(10):
8787
yield f'{name}_{mode.to_name()}_{variation}', \
88-
valid_test_case(lambda: container_case_fn(rng, mode, typ))
88+
valid_test_case(lambda: container_case_fn(rng, mode, typ))
8989

9090

9191
def mod_offset(b: bytes, offset_index: int, change: Callable[[int], int]):
@@ -100,8 +100,8 @@ def invalid_cases():
100100
for (name, (typ, offsets)) in PRESET_CONTAINERS.items():
101101
# using mode_max_count, so that the extra byte cannot be picked up as normal list content
102102
yield f'{name}_extra_byte', \
103-
invalid_test_case(lambda: serialize(
104-
container_case_fn(rng, RandomizationMode.mode_max_count, typ)) + b'\xff')
103+
invalid_test_case(lambda: serialize(
104+
container_case_fn(rng, RandomizationMode.mode_max_count, typ)) + b'\xff')
105105

106106
if len(offsets) != 0:
107107
# Note: there are many more ways to have invalid offsets,
@@ -112,23 +112,22 @@ def invalid_cases():
112112
RandomizationMode.mode_max_count]:
113113
for index, offset_index in enumerate(offsets):
114114
yield f'{name}_{mode.to_name()}_offset_{offset_index}_plus_one', \
115-
invalid_test_case(lambda: mod_offset(
116-
b=serialize(container_case_fn(rng, mode, typ)),
117-
offset_index=offset_index,
118-
change=lambda x: x + 1
119-
))
115+
invalid_test_case(lambda: mod_offset(
116+
b=serialize(container_case_fn(rng, mode, typ)),
117+
offset_index=offset_index,
118+
change=lambda x: x + 1))
120119
yield f'{name}_{mode.to_name()}_offset_{offset_index}_zeroed', \
121-
invalid_test_case(lambda: mod_offset(
122-
b=serialize(container_case_fn(rng, mode, typ)),
123-
offset_index=offset_index,
124-
change=lambda x: 0
125-
))
120+
invalid_test_case(lambda: mod_offset(
121+
b=serialize(container_case_fn(rng, mode, typ)),
122+
offset_index=offset_index,
123+
change=lambda x: 0
124+
))
126125
if index == 0:
127126
yield f'{name}_{mode.to_name()}_offset_{offset_index}_minus_one', \
128127
invalid_test_case(lambda: mod_offset(
129-
b=serialize(container_case_fn(rng, mode, typ)),
130-
offset_index=offset_index,
131-
change=lambda x: x - 1
128+
b=serialize(container_case_fn(rng, mode, typ)),
129+
offset_index=offset_index,
130+
change=lambda x: x - 1
132131
))
133132
if mode == RandomizationMode.mode_max_count:
134133
serialized = serialize(container_case_fn(rng, mode, typ))

0 commit comments

Comments
 (0)