Skip to content

Commit 7a0a86c

Browse files
authored
Add NLP metrics package and Unit Tests CI (#513)
* fix file mode of a non-executable text file * add basic NLP scoring methods package, unit tests, and automation * fix unit tests * fix unit tests * add test resources; fix tests * add CI bulid status badge
1 parent 9305a6f commit 7a0a86c

File tree

12 files changed

+677
-30
lines changed

12 files changed

+677
-30
lines changed

.github/workflows/run-unit-tests.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
paths-ignore:
7+
- '**.md'
8+
- 'doc/*'
9+
branches:
10+
- master
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ['3.11']
18+
steps:
19+
- name: Checkout reposistory
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: recursive
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v3
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Display Python version
30+
run: python -c "import sys; print(sys.version)"
31+
32+
- name: Install dependent packages
33+
run: 'make deps'
34+
35+
- name: Run tests
36+
run: 'make test'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.idea
22
*DS_Store*
33
*output*
4-
*resource*
4+
resource*
55

66
debug_entry*
77
playground.ipynb

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Welcome to PyHealth!
3939
:target: https://www.youtube.com/playlist?list=PLR3CNIF8DDHJUl8RLhyOVpX_kT4bxulEV
4040
:alt: YouTube
4141

42+
.. image:: https://github.com/sunlabuiuc/PyHealth/workflows/CI/badge.svg
43+
:target: https://github.com/sunlabuiuc/PyHealth/actions
44+
:alt: CI status
4245

4346

4447
.. -----

makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#@meta {author: "Paul Landes"}
2+
#@meta {desc: "PyHealth build automation", date: "2025-05-22"}
3+
4+
5+
## Build
6+
#
7+
# directory with the unit tests
8+
PY_TEST_DIR ?= tests
9+
# test file glob pattern
10+
PY_TEST_GLOB ?= test_metrics.py
11+
12+
13+
## Targets
14+
#
15+
# install dependencies
16+
.PHONY: deps
17+
deps:
18+
pip install -r requirements-nlp.txt
19+
20+
# run the unit test cases
21+
.PHONY: test
22+
test:
23+
@echo "Running tests in $(PY_TEST_DIR)/$(PY_TEST_GLOB)"
24+
python -m unittest discover \
25+
-s $(PY_TEST_DIR) -p '$(PY_TEST_GLOB)' -v
26+
27+
# clean derived objects
28+
.PHONY: clean
29+
clean:
30+
@echo "removing __pycache__"
31+
@find . -type d -name __pycache__ -prune -exec rm -r {} \;

0 commit comments

Comments
 (0)