Skip to content

Commit

Permalink
fix: support for numpy 2.0 (#220)
Browse files Browse the repository at this point in the history
* remove upper bound requirement on numpy 2.0

* always return float from GetEntropy even if scipy returns a np.float64

* separate pyp uploading step into separate job in release workflow
  • Loading branch information
aryarm authored Jun 24, 2024
1 parent 99d7fb4 commit 8661226
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: GoogleCloudPlatform/release-please-action@v4.0.2
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: python
Expand Down Expand Up @@ -47,6 +45,26 @@ jobs:
run: |
poetry build --ansi -n
- name: Publish package on PyPI
- uses: actions/upload-artifact@v4
if: ${{ steps.release.outputs.release_created }}
with:
name: dist
path: dist/

upload_pypi:
needs: release
runs-on: ubuntu-latest
if: ${{ needs.release.outputs.release_created }}
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist

- name: Publish package on PyPI
uses: pypa/[email protected]
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ python = ">=3.7.1,<4.0"
importlib-metadata = {version = ">=3.0.0", python = "<3.8"}
cyvcf2 = ">=0.30.4"
matplotlib = ">=3.1.2"
numpy = ">=1.17.3,<2.0"
numpy = ">=1.17.3"
pandas = ">=1.2.0"
pysam = ">=0.15.4"
scikit-learn = ">=0.23.1"
Expand Down
2 changes: 1 addition & 1 deletion trtools/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def GetEntropy(allele_freqs: Dict[Any, float]) -> float:
"""
if not ValidateAlleleFreqs(allele_freqs):
return np.nan
return scipy.stats.entropy(list(x for x in allele_freqs.values()), base=2)
return float(scipy.stats.entropy(list(x for x in allele_freqs.values()), base=2))


def GetMean(allele_freqs):
Expand Down

0 comments on commit 8661226

Please sign in to comment.