diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 741fcb83..06baa56c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -25,7 +25,7 @@ jobs: run: pipx run twine check dist/* - name: Generate artifact attestation for sdist and wheel - uses: actions/attest-build-provenance@210c1913531870065f03ce1f9440dd87bc0938cd # v1.4.0 + uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2 with: subject-path: "dist/vector-*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae9d450e..f6fe21a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" pipx run nox -s pylint - check-light: + check-lite: runs-on: ubuntu-latest strategy: fail-fast: false @@ -44,7 +44,7 @@ jobs: - "3.10" - "3.11" - "3.12" - name: Python ${{ matrix.python-version }} - Light + name: Python ${{ matrix.python-version }} - Lite steps: - uses: actions/checkout@v4 @@ -55,11 +55,11 @@ jobs: - name: Requirements check run: python -m pip list - - name: Test light package + - name: Test lite package run: pipx run nox -s lite-${{ matrix.python-version.key || matrix.python-version }} --verbose check-full: - needs: [check-light] + needs: [check-lite] runs-on: ubuntu-latest strategy: fail-fast: false @@ -113,7 +113,7 @@ jobs: run: python -m pytest -ra -m dis --ignore tests/test_notebooks.py pass: - needs: [pre-commit, check-light, check-full, discheck] + needs: [pre-commit, check-lite, check-full, discheck] runs-on: ubuntu-latest steps: - run: echo "All jobs passed" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36832fed..11d49f51 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.5.6" + rev: "v0.6.1" hooks: - id: ruff args: ["--fix", "--show-fixes"] diff --git a/README.md b/README.md index 8a926afd..45c5fac9 100644 --- a/README.md +++ b/README.md @@ -920,9 +920,9 @@ development environment. ## Acknowledgements -This library was primarily developed by Jim Pivarski, Henry Schreiner, and Eduardo Rodrigues. +This library was primarily developed by Jim Pivarski, Henry Schreiner, Saransh Chopra, and Eduardo Rodrigues. -Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation. +Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 and PHY-2323298 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation. [actions-badge]: https://github.com/scikit-hep/vector/actions/workflows/ci.yml/badge.svg [actions-link]: https://github.com/scikit-hep/vector/actions diff --git a/docs/usage/intro.ipynb b/docs/usage/intro.ipynb index 54164e0e..f86022cf 100644 --- a/docs/usage/intro.ipynb +++ b/docs/usage/intro.ipynb @@ -34,6 +34,8 @@ "metadata": {}, "outputs": [], "source": [ + "from __future__ import annotations\n", + "\n", "import numbers\n", "\n", "import awkward as ak # at least version 1.2.0rc5\n", @@ -3249,12 +3251,12 @@ "v1 = vector.obj(x=1, y=2, z=3)\n", "v2 = vector.obj(x=1, y=2)\n", "\n", - "print(v1 - v2.like(v1)) # transforms v2 to v1's coordinate system (imputes z=0)\n", - "print(v1.like(v2) - v2) # transforms v1 to v2's coordinate system (removes z)\n", - "print(v1 - v2.to_xyz()) # transforms v2 to xyz coordinates (imputes z=0)\n", - "print(v1.to_xy() - v2) # transforms v1 to xy coordinates (removes z)\n", - "print(v1 - v2.to_Vector3D(z=3)) # transforms v2 to 3D (imputes z=3)\n", - "print(v1.to_Vector2D() - v2) # transforms v1 to 2D (removes z)" + "print(v1 - v2.like(v1)) # transforms v2 to v1's coordinate system (imputes z=0)\n", + "print(v1.like(v2) - v2) # transforms v1 to v2's coordinate system (removes z)\n", + "print(v1 - v2.to_xyz()) # transforms v2 to xyz coordinates (imputes z=0)\n", + "print(v1.to_xy() - v2) # transforms v1 to xy coordinates (removes z)\n", + "print(v1 - v2.to_Vector3D(z=3)) # transforms v2 to 3D (imputes z=3)\n", + "print(v1.to_Vector2D() - v2) # transforms v1 to 2D (removes z)" ] }, { @@ -3573,10 +3575,12 @@ "class TwoVector(vector.backends.awkward.MomentumAwkward2D):\n", " pass\n", "\n", + "\n", "@ak.mixin_class(behavior)\n", "class ThreeVector(vector.backends.awkward.MomentumAwkward3D):\n", " pass\n", "\n", + "\n", "# required for transforming vectors\n", "# the class names must always end with \"Array\"\n", "TwoVectorArray.ProjectionClass2D = TwoVectorArray # noqa: F821\n", @@ -3857,10 +3861,10 @@ "outputs": [], "source": [ "_binary_dispatch_cls = {\n", - " \"TwoVector\": TwoVector,\n", - " \"ThreeVector\": ThreeVector,\n", - " \"LorentzVector\": LorentzVector,\n", - " }\n", + " \"TwoVector\": TwoVector,\n", + " \"ThreeVector\": ThreeVector,\n", + " \"LorentzVector\": LorentzVector,\n", + "}\n", "_rank = [TwoVector, ThreeVector, LorentzVector]\n", "\n", "for lhs, lhs_to in _binary_dispatch_cls.items():\n", @@ -3951,21 +3955,9 @@ "metadata": {}, "outputs": [], "source": [ - "behavior.update(\n", - " ak._util.copy_behaviors(\n", - " \"Vector2D\", \"TwoVector\", behavior\n", - " )\n", - ")\n", - "behavior.update(\n", - " ak._util.copy_behaviors(\n", - " \"Vector3D\", \"ThreeVector\", behavior\n", - " )\n", - ")\n", - "behavior.update(\n", - " ak._util.copy_behaviors(\n", - " \"Momentum4D\", \"LorentzVector\", behavior\n", - " )\n", - ")" + "behavior.update(ak._util.copy_behaviors(\"Vector2D\", \"TwoVector\", behavior))\n", + "behavior.update(ak._util.copy_behaviors(\"Vector3D\", \"ThreeVector\", behavior))\n", + "behavior.update(ak._util.copy_behaviors(\"Momentum4D\", \"LorentzVector\", behavior))" ] }, { diff --git a/pyproject.toml b/pyproject.toml index 7604497b..1e544037 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dynamic = [ "version", ] dependencies = [ - "numpy>=1.13.3", + "numpy>=1.13.3,<2.1", "packaging>=19", ] optional-dependencies.awkward = [ @@ -137,6 +137,9 @@ isort.required-imports = [ "tests/*" = [ "T20", ] +"docs/usage/intro.ipynb" = [ + "T20", +] "src/vector/backends/_numba_object.py" = [ "PGH003", ] diff --git a/tests/test_compute_features.py b/tests/test_compute_features.py index e5185771..844167e3 100644 --- a/tests/test_compute_features.py +++ b/tests/test_compute_features.py @@ -99,7 +99,7 @@ @pytest.mark.skipif(is_unsupported, reason=unsupported_message) -@pytest.mark.slow() +@pytest.mark.slow @pytest.mark.parametrize("signature", functions.keys()) def test(signature): analyze_function(functions[signature]) diff --git a/tests/test_notebooks.py b/tests/test_notebooks.py index bdaed1cc..f06a4d42 100644 --- a/tests/test_notebooks.py +++ b/tests/test_notebooks.py @@ -7,7 +7,7 @@ import pytest -@pytest.fixture() +@pytest.fixture def common_kwargs(tmpdir): outputnb = tmpdir.join("output.ipynb") return {