Skip to content

Commit

Permalink
Make pypi package (#20)
Browse files Browse the repository at this point in the history
* Make pypi package

* Hack for strange segfault error on linux
  • Loading branch information
havakv authored Dec 17, 2019
1 parent 58fded1 commit 16e35e8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish Python Package to PyPI

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ In addition, some useful preprocessing tools are available in the `pycox.preproc

## Get Started

To get started you first need to [install the package](#installation).
To get started you first need to install [PyTorch](https://pytorch.org/get-started/locally/).
You can then install **pycox** with
```sh
pip install pycox
```

We then recommend to start with [THIS INTRODUCTION NOTEBOOK](https://nbviewer.jupyter.org/github/havakv/pycox/blob/master/examples/01_introduction.ipynb), which explains the general usage of the package in terms of preprocessing, creation of neural networks, model training, and evaluation procedure.
The notebook use the `LogisticHazard` method for illustration, but most of the principles generalize to the other methods.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import numpy as np
from lifelines import KaplanMeierFitter
from pycox import utils

def test_kaplan_meier():
Expand All @@ -13,6 +12,7 @@ def test_kaplan_meier():
@pytest.mark.parametrize('n', [10, 85, 259])
@pytest.mark.parametrize('p_cens', [0, 0.3, 0.8])
def test_kaplan_meier_vs_lifelines(n, p_cens):
from lifelines import KaplanMeierFitter
np.random.seed(0)
durations = np.random.uniform(0, 100, n)
events = np.random.binomial(1, 1 - p_cens, n).astype('float')
Expand Down

0 comments on commit 16e35e8

Please sign in to comment.