Skip to content

Commit

Permalink
Preparing deployment YAML for first release. (#45)
Browse files Browse the repository at this point in the history
* removed c++ printouts

* Included vector in setup.cfg

* Added build dependencies

* added recursive submodules

* Added the dependency install in the docker

* corrected names for centos

* added gfortran

* ci: allow local wheel builds

* ci: only run one job in test matrix

* trying manylinux_2_24

* added ld_library_path

* fixed command tag

* took out ld_library_path

* fixed therepair wheel command

* changed path

* included file name as well

* trying to find file structure

* Removed debug statement

* removed debug statement

* WIP: relative RPaths

* added dll loading back

* removed auditwheel command

* emptied the command

* changed version number

* Added approximation in tests

* Added Architecture option

* moved architecture option

* removed arch option

* added cibw_arch

Co-authored-by: Henry Schreiner <[email protected]>
  • Loading branch information
aryan26roy and henryiii authored Jul 21, 2021
1 parent 9dbbd8b commit 7f4d7e3
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 28 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,32 @@ jobs:
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libmpfr-dev libboost-dev

- name: Install dependency
run: python -m pip install awkward
#- name: Install dependency
# run: python -m pip install awkward

- name: Install dependency
run: python -m pip install vector
#- name: Install dependency
# run: python -m pip install vector

- name: Install package
run: python -m pip install .[test] -v

- name: Test package
run: python -m pytest -vv -rs -Wd

test_wheels:
name: Wheel on linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
with:
submodules: recursive

- uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-manylinux_x86_64

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl
10 changes: 4 additions & 6 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest] #, macos-latest]

steps:
- uses: actions/checkout@v1
with:
submodules: true
submodules: recursive

- uses: pypa/cibuildwheel@v1.12.0
- uses: pypa/cibuildwheel@v2.0.0a4
env:
CIBW_SKIP: cp27*
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest {project}/tests
CIBW_ARCHS: auto64

- name: Upload wheels
uses: actions/upload-artifact@v2
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@ requires = [
"pybind11>=2.6.1",
]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
skip = "pp*"
test-extras = "test"
test-command = "pytest {project}/tests"
manylinux-x86_64-image = "manylinux_2_24"
manylinux-i686-image = "manylinux_2_24"

[tool.cibuildwheel.linux]
before-all = [
"apt-get update -y",
"apt-get install -y libmpfr-dev libboost-dev",
]
repair-wheel-command = []
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ packages = find:
install_requires =
awkward>=1
numpy>=1.13.3
vector
python_requires = >=3.6
include_package_data = True
package_dir =
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
PYTHON = DIR / "src/fastjet"
OUTPUT = PYTHON / "_fastjet_core"

LIBS = ["fastjet", "fastjettools", "siscone", "siscone_spherical", "fastjetplugins"]


def get_version() -> str:
g = {}
Expand Down Expand Up @@ -108,7 +110,8 @@ def run(self):
cxx_std=11,
include_dirs=[str(OUTPUT / "include")],
library_dirs=[str(OUTPUT / "lib")],
libraries=["fastjet"],
runtime_library_dirs=["$ORIGIN/_fastjet_core/lib"],
libraries=LIBS,
),
]

Expand Down
4 changes: 2 additions & 2 deletions src/fastjet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import awkward as ak

# import numpy as np

_fastjet_core = pathlib.Path(__file__).parent.resolve() / "_fastjet_core" / "lib"
_libfastjet = ctypes.cdll.LoadLibrary(_fastjet_core / "libfastjet.so")
_libfastjettools = ctypes.cdll.LoadLibrary(_fastjet_core / "libfastjettools.so")
Expand All @@ -15,6 +13,7 @@
)
_libfastjetplugins = ctypes.cdll.LoadLibrary(_fastjet_core / "libfastjetplugins.so")


import fastjet._ext # noqa: F401, E402
import fastjet._pyjet # noqa: F401, E402
import fastjet._swig # noqa: F401, E402
Expand Down Expand Up @@ -206,6 +205,7 @@
from fastjet._utils import theta # noqa: F401, E402
from fastjet.version import __version__ # noqa: E402

# TODO: everything should be in this list. Except maybe __version__.
__all__ = ("__version__",)


Expand Down
2 changes: 1 addition & 1 deletion src/fastjet/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re

__version__ = "3.3.4.0rc1"
__version__ = "3.3.4.0rc2"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))

Expand Down
16 changes: 8 additions & 8 deletions tests/test_004-exclusive_single-out.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_exclusive_dmerge_multi():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = [4.898244145524306e-05, 4.898244145524306e-05]
assert out == cluster.exclusive_dmerge(njets=1).to_list()
assert out == pytest.approx(cluster.exclusive_dmerge(njets=1).to_list())


def test_exclusive_dmerge_single():
Expand All @@ -39,7 +39,7 @@ def test_exclusive_dmerge_single():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = 4.898244145524306e-05
assert out == cluster.exclusive_dmerge(njets=1)
assert out == pytest.approx(cluster.exclusive_dmerge(njets=1))


