Skip to content

Commit 46796b6

Browse files
msimacekViicosdavidhewitt
authored
Build wheels for GraalPy (#1771)
Co-authored-by: Victorien <[email protected]> Co-authored-by: David Hewitt <[email protected]>
1 parent 1a945f6 commit 46796b6

File tree

12 files changed

+23
-7
lines changed

12 files changed

+23
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
- '3.14t'
7373
- 'pypy3.10'
7474
- 'pypy3.11'
75+
- 'graalpy-3.11'
7576

7677
runs-on: ubuntu-latest
7778

@@ -424,6 +425,10 @@ jobs:
424425
manylinux: auto
425426
target: x86_64
426427
interpreter: pypy3.10 pypy3.11
428+
- os: linux
429+
manylinux: auto
430+
target: x86_64
431+
interpreter: graalpy3.11
427432

428433
# musllinux
429434
- os: linux
@@ -485,6 +490,7 @@ jobs:
485490
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14 pypy3.10 pypy3.11' }}
486491
rust-toolchain: stable
487492
docker-options: -e CI
493+
before-script-linux: ${{ contains(matrix.interpreter, 'graalpy') && 'manylinux-interpreters ensure-all' || '' }}
488494

489495
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/
490496

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ classifiers = [
2727
'Programming Language :: Python :: 3.12',
2828
'Programming Language :: Python :: 3.13',
2929
'Programming Language :: Python :: 3.14',
30+
'Programming Language :: Python :: Implementation :: CPython',
31+
'Programming Language :: Python :: Implementation :: PyPy',
32+
'Programming Language :: Python :: Implementation :: GraalPy',
3033
'Programming Language :: Rust',
3134
'Framework :: Pydantic',
3235
'Intended Audience :: Developers',

tests/serializers/test_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ def f(value, handler, _info):
661661

662662

663663
@pytest.mark.skipif(
664-
platform.python_implementation() == 'PyPy' or sys.platform in {'emscripten', 'win32'},
665-
reason='fails on pypy, emscripten and windows',
664+
platform.python_implementation() in ('PyPy', 'GraalVM') or sys.platform in {'emscripten', 'win32'},
665+
reason='fails on pypy, graalpy, emscripten and windows',
666666
)
667667
def test_recursive_call():
668668
def bad_recursive(value):

tests/test_errors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,8 @@ def test_errors_include_url_envvar(env_var, env_var_value, expected_to_have_url)
11551155
env.pop('PYDANTIC_ERRORS_OMIT_URL', None) # in case the ambient environment has it set
11561156
if env_var_value is not None:
11571157
env[env_var] = env_var_value
1158-
env['PYTHONDEVMODE'] = '1' # required to surface the deprecation warning
11591158
result = subprocess.run(
1160-
[sys.executable, '-c', code],
1159+
[sys.executable, '-W', 'default', '-c', code],
11611160
stdout=subprocess.PIPE,
11621161
stderr=subprocess.STDOUT,
11631162
encoding='utf-8',

tests/test_garbage_collection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@pytest.mark.xfail(
2626
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
2727
)
28+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
2829
def test_gc_schema_serializer() -> None:
2930
# test for https://github.com/pydantic/pydantic/issues/5136
3031
class BaseModel:
@@ -53,6 +54,7 @@ class MyModel(BaseModel):
5354
@pytest.mark.xfail(
5455
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
5556
)
57+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
5658
def test_gc_schema_validator() -> None:
5759
# test for https://github.com/pydantic/pydantic/issues/5136
5860
class BaseModel:
@@ -81,6 +83,7 @@ class MyModel(BaseModel):
8183
@pytest.mark.xfail(
8284
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
8385
)
86+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
8487
def test_gc_validator_iterator() -> None:
8588
# test for https://github.com/pydantic/pydantic/issues/9243
8689
class MyModel:

tests/validators/test_dataclasses.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,7 @@ def test_dataclass_wrap_json():
15191519
@pytest.mark.xfail(
15201520
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
15211521
)
1522+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
15221523
@pytest.mark.parametrize('validator', [None, 'field', 'dataclass'])
15231524
def test_leak_dataclass(validator):
15241525
def fn():

tests/validators/test_datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def tzname(self, _dt):
276276
schema.validate_python(dt)
277277

278278
# exception messages differ between python and pypy
279-
if platform.python_implementation() == 'PyPy':
279+
if platform.python_implementation() in ('PyPy', 'GraalVM'):
280280
error_message = 'NotImplementedError: tzinfo subclass must override utcoffset()'
281281
else:
282282
error_message = 'NotImplementedError: a tzinfo subclass must implement utcoffset()'
@@ -489,7 +489,7 @@ def test_neg_7200():
489489

490490

491491
def test_tz_constraint_too_high():
492-
with pytest.raises(SchemaError, match='OverflowError: Python int too large to convert to C long'):
492+
with pytest.raises(SchemaError, match='OverflowError: Python int too large.*'):
493493
SchemaValidator(core_schema.datetime_schema(tz_constraint=2**64))
494494

495495

tests/validators/test_model_init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ def __init__(self, **kwargs):
414414
@pytest.mark.xfail(
415415
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
416416
)
417+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
417418
@pytest.mark.parametrize('validator', [None, 'field', 'model'])
418419
def test_leak_model(validator):
419420
def fn():

tests/validators/test_nullable.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_union_nullable_bool_int():
4242
@pytest.mark.xfail(
4343
condition=platform.python_implementation() == 'PyPy', reason='https://foss.heptapod.net/pypy/pypy/-/issues/3899'
4444
)
45+
@pytest.mark.skipif(platform.python_implementation() == 'GraalVM', reason='Cannot reliably trigger GC on GraalPy')
4546
def test_leak_nullable():
4647
def fn():
4748
def validate(v, info):

tests/validators/test_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,5 @@ def test_neg_7200():
293293

294294

295295
def test_tz_constraint_too_high():
296-
with pytest.raises(SchemaError, match='OverflowError: Python int too large to convert to C long'):
296+
with pytest.raises(SchemaError, match='OverflowError: Python int too large.*'):
297297
SchemaValidator(core_schema.time_schema(tz_constraint=2**64))

0 commit comments

Comments
 (0)