diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 4e084ef..c0b48eb 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v3 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 6590bef..48f9620 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/Dockerfile b/Dockerfile index a9147ee..ea348b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM python:3.11-slim-buster +FROM python:3.12-slim-bullseye LABEL MAINTAINER="Pradeep Bashyal" WORKDIR /app -ARG PY_ARD_VERSION=1.2.1 +ARG PY_ARD_VERSION=1.5.0 COPY requirements.txt /app RUN pip install --no-cache-dir --upgrade pip && \ diff --git a/Dockerfile-local b/Dockerfile-local index 49ae2cb..259514e 100644 --- a/Dockerfile-local +++ b/Dockerfile-local @@ -1,4 +1,4 @@ -FROM python:3.10-slim-buster +FROM python:3.12-slim-bullseye LABEL MAINTAINER="Pradeep Bashyal" diff --git a/README.md b/README.md index 6c67e38..a66ed5f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Swiss army knife of **HLA** Nomenclature **Note:** +- Python Version 3.8 is no longer supported with the latest `py-ard` versions due to latest Pandas library not supporting 3.8. Please use `py-ard==1.2.1` if using Python 3.8 + - `ping` mode is default. When in `ping` mode, alleles that do not have a G group, their corresponding P group is used. - Release `1.1.1` has extensive Serolgy related updates and affects Serology related data. Please rebuild the cache database if there's a missing Serology error. diff --git a/api-spec.yaml b/api-spec.yaml index 9f90e6f..445c48d 100644 --- a/api-spec.yaml +++ b/api-spec.yaml @@ -2,7 +2,7 @@ openapi: 3.0.3 info: title: ARD Reduction description: Reduce to ARD Level - version: "1.2.1" + version: "1.5.0" servers: - url: 'http://localhost:8080' tags: @@ -28,15 +28,22 @@ paths: operationId: api.version_controller summary: IPD-IMGT/HLA Version description: | - Get IPD-IMGT/HLA DB Version used for this service + Get IPD-IMGT/HLA DB Version and `py-ard` version used for this service responses: 200: description: IPD-IMGT/HLA version number content: application/json: schema: - type: integer - example: 3440 + properties: + ipd-version: + description: IPD-IMGT/HLA DB Version + type: integer + example: 3560 + py-ard-version: + description: py-ard library version + type: string + example: "1.2.1" /redux: post: tags: diff --git a/api.py b/api.py index e4c5691..c841366 100644 --- a/api.py +++ b/api.py @@ -105,12 +105,15 @@ def drbx_blender_controller(): def version_controller(): - version = ard.get_db_version() - return {"version": version}, 200 + ipd_version = ard.get_db_version() + return { + "ipd-version": ipd_version, + "py-ard-version": pyard.__version__, + }, 200 def splits_controller(allele: str): - mapping = pyard.find_broad_splits(allele) + mapping = ard.find_broad_splits(allele) if mapping: return {"broad": mapping[0], "splits": mapping[1]}, 200 diff --git a/pyard/__init__.py b/pyard/__init__.py index bfcb2f0..3eb294d 100644 --- a/pyard/__init__.py +++ b/pyard/__init__.py @@ -26,7 +26,7 @@ from .misc import get_imgt_db_versions as db_versions __author__ = """NMDP Bioinformatics""" -__version__ = "1.2.1" +__version__ = "1.5.0" def init( diff --git a/pyard/data_repository.py b/pyard/data_repository.py index 6a2db41..e21ecf7 100644 --- a/pyard/data_repository.py +++ b/pyard/data_repository.py @@ -98,7 +98,7 @@ def generate_ard_mapping(db_connection: sqlite3.Connection, imgt_version) -> ARS # filter out the mg with count > 1, leaving only duplicates # take the index from the 2d version the data frame, make that a column # and turn that into a list - multiple_g_list = mg[mg > 1].reset_index()["index"].to_list() + multiple_g_list = mg[mg > 1].index.to_list() # Keep only the alleles that have more than 1 mapping dup_g = ( @@ -111,7 +111,7 @@ def generate_ard_mapping(db_connection: sqlite3.Connection, imgt_version) -> ARS # multiple lgx mlgx = df_g_group.drop_duplicates(["2d", "lgx"])["2d"].value_counts() - multiple_lgx_list = mlgx[mlgx > 1].reset_index()["index"].to_list() + multiple_lgx_list = mlgx[mlgx > 1].index.to_list() # Keep only the alleles that have more than 1 mapping dup_lgx = ( diff --git a/requirements-dev.txt b/requirements-dev.txt index feb3c07..76d25b2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -allure-behave==2.9.45 -flake8==4.0.1 +allure-behave==2.13.5 +flake8==7.0.0 bump2version==1.0.1 -coverage==6.3.2 -wheel==0.38.1 -pre-commit==2.18.1 +coverage==7.5.3 +wheel==0.43.0 +pre-commit==3.7.1 diff --git a/requirements-tests.txt b/requirements-tests.txt index 48317fe..09817f1 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,3 +1,3 @@ behave==1.2.6 -PyHamcrest==2.0.2 -pytest==7.1.2 +PyHamcrest==2.1.0 +pytest==8.2.2 diff --git a/requirements.txt b/requirements.txt index 833b23f..6730bce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ toml==0.10.2 -numpy==1.24.3 -pandas==1.5.3 +pandas==2.2.2 diff --git a/setup.cfg b/setup.cfg index 9207edb..8ce90fb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.2.1 +current_version = 1.5.0 commit = True tag = True diff --git a/setup.py b/setup.py index 7d79655..795b326 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( name="py-ard", - version="1.2.1", + version="1.5.0", description="ARD reduction for HLA with Python", long_description=readme, long_description_content_type="text/markdown", @@ -63,9 +63,10 @@ "Topic :: Scientific/Engineering :: Bio-Informatics", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Natural Language :: English", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], test_suite="tests", tests_require=test_requirements, diff --git a/tests/test_pyard.py b/tests/test_pyard.py index 5ee134b..a773acd 100644 --- a/tests/test_pyard.py +++ b/tests/test_pyard.py @@ -47,6 +47,9 @@ def setUpClass(cls) -> None: cls.db_version = "3440" cls.ard = pyard.init(cls.db_version, data_dir="/tmp/py-ard") + def addDuration(self, test, elapsed): # Required for Python >= 3.12 + pass + def test_no_mac(self): self.assertEqual(self.ard.redux("A*01:01:01", "G"), "A*01:01:01G") self.assertEqual(self.ard.redux("A*01:01:01", "lg"), "A*01:01g") diff --git a/tests/test_smart_sort.py b/tests/test_smart_sort.py index d3f98ce..3d330f2 100644 --- a/tests/test_smart_sort.py +++ b/tests/test_smart_sort.py @@ -28,6 +28,9 @@ class TestSmartSort(unittest.TestCase): def setUp(self) -> None: super().setUp() + def addDuration(self, test, elapsed): # Required for Python >= 3.12 + pass + def test_same_comparator(self): allele = "HLA-A*01:01" self.assertEqual(smart_sort_comparator(allele, allele), 0)