def test_exclusive_dmerge_max_single():
Expand All @@ -54,7 +54,7 @@ def test_exclusive_dmerge_max_single():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = 4.898244145524306e-05
assert out == cluster.exclusive_dmerge_max(njets=1)
assert out == pytest.approx(cluster.exclusive_dmerge_max(njets=1))


def test_exclusive_dmerge_max_multi():
Expand All @@ -76,7 +76,7 @@ def test_exclusive_dmerge_max_multi():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = [4.898244145524306e-05, 4.898244145524306e-05]
assert out == cluster.exclusive_dmerge_max(njets=1).to_list()
assert out == pytest.approx(cluster.exclusive_dmerge_max(njets=1).to_list())


def test_exclusive_ymerge_max_multi():
Expand All @@ -98,7 +98,7 @@ def test_exclusive_ymerge_max_multi():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = [1.8699925011328223e-08, 1.8699925011328223e-08]
assert out == cluster.exclusive_ymerge_max(njets=1).to_list()
assert out == pytest.approx(cluster.exclusive_ymerge_max(njets=1).to_list())


def test_exclusive_ymerge_multi():
Expand All @@ -120,7 +120,7 @@ def test_exclusive_ymerge_multi():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = [1.8699925011328223e-08, 1.8699925011328223e-08]
assert out == cluster.exclusive_ymerge(njets=1).to_list()
assert out == pytest.approx(cluster.exclusive_ymerge(njets=1).to_list())


def test_exclusive_ymerge_single():
Expand All @@ -135,7 +135,7 @@ def test_exclusive_ymerge_single():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = 1.8699925011328223e-08
assert out == cluster.exclusive_ymerge(njets=1)
assert out == pytest.approx(cluster.exclusive_ymerge(njets=1))


def test_exclusive_ymerge_max_single():
Expand All @@ -150,7 +150,7 @@ def test_exclusive_ymerge_max_single():
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
out = 4.471685865353395e-11
assert out == cluster.exclusive_ymerge_max(njets=2)
assert out == pytest.approx(cluster.exclusive_ymerge_max(njets=2))


def test_Q_single():
Expand Down
20 changes: 14 additions & 6 deletions tests/test_006-jet_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_exclusive_subdmerge_single():
[{"px": 64.65, "py": 127.41999999999999, "pz": 1086.48, "E": 48.68}]
)
nsub_out = 1.1713099970894107e-07
assert nsub_out == cluster.exclusive_subdmerge(test_input, nsub=1)
assert nsub_out == pytest.approx(cluster.exclusive_subdmerge(test_input, nsub=1))


def test_exclusive_subdmerge_multi():
Expand Down Expand Up @@ -170,7 +170,9 @@ def test_exclusive_subdmerge_multi():
]
)
nsub_out = [1.1713099970894107e-07, 0.0]
assert nsub_out == cluster.exclusive_subdmerge(test_input, nsub=1).to_list()
assert nsub_out == pytest.approx(
cluster.exclusive_subdmerge(test_input, nsub=1).to_list()
)


def test_exclusive_subdmerge_max_multi():
Expand Down Expand Up @@ -199,7 +201,9 @@ def test_exclusive_subdmerge_max_multi():
]
)
nsub_out = [1.1713099970894107e-07, 0.0]
assert nsub_out == cluster.exclusive_subdmerge_max(test_input, nsub=1).to_list()
assert nsub_out == pytest.approx(
cluster.exclusive_subdmerge_max(test_input, nsub=1).to_list()
)


def test_exclusive_subdmerge_max_single():
Expand All @@ -218,7 +222,9 @@ def test_exclusive_subdmerge_max_single():
[{"px": 64.65, "py": 127.41999999999999, "pz": 1086.48, "E": 48.68}]
)
nsub_out = 1.1713099970894107e-07
assert nsub_out == cluster.exclusive_subdmerge_max(test_input, nsub=1)
assert nsub_out == pytest.approx(
cluster.exclusive_subdmerge_max(test_input, nsub=1)
)


def test_n_exclusive_subjets_multi():
Expand Down Expand Up @@ -397,7 +403,9 @@ def test_jet_scale_for_algorithm_multi():
]
)
nsub_out = [4.898244145524307e-05, 0.08561643835616438]
assert nsub_out == cluster.jet_scale_for_algorithm(test_input).to_list()
assert nsub_out == pytest.approx(
cluster.jet_scale_for_algorithm(test_input).to_list()
)


def test_jet_scale_for_algorithm_single():
Expand All @@ -418,7 +426,7 @@ def test_jet_scale_for_algorithm_single():
]
)
nsub_out = 0.08561643835616438
assert nsub_out == cluster.jet_scale_for_algorithm(test_input)
assert nsub_out == pytest.approx(cluster.jet_scale_for_algorithm(test_input))


def test_get_parents_multi():
Expand Down

0 comments on commit 7f4d7e3

Please sign in to comment.