Skip to content

Commit

Permalink
chore: Adjust dependencies and increase version (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
JabobKrauskopf authored Jul 8, 2024
1 parent 6a87df2 commit b6551ed
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 25 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Publish Package

on:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
needs: [linux, musllinux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
6 changes: 3 additions & 3 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*", "rustmodels"]
resolver = "2"

[workspace.package]
version = "0.0.1-a1"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/limebit/medmodels"
license = "BSD-3-Clause"
Expand All @@ -18,6 +18,6 @@ pyo3 = "0.21.2"
polars = { version = "0.40.0", features = ["polars-io"] }
pyo3-polars = "0.14.0"

medmodels = { version = "0.0.1-a1", path = "crates/medmodels" }
medmodels-core = { version = "0.0.1-a1", path = "crates/medmodels-core" }
medmodels-utils = { version = "0.0.1-a1", path = "crates/medmodels-utils" }
medmodels = { version = "0.1.0", path = "crates/medmodels" }
medmodels-core = { version = "0.1.0", path = "crates/medmodels-core" }
medmodels-utils = { version = "0.1.0", path = "crates/medmodels-utils" }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ We recommend to use `pip` to install the latest version of MedModels:
pip install medmodels
```

For detailed information on how to use MedModels, please read the [MedModels documentation](https://www.medmodels.de/documentation).
For detailed information on how to use MedModels, please read the [MedModels documentation](https://www.medmodels.de/api-reference/latest).
4 changes: 3 additions & 1 deletion medmodels/matching/algorithms/classic_distance_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def nearest_neighbor(

for neighbor_index in neighbor_indices:
new_row = pl.DataFrame(
[control_array_full[neighbor_index]], schema=treated_set.columns
[control_array_full[neighbor_index]],
schema=treated_set.columns,
orient="row",
)
matched_control.append(new_row)

Expand Down
8 changes: 4 additions & 4 deletions medmodels/matching/tests/test_classic_distance_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ def test_nearest_neighbor(self):
cols = ["a", "b", "c"]
array = np.array([[1, 3, 5], [5, 2, 1], [1, 4, 10]])
c_set = pl.DataFrame(array, schema=cols)
t_set = pl.DataFrame([[1, 4, 2]], schema=cols)
t_set = pl.DataFrame([[1, 4, 2]], schema=cols, orient="row")
covs = ["a", "c"]

# absolute metric
expected_abs = pl.DataFrame([[1.0, 3.0, 5.0]], schema=cols)
expected_abs = pl.DataFrame([[1.0, 3.0, 5.0]], schema=cols, orient="row")
result_abs = cdm.nearest_neighbor(t_set, c_set, "absolute", covariates=covs)
self.assertTrue(result_abs.equals(expected_abs))

# mahalanobis metric
expected_mah = pl.DataFrame([[1.0, 3.0, 5.0]], schema=cols)
expected_mah = pl.DataFrame([[1.0, 3.0, 5.0]], schema=cols, orient="row")
result_mah = cdm.nearest_neighbor(t_set, c_set, "mahalanobis", covariates=covs)
self.assertTrue(result_mah.equals(expected_mah))

expected_abs_2nn = pl.DataFrame(
[[1.0, 3.0, 5.0], [1.0, 4.0, 10.0]], schema=cols
[[1.0, 3.0, 5.0], [1.0, 4.0, 10.0]], schema=cols, orient="row"
)
result_abs_2nn = cdm.nearest_neighbor(
t_set, c_set, "absolute", covariates=covs, number_of_neighbors=2
Expand Down
46 changes: 34 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
[project]
name = "medmodels"
version = "0.0.1"
version = "0.1.0"
description = "Limebit Medmodels Package"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Healthcare Industry',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Rust',
'Topic :: Scientific/Engineering',
'Topic :: Software Development',
'Typing :: Typed',
]
dependencies = [
"numpy==2.0.0",
"pandas==2.2.2",
"polars[pandas]==0.20.31",
"scikit-learn==1.5.0",
"numpy>=2.0.0",
"pandas>=2.2.2",
"polars[pandas]>=0.20.31",
"scikit-learn>=1.5.0",
]

[project.optional-dependencies]
dev = [
"maturin==1.6.0",
"ruff==0.4.9",
"py-spy==0.3.14",
"pyright==1.1.370",
"pandas-stubs==2.2.2.240603",
"maturin>=1.6.0",
"ruff>=0.4.9",
"py-spy",
"pyright>=1.1.370",
"pandas-stubs>=2.2.2.240603",
]
tests = ["pytest==8.2.2"]
tests = ["pytest>=8.2.2"]

[build-system]
requires = ["maturin==1.6.0", "setuptools"]
requires = ["maturin>=1.6.0", "setuptools"]
build-backend = "maturin"

[tool.maturin]
Expand Down

0 comments on commit b6551ed

Please sign in to comment.