Skip to content

Commit 99dfe82

Browse files
authored
Restore wheel generation (#22)
1 parent 4d9ff79 commit 99dfe82

File tree

4 files changed

+74
-45
lines changed

4 files changed

+74
-45
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ jobs:
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232
- run: python -m pip install --upgrade pip wheel
33-
- run: python -m pip install -v -e .[test]
33+
- run: python -m pip install --prefer-binary -v -e .[test]
3434
- run: python -m pytest

.github/workflows/wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
name: ${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }}
1717
runs-on: ${{ matrix.os }}
1818
strategy:
19-
fail-fast: true
19+
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest, windows-latest, macos-latest]
2222
arch: [auto]
23-
py: [cp36, cp37, cp38, cp39, cp310]
23+
py: [cp37, cp38, cp39, cp310]
2424
include:
2525
- os: macos-latest
2626
py: cp38

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ filterwarnings = [
2121
]
2222

2323
[tool.cibuildwheel]
24-
test-requires = "pytest"
24+
# update skip when numpy wheels become available
25+
skip = ["*-musllinux_*", "cp310-win32", "cp310-manylinux_i686"]
26+
test-extras = ["test"]
2527
test-command = "python -m pytest {package}/tests"
2628
# to match numpy, we use manylinux2014 for cp310+
2729
manylinux-x86_64-image = "manylinux2014"

src/core.cpp

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <stdexcept>
2121
#include <vector>
2222

23-
// #include "hepevt_wrapper.h"
2423
// #include "GzReaderAscii.h"
2524

