Skip to content

Commit

Permalink
fix: update backport for changes in Numba, NumExpr, Arrow, and RDataF…
Browse files Browse the repository at this point in the history
…rame (#2735)

* fix: backport numba old to new style error capturing to avoid warnings

* backporting #2617

* backporting #2670 and tests that depend on Parquet list separator

* style: pre-commit fixes

* backporting #2617 for the _v2 subdirectory

* RDataFrame handling is broken in _v2 subdirectory; don't bother fixing because it's correct in the real Awkward 2.x

* The next awkward 1.x backport will be version 1.10.5.

* Windows can't build ('x86' vs 'x86_64'). Maybe use the old VM?

* No, change that back.

* Remove all v2 tests.

* I was changing the wrong workflow file. Let's try new Windows.

* What I really need to test is the wheel-building.

* Try again.

* On second thought, don't upload to PyPI.

* Remove 32-bit Windows from build-test.yml and modernize wheels.yml.

---------

Co-authored-by: Jim Pivarski <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent e68a046 commit cf8f373
Show file tree
Hide file tree
Showing 231 changed files with 145 additions and 68,438 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ jobs:
python-architecture:
- x64

include:
- python-version: '3.9'
python-architecture: x86

runs-on: windows-2019

env:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ jobs:
needs: [build_wheels, build_alt_wheels, make_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
environment:
name: "deploy-pypi"
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}
- uses: pypa/[email protected]
2 changes: 1 addition & 1 deletion VERSION_INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.4
1.10.5
7 changes: 4 additions & 3 deletions src/awkward/_connect/_numba/arrayview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numba
import numba.core.typing
import numba.core.typing.ctypes_utils
from numba.core.errors import NumbaTypeError

import awkward as ak

Expand Down Expand Up @@ -586,7 +587,7 @@ def generic(self, args, kwargs):
viewtype, wheretype
)
else:
raise TypeError(
raise NumbaTypeError(
"only an integer, start:stop range, or a *constant* "
"field name string may be used as ak.Array "
"slices in compiled code" + ak._util.exception_suffix(__file__)
Expand Down Expand Up @@ -874,7 +875,7 @@ def generic(self, args, kwargs):
recordviewtype, wheretype.literal_value
)(recordviewtype, wheretype)
else:
raise TypeError(
raise NumbaTypeError(
"only a *constant* field name string may be used as "
"ak.Record slices in compiled code"
+ ak._util.exception_suffix(__file__)
Expand Down Expand Up @@ -1504,7 +1505,7 @@ def generic(self, args, kwargs):
return rettype(partviewtype, wheretype)

else:
raise TypeError(
raise NumbaTypeError(
"only an integer, start:stop range, or a *constant* "
"field name string may be used as ak.Array "
"slices in compiled code" + ak._util.exception_suffix(__file__)
Expand Down
27 changes: 14 additions & 13 deletions src/awkward/_connect/_numba/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numba
import numba.core.typing
import numba.core.typing.ctypes_utils
from numba.core.errors import NumbaTypeError

import awkward as ak

Expand Down Expand Up @@ -145,7 +146,7 @@ def resolve_clear(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.clear"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -155,7 +156,7 @@ def resolve_null(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.null"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -169,7 +170,7 @@ def resolve_boolean(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.boolean"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -183,7 +184,7 @@ def resolve_integer(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.integer"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -197,7 +198,7 @@ def resolve_real(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.real"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -207,7 +208,7 @@ def resolve_begin_list(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.begin_list"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -217,7 +218,7 @@ def resolve_end_list(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_list"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -231,7 +232,7 @@ def resolve_begin_tuple(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.begin_tuple"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -245,7 +246,7 @@ def resolve_index(self, arraybuildertype, args, kwargs):
):
return arraybuildertype(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.index"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -255,7 +256,7 @@ def resolve_end_tuple(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_tuple"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -271,7 +272,7 @@ def resolve_begin_record(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.begin_record"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -285,7 +286,7 @@ def resolve_field(self, arraybuildertype, args, kwargs):
):
return arraybuildertype(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.field"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -295,7 +296,7 @@ def resolve_end_record(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_record"
+ ak._util.exception_suffix(__file__)
)
Expand Down
27 changes: 14 additions & 13 deletions src/awkward/_connect/_numba/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numba

import awkward as ak
from numba.core.errors import NumbaTypeError, NumbaValueError

np = ak.nplike.NumpyMetadata.instance()
numpy = ak.nplike.Numpy.instance()
Expand Down Expand Up @@ -41,7 +42,7 @@
@numba.extending.typeof_impl.register(ak.layout.Index64)
@numba.extending.typeof_impl.register(ak.layout.Record)
def fake_typeof(obj, c):
raise TypeError(
raise NumbaTypeError(
"{} objects cannot be passed directly into Numba-compiled functions; "
"construct a high-level ak.Array or ak.Record instead".format(
type(obj).__name__
Expand Down Expand Up @@ -334,7 +335,7 @@ def getitem_field(self, viewtype, key):
self, viewtype, viewtype.fields + (key,)
)
else:
raise TypeError(
raise NumbaTypeError(
f"array does not have a field with key {key!r}"
+ ak._util.exception_suffix(__file__)
)
Expand Down Expand Up @@ -2018,14 +2019,14 @@ def getitem_at(self, viewtype):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuples with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in records with "
"fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
Expand All @@ -2042,14 +2043,14 @@ def getitem_field(self, viewtype, key):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuples with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in records with fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
)
Expand All @@ -2063,14 +2064,14 @@ def getitem_field_record(self, recordviewtype, key):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuple with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in record with fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
)
Expand Down Expand Up @@ -2391,21 +2392,21 @@ def hasfield(self, key):

def getitem_at(self, viewtype):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)

def getitem_range(self, viewtype):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)

def getitem_field(self, viewtype, key):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)
Expand Down Expand Up @@ -2605,7 +2606,7 @@ def getitem_at(form):
elif form.primitive == "bool":
return numba.boolean
else:
raise ValueError(
raise NumbaValueError(
"unrecognized NumpyForm.primitive type: {}".format(
form.primitive
)
Expand Down Expand Up @@ -2641,7 +2642,7 @@ def getitem_at(form):
return arrayview.type.getitem_at(arrayview)

elif isinstance(form, ak.forms.UnionForm):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_connect/_numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def evaluate(
):
numexpr = import_numexpr()

context = numexpr.necompiler.getContext(kwargs, frame_depth=1)
context = numexpr.necompiler.getContext(kwargs)
expr_key = (expression, tuple(sorted(context.items())))
if expr_key not in numexpr.necompiler._names_cache:
numexpr.necompiler._names_cache[expr_key] = numexpr.necompiler.getExprNames(
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_v2/_connect/numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def evaluate(
):
numexpr = import_numexpr()

context = numexpr.necompiler.getContext(kwargs, frame_depth=1)
context = numexpr.necompiler.getContext(kwargs)
expr_key = (expression, tuple(sorted(context.items())))
if expr_key not in numexpr.necompiler._names_cache:
numexpr.necompiler._names_cache[expr_key] = numexpr.necompiler.getExprNames(
Expand Down
Loading

0 comments on commit cf8f373

Please sign in to comment.