From b1220e13dface78a03f3193db0ea48222ed34373 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:37:24 -0700 Subject: [PATCH 01/25] rn CI on different platforms --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c10a5b3..69387b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,12 @@ permissions: jobs: buid-and-test: - runs-on: ubuntu-24.04 - strategy: fail-fast: false + matrix: + os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022", "macos-14", "macos-13"] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 From 144668333d611d9fcba1e4925095c823bec267c2 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:41:13 -0700 Subject: [PATCH 02/25] add debug statement --- .github/workflows/ci.yml | 2 +- tunits/core/cython/frac.pyx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69387b4..80b38c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022", "macos-14", "macos-13"] + os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022"] runs-on: ${{ matrix.os }} diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 79406f7..bd70dc7 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -86,6 +86,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) + print(d, x, 12*d - x, a) if abs(12*d - x) > 1e-5: raise ValueError("Not a twelfth.") From a747cccd8f6941bda5f81406d3151aa0433995a1 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:45:21 -0700 Subject: [PATCH 03/25] split ci into code-health and test --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++-------- tunits/core/cython/frac.pyx | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80b38c0..d879476 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,14 +33,8 @@ permissions: contents: read jobs: - buid-and-test: - strategy: - fail-fast: false - matrix: - os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022"] - - runs-on: ${{ matrix.os }} - + code-health: + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 @@ -68,6 +62,26 @@ jobs: - name: Check modified protos run: ci/build_changed_protos.sh origin/main + + buid-and-test: + strategy: + fail-fast: false + matrix: + os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + with: + python-version: '3.12' + + - name: Install Dependencies + run: | + pip install -r dev_tools/dev.env.txt # # Install diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index bd70dc7..cab8b0c 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -86,8 +86,8 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - print(d, x, 12*d - x, a) if abs(12*d - x) > 1e-5: + print(d, x, 12*d - x, a) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 877e87a140650dac2f3c7c1087fbb2ffa9b46429 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:50:40 -0700 Subject: [PATCH 04/25] add more debug info --- tunits/core/cython/frac.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index cab8b0c..362e9fc 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,7 +87,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) if abs(12*d - x) > 1e-5: - print(d, x, 12*d - x, a) + print('spit', d, x, 12*d - x, a, '%20f'%d, '%20f'%a) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 08433e7572e1928473ade3867e74fc6b9990d462 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:55:28 -0700 Subject: [PATCH 05/25] add more debug info --- test_perf/test_value_performance.py | 2 +- tunits/core/cython/frac.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test_perf/test_value_performance.py b/test_perf/test_value_performance.py index 47c8e21..38a7c49 100644 --- a/test_perf/test_value_performance.py +++ b/test_perf/test_value_performance.py @@ -74,7 +74,7 @@ def test_perf_repr(a: Value) -> str: return repr(a) -@perf_goal(avg_nanos=830) +@perf_goal(avg_nanos=850) def test_perf_parse_atom() -> Value: return Value(1, 'kilogram') diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 362e9fc..4c14289 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,7 +87,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) if abs(12*d - x) > 1e-5: - print('spit', d, x, 12*d - x, a, '%20f'%d, '%20f'%a) + print('spit', d, x, 12*d - x, a, '%.20f'%d, '%.20f'%a, '%.20f'%(12*d)) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 3e474d72a690302b7af3f3fd3f529f053d20f665 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 14:59:07 -0700 Subject: [PATCH 06/25] use cmath.fabs --- .github/workflows/ci.yml | 2 +- tunits/core/cython/frac.pyx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d879476..43f6680 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] + os: ["ubuntu-24.04-arm"] #["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] runs-on: ${{ matrix.os }} diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 4c14289..6c2c008 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -13,8 +13,7 @@ # limitations under the License. cimport cython -from libc.math cimport floor as c_floor, pow as c_pow - +from libc.math cimport floor as c_floor, pow as c_pow, fabs as c_fabs # A ratio that should always be canonicalized into least terms with the sign # on the numerator. @@ -86,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - if abs(12*d - x) > 1e-5: + if fabs(12*d - x) > 1e-5: print('spit', d, x, 12*d - x, a, '%.20f'%d, '%.20f'%a, '%.20f'%(12*d)) raise ValueError("Not a twelfth.") From 23cd8742c4b365c6d9e9974276f0137855f9b082 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:00:01 -0700 Subject: [PATCH 07/25] nit --- tunits/core/cython/frac.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 6c2c008..bf0a64e 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - if fabs(12*d - x) > 1e-5: + if c_fabs(12*d - x) > 1e-5: print('spit', d, x, 12*d - x, a, '%.20f'%d, '%.20f'%a, '%.20f'%(12*d)) raise ValueError("Not a twelfth.") From f57dc459aea56010a30b1ecff83f4e303b53ac52 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:02:58 -0700 Subject: [PATCH 08/25] remove debug statements --- .github/workflows/ci.yml | 2 +- tunits/core/cython/frac.pyx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43f6680..d879476 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-24.04-arm"] #["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] + os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] runs-on: ${{ matrix.os }} diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index bf0a64e..c1b66bf 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -86,7 +86,6 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) if c_fabs(12*d - x) > 1e-5: - print('spit', d, x, 12*d - x, a, '%.20f'%d, '%.20f'%a, '%.20f'%(12*d)) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 02e9178586034e6d0e849a7b6cb7186b93df96a6 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:06:59 -0700 Subject: [PATCH 09/25] add debug statement --- tunits/core/cython/frac.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index c1b66bf..d6f0a61 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -13,7 +13,7 @@ # limitations under the License. cimport cython -from libc.math cimport floor as c_floor, pow as c_pow, fabs as c_fabs +from libc.math cimport floor as c_floor, pow as c_pow # A ratio that should always be canonicalized into least terms with the sign # on the numerator. @@ -85,7 +85,9 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - if c_fabs(12*d - x) > 1e-5: + cdef double diff = 12*d - x + if max(diff, -diff) > 1e-5: + print(f'%.20f'%diff) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 99b4612fc5237353484d9fc64dc03aa045ae7a3e Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:09:23 -0700 Subject: [PATCH 10/25] add debug statement --- tunits/core/cython/frac.pyx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index d6f0a61..94f63fa 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,7 +87,11 @@ cpdef frac float_to_twelths_frac(a) except *: cdef long long x = c_floor(12*d + 0.5) cdef double diff = 12*d - x if max(diff, -diff) > 1e-5: - print(f'%.20f'%diff) + print('spit') + print('%.20f'%a) + print('%.20f'%d) + print(x) + print('%.20f'%diff) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 2fafec115696be5b85aa2fa96b3374f5a0fed3f5 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:12:55 -0700 Subject: [PATCH 11/25] add debug statement --- tunits/core/cython/frac.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 94f63fa..d482f24 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -90,6 +90,7 @@ cpdef frac float_to_twelths_frac(a) except *: print('spit') print('%.20f'%a) print('%.20f'%d) + print('%.20f'%(12*d)) print(x) print('%.20f'%diff) raise ValueError("Not a twelfth.") From c3d7c4a073a4e87f842c77e0bf3f0ee36aa5da8c Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:14:56 -0700 Subject: [PATCH 12/25] add debug statement --- tunits/core/cython/frac.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index d482f24..7a1c527 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - cdef double diff = 12*d - x + cdef double diff = 12*d - (x) if max(diff, -diff) > 1e-5: print('spit') print('%.20f'%a) From ab157b3e88ba8a077c20f1385cd27db6fc8f0434 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:17:57 -0700 Subject: [PATCH 13/25] add debug statement --- tunits/core/cython/frac.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 7a1c527..0d1b0b2 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - cdef double diff = 12*d - (x) + cdef double diff = x - 12*d if max(diff, -diff) > 1e-5: print('spit') print('%.20f'%a) From 26a6995a89082930b1c44d5a9b4e0ef1863b8a27 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:20:43 -0700 Subject: [PATCH 14/25] add debug statement --- tunits/core/cython/frac.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 0d1b0b2..592ca14 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,7 +85,8 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - cdef double diff = x - 12*d + cdef double diff = x + diff -= 12*d if max(diff, -diff) > 1e-5: print('spit') print('%.20f'%a) From c53457fc85d288fba554f60574c832441c33aeb6 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 15:25:57 -0700 Subject: [PATCH 15/25] add debug statement --- tunits/core/cython/frac.pyx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 592ca14..aa68e30 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,15 +85,8 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - cdef double diff = x - diff -= 12*d - if max(diff, -diff) > 1e-5: - print('spit') - print('%.20f'%a) - print('%.20f'%d) - print('%.20f'%(12*d)) - print(x) - print('%.20f'%diff) + cdef double y = 12*d + if y - c_floor(y) > 1e-5: raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 3fc901b7689384d343f6e6c2e5d307eab1642684 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 16:47:53 -0700 Subject: [PATCH 16/25] add debug --- tunits/core/cython/frac.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index aa68e30..669464b 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,8 +85,10 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - cdef double y = 12*d - if y - c_floor(y) > 1e-5: + if 12*d - x > 1e-5: + print(12*d - x) + print(12*d - (12*d)) + print((12*d), x) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From f440ba43efd233dbe6d6f690e70c3e6b5b2e0502 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 16:51:34 -0700 Subject: [PATCH 17/25] add debug --- tunits/core/cython/frac.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 669464b..ff0a0db 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -85,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double d = float(a) cdef long long x = c_floor(12*d + 0.5) - if 12*d - x > 1e-5: + if not (-1e-5 < 12*d - x < 1e-5): print(12*d - x) print(12*d - (12*d)) print((12*d), x) From 37c8f8e58da0832b4f6687626af54d872f05c667 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 16:56:43 -0700 Subject: [PATCH 18/25] cast --- tunits/core/cython/frac.pyx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index ff0a0db..1c38349 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -84,11 +84,12 @@ cpdef frac float_to_twelths_frac(a) except *: return frac_least_terms(a, 1) cdef double d = float(a) - cdef long long x = c_floor(12*d + 0.5) - if not (-1e-5 < 12*d - x < 1e-5): - print(12*d - x) - print(12*d - (12*d)) - print((12*d), x) + cdef double raised_d = 12.0*d + cdef long long x = c_floor(raised_d + 0.5) + if not (-1e-5 < raised_d - x < 1e-5): + print(raised_d) + print(raised_d - (raised_d)) + print((raised_d), x) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 8a408c364262a54f11cee3a8f8697751597cb43e Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 16:59:09 -0700 Subject: [PATCH 19/25] remove debug statements --- tunits/core/cython/frac.pyx | 3 --- 1 file changed, 3 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 1c38349..ce1a9a0 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,9 +87,6 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double raised_d = 12.0*d cdef long long x = c_floor(raised_d + 0.5) if not (-1e-5 < raised_d - x < 1e-5): - print(raised_d) - print(raised_d - (raised_d)) - print((raised_d), x) raise ValueError("Not a twelfth.") return frac_least_terms(x, 12) From 076d67b024bbdf00ebe7be995e64df9754154008 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:02:01 -0700 Subject: [PATCH 20/25] make perf test a seprate job --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d879476..eb56d48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Check modified protos run: ci/build_changed_protos.sh origin/main - buid-and-test: + buid-and-test-correctness: strategy: fail-fast: false matrix: @@ -91,14 +91,36 @@ jobs: run: | pip install . --user - - - name: pytest - run: ci/pytest_unit.sh - - - name: test performance - run: ci/pytest_perf.sh - - name: test compatibility with Cirq run: | pip install cirq-core pytest test/* -m cirq + + buid-and-test-performance: + strategy: + fail-fast: false + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3 + with: + python-version: '3.12' + + - name: Install Dependencies + run: | + pip install -r dev_tools/dev.env.txt + + # + # Install + # + + - name: install + run: | + pip install . --user + + - name: test performance + run: ci/pytest_perf.sh From 06393ed593946535ef5ec9e236206ba0c472d0ad Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:03:28 -0700 Subject: [PATCH 21/25] nit --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb56d48..c5622f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,6 +91,9 @@ jobs: run: | pip install . --user + - name: pytest + run: ci/pytest_unit.sh + - name: test compatibility with Cirq run: | pip install cirq-core From 0f56fb4bfdf84f5b280a2365fbfbd8513ded12cc Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:12:43 -0700 Subject: [PATCH 22/25] add debug --- .github/workflows/ci.yml | 9 +++++---- tunits/core/cython/frac.pyx | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5622f3..ccf211d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,10 +94,6 @@ jobs: - name: pytest run: ci/pytest_unit.sh - - name: test compatibility with Cirq - run: | - pip install cirq-core - pytest test/* -m cirq buid-and-test-performance: strategy: @@ -127,3 +123,8 @@ jobs: - name: test performance run: ci/pytest_perf.sh + + - name: test compatibility with Cirq + run: | + pip install cirq-core + pytest test/* -m cirq diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index ce1a9a0..66fc9a3 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,8 +87,8 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double raised_d = 12.0*d cdef long long x = c_floor(raised_d + 0.5) if not (-1e-5 < raised_d - x < 1e-5): + print(raised_d, x, (raised_d)) raise ValueError("Not a twelfth.") - return frac_least_terms(x, 12) From 1e6c6f5d369eb7756c3ab8fd63bb5b24a2975e3d Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:17:35 -0700 Subject: [PATCH 23/25] nit --- tunits/core/cython/frac.pyx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tunits/core/cython/frac.pyx b/tunits/core/cython/frac.pyx index 66fc9a3..08d7d84 100644 --- a/tunits/core/cython/frac.pyx +++ b/tunits/core/cython/frac.pyx @@ -87,8 +87,7 @@ cpdef frac float_to_twelths_frac(a) except *: cdef double raised_d = 12.0*d cdef long long x = c_floor(raised_d + 0.5) if not (-1e-5 < raised_d - x < 1e-5): - print(raised_d, x, (raised_d)) - raise ValueError("Not a twelfth.") + raise ValueError(f"{a} with 12*a={raised_d} Not a twelfth.") return frac_least_terms(x, 12) From 4ec0a0527c7c7d47455b2778347578ea646cd684 Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:21:20 -0700 Subject: [PATCH 24/25] nit --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccf211d..aa0f4b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"] + os: ["ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14"] runs-on: ${{ matrix.os }} @@ -94,6 +94,11 @@ jobs: - name: pytest run: ci/pytest_unit.sh + - name: test compatibility with Cirq + run: | + pip install cirq-core + pytest test/* -m cirq + buid-and-test-performance: strategy: @@ -123,8 +128,3 @@ jobs: - name: test performance run: ci/pytest_perf.sh - - - name: test compatibility with Cirq - run: | - pip install cirq-core - pytest test/* -m cirq From b81e464f4f7cd59126a0c4244b5c5280396d8d2b Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Wed, 24 Sep 2025 17:33:50 -0700 Subject: [PATCH 25/25] typo --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa0f4b7..a742812 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Check modified protos run: ci/build_changed_protos.sh origin/main - buid-and-test-correctness: + build-and-test-correctness: strategy: fail-fast: false matrix: @@ -100,7 +100,7 @@ jobs: pytest test/* -m cirq - buid-and-test-performance: + build-and-test-performance: strategy: fail-fast: false