2625
void register_io(py::module& m);
@@ -354,12 +353,7 @@ PYBIND11_MODULE(_core, m) {
354353
PyErr_SetString(PyExc_IndexError, "out of bounds");
355354
throw py::error_already_set();
356355
}
357-
}) METH(length2, FourVector) METH(length, FourVector) METH(perp2, FourVector)
358-
METH(perp, FourVector) METH(interval, FourVector) METH(pt, FourVector)
359-
METH(m2, FourVector) METH(m, FourVector) METH(phi, FourVector)
360-
METH(theta, FourVector) METH(eta, FourVector) METH(rap, FourVector)
361-
METH(abs_eta, FourVector) METH(abs_rap, FourVector)
362-
METH(is_zero, FourVector)
356+
})
363357
.def(py::self == py::self)
364358
.def(py::self != py::self)
365359
.def(py::self + py::self)
@@ -370,11 +364,30 @@ PYBIND11_MODULE(_core, m) {
370364
.def(py::self -= py::self)
371365
.def(py::self *= double())
372366
.def(py::self /= double())
373-
.def("__repr__", [](const FourVector& self) {
374-
std::ostringstream os;
375-
repr(os, self);
376-
return os.str();
377-
});
367+
.def("__repr__",
368+
[](const FourVector& self) {
369+
std::ostringstream os;
370+
repr(os, self);
371+
return os.str();
372+
})
373+
// clang-format off
374+
METH(length2, FourVector)
375+
METH(length, FourVector)
376+
METH(perp2, FourVector)
377+
METH(perp, FourVector)
378+
METH(interval, FourVector)
379+
METH(pt, FourVector)
380+
METH(m2, FourVector)
381+
METH(m, FourVector)
382+
METH(phi, FourVector)
383+
METH(theta, FourVector)
384+
METH(eta, FourVector)
385+
METH(rap, FourVector)
386+
METH(abs_eta, FourVector)
387+
METH(abs_rap, FourVector)
388+
METH(is_zero, FourVector)
389+
// clang-format on
390+
;
378391

379392
py::implicitly_convertible<py::sequence, FourVector>();
380393

@@ -517,45 +530,59 @@ PYBIND11_MODULE(_core, m) {
517530
py::class_<GenParticle, GenParticlePtr>(m, "GenParticle")
518531
.def(py::init<const FourVector&, int, int>(),
519532
"momentum"_a = py::make_tuple(0, 0, 0, 0), "pid"_a = 0, "status"_a = 0)
520-
PROP_RO_OL(parent_event, GenParticle, const GenEvent*)
521-
PROP_RO(in_event, GenParticle) PROP_RO(id, GenParticle)
533+
.def(py::self == py::self)
534+
.def("__repr__",
535+
[](const GenParticlePtr& self) {
536+
std::ostringstream os;
537+
repr(os, self);
538+
return os.str();
539+
})
540+
// clang-format off
541+
PROP_RO_OL(parent_event, GenParticle, const GenEvent*)
542+
PROP_RO(in_event, GenParticle)
543+
PROP_RO(id, GenParticle)
522544
// PROP_RO(data, GenParticle)
523545
PROP_RO_OL(production_vertex, GenParticle, ConstGenVertexPtr)
524-
PROP_RO_OL(end_vertex, GenParticle, ConstGenVertexPtr)
525-
PROP_RO_OL(parents, GenParticle, std::vector<ConstGenParticlePtr>)
526-
PROP_RO_OL(children, GenParticle, std::vector<ConstGenParticlePtr>)
546+
PROP_RO_OL(end_vertex, GenParticle, ConstGenVertexPtr)
547+
PROP_RO_OL(parents, GenParticle, std::vector<ConstGenParticlePtr>)
548+
PROP_RO_OL(children, GenParticle, std::vector<ConstGenParticlePtr>)
527549
// PROP_RO(ancestors, GenParticle)
528550
// PROP_RO(descendants, GenParticle)
529-
PROP(pid, GenParticle) PROP(status, GenParticle) PROP(momentum, GenParticle)
530-
PROP(generated_mass, GenParticle) METH(is_generated_mass_set, GenParticle)
531-
METH(unset_generated_mass, GenParticle)
532-
.def(py::self == py::self)
533-
.def("__repr__", [](const GenParticlePtr& self) {
534-
std::ostringstream os;
535-
repr(os, self);
536-
return os.str();
537-
});
551+
PROP(pid, GenParticle)
552+
PROP(status, GenParticle)
553+
PROP(momentum, GenParticle)
554+
PROP(generated_mass, GenParticle)
555+
METH(is_generated_mass_set, GenParticle)
556+
METH(unset_generated_mass, GenParticle)
557+
// clang-format on
558+
;
538559

539560
py::class_<GenVertex, GenVertexPtr>(m, "GenVertex")
540561
.def(py::init<const FourVector&>(), "position"_a = py::make_tuple(0, 0, 0, 0))
541-
PROP_RO_OL(parent_event, GenVertex, const GenEvent*)
542-
PROP_RO(in_event, GenVertex) PROP_RO(id, GenVertex)
543-
PROP(status, GenVertex)
562+
.def(py::self == py::self)
563+
.def("__repr__",
564+
[](const GenVertexPtr& self) {
565+
std::ostringstream os;
566+
repr(os, self);
567+
return os.str();
568+
})
569+
// clang-format off
570+
PROP_RO_OL(parent_event, GenVertex, const GenEvent*)
571+
PROP_RO(in_event, GenVertex)
572+
PROP_RO(id, GenVertex)
573+
PROP(status, GenVertex)
574+
PROP_RO_OL(particles_in, GenVertex, const std::vector<ConstGenParticlePtr>&)
575+
PROP_RO_OL(particles_out, GenVertex, const std::vector<ConstGenParticlePtr>&)
544576
// PROP_RO(data, GenVertex)
577+
PROP(position, GenVertex)
545578
METH_OL(add_particle_in, GenVertex, void, GenParticlePtr)
546-
METH_OL(add_particle_out, GenVertex, void, GenParticlePtr)
547-
METH_OL(remove_particle_in, GenVertex, void, GenParticlePtr)
548-
METH_OL(remove_particle_out, GenVertex, void, GenParticlePtr)
579+
METH_OL(add_particle_out, GenVertex, void, GenParticlePtr)
580+
METH_OL(remove_particle_in, GenVertex, void, GenParticlePtr)
581+
METH_OL(remove_particle_out, GenVertex, void, GenParticlePtr)
549582
// METH(particles, GenVertex)
550-
PROP_RO_OL(particles_in, GenVertex, const std::vector<ConstGenParticlePtr>&)
551-
PROP_RO_OL(particles_out, GenVertex, const std::vector<ConstGenParticlePtr>&)
552-
PROP(position, GenVertex) METH(has_set_position, GenVertex)
553-
.def(py::self == py::self)
554-
.def("__repr__", [](const GenVertexPtr& self) {
555-
std::ostringstream os;
556-
repr(os, self);
557-
return os.str();
558-
});
583+
METH(has_set_position, GenVertex)
584+
// clang-format on
585+
;
559586

560587
// py::class_<GenParticleData>(m, "GenParticleData");
561588
// py::class_<GenVertexData>(m, "GenVertexData");

0 commit comments

Comments
 (0)