diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bda02e9..d449dec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,12 +18,9 @@ jobs: envs: ${{ steps.get-envs.outputs.envs }} pythons: ${{ steps.get-pythons.outputs.pythons }} steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - filter: blob:none - - name: Install uv - uses: astral-sh/setup-uv@v5 + - uses: actions/checkout@v5 + with: { fetch-depth: 0, filter: "blob:none" } + - uses: astral-sh/setup-uv@v7 - name: Get test environments id: get-envs run: | @@ -53,14 +50,10 @@ jobs: python: "3.13" os: macos-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - filter: blob:none - - uses: astral-sh/setup-uv@v5 + - uses: actions/checkout@v5 + with: { fetch-depth: 0, filter: "blob:none" } + - uses: astral-sh/setup-uv@v7 with: - enable-cache: true - cache-dependency-glob: pyproject.toml python-version: ${{ matrix.env.python }} - name: create environment run: uvx hatch env create ${{ matrix.env.name }} @@ -80,33 +73,27 @@ jobs: name: CPU Benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 + with: { fetch-depth: 0, filter: "blob:none" } - uses: actions/setup-python@v5 with: python-version: '3.13' - - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - cache-dependency-glob: pyproject.toml + - uses: astral-sh/setup-uv@v7 - run: uv pip install --system -e .[test,full] - uses: CodSpeedHQ/action@v3 with: - run: pytest -m benchmark --codspeed + run: pytest -m benchmark --codspeed -n auto token: ${{ secrets.CODSPEED_TOKEN }} import: name: Import Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - filter: blob:none + - uses: actions/checkout@v5 + with: { fetch-depth: 0, filter: "blob:none" } - uses: actions/setup-python@v5 with: python-version: '3.13' - - uses: astral-sh/setup-uv@v5 - with: - cache-dependency-glob: pyproject.toml + - uses: astral-sh/setup-uv@v7 - run: uv pip install --system -e . - run: python -c 'import fast_array_utils as fau; print(fau.__all__)' - run: uv pip install --system -e .[testing] @@ -121,10 +108,8 @@ jobs: env: SKIP: no-commit-to-branch # this CI runs on the main branch steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - filter: blob:none + - uses: actions/checkout@v5 + with: { fetch-depth: 0, filter: "blob:none" } - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index a110131..edc5f27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ optional-dependencies.test-min = [ "pytest", "pytest-codspeed", "pytest-doctestplus", + "pytest-xdist", ] optional-dependencies.testing = [ "packaging" ] urls.'Documentation' = "https://icb-fast-array-utils.readthedocs-hosted.com/" diff --git a/tests/test_stats.py b/tests/test_stats.py index 984b460..54105b7 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -371,8 +371,10 @@ def test_stats_benchmark( axis: Literal[0, 1] | None, dtype: type[np.float32 | np.float64], ) -> None: - shape = (10_000, 10_000) if "sparse" in array_type.mod else (1000, 1000) - arr = array_type.random(shape, dtype=dtype) + # test with 10M elements will take 20ms for the fastest functions + n_elems, density = 10_000_000, 0.01 + n = int(np.sqrt(n_elems / density if "sparse" in array_type.mod else n_elems)) + arr = array_type.random((n, n), density=density, dtype=dtype) func(arr, axis=axis) # warmup: numba compile benchmark(func, arr, axis=axis)