diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c77edf4..3bb0cb36 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,15 @@ name: Release -on: [push, pull_request] +on: + push: + tags: + - '*' + +env: + earliest_python: "3.8" + latest_python: "3.12" + miniforge_version: "23.11.0-0" + miniforge_variant: "Mambaforge" jobs: build_sdist: @@ -64,9 +73,11 @@ jobs: - name: Build wheels (py ${{ matrix.pyver }}) Windows if: matrix.os == 'windows-latest' env: - CIBW_ARCHS_WINDOWS: "amd64 win32 arm64" + CIBW_ARCHS_WINDOWS: "amd64 win32" CIBW_BUILD: "cp${{ matrix.pyver }}-*" + uses: pypa/cibuildwheel@v2.12.3 + - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -90,7 +101,7 @@ jobs: - name: Check artifacts run: ls -lrt dist/ - - name: Publish a Python distribution to PyPI + - name: Publish Distribution uses: pypa/gh-action-pypi-publish@v1.5.0 with: user: __token__ diff --git a/biom/table.py b/biom/table.py index 9f4358f2..4b56ab56 100644 --- a/biom/table.py +++ b/biom/table.py @@ -2488,7 +2488,7 @@ def part_f(i, m): for vals, id_, md in self.iter(dense=False, axis=axis): part = part_f(id_, md) - if part is None: + if ignore_none and part is None: continue # try to make it hashable... diff --git a/biom/tests/test_table.py b/biom/tests/test_table.py index 6011f394..f22283f6 100644 --- a/biom/tests/test_table.py +++ b/biom/tests/test_table.py @@ -4309,7 +4309,7 @@ def test_partition_remove_empty(self): False: Table(np.array([[1, 2]]), ['O1', ], ['S2', 'S3'])} self.assertEqual(obs, exp) - def test_partition_ignore_none(self): + def test_partition_ignore_none_true(self): t = Table(np.array([[0, 1, 2], [3, 0, 0], [4, 0, 0]]), @@ -4321,6 +4321,20 @@ def test_partition_ignore_none(self): ['O1', 'O2', 'O3'], ['S1', ])} self.assertEqual(obs, exp) + def test_partition_ignore_none_false(self): + t = Table(np.array([[0, 1, 2], + [3, 0, 0], + [4, 0, 0]]), + ['O1', 'O2', 'O3'], + ['S1', 'S2', 'S3']) + part_f = lambda i, m: True if i == 'S1' else None # noqa + obs = dict(t.partition(part_f, ignore_none=False)) + exp = {True: Table(np.array([[0, ], [3, ], [4, ]]), + ['O1', 'O2', 'O3'], ['S1', ]), + None: Table(np.array([[1, 2], [0, 0], [0, 0]]), + ['O1', 'O2', 'O3'], ['S2', 'S3'])} + self.assertEqual(obs, exp) + def test_partition_dict_ids_to_groups(self): t = Table(np.array([[0, 1, 2], [3, 0, 0],