Skip to content

Commit 9995570

Browse files
authored
Merge pull request #328 from pbashyal-nmdp/upgrade-pandas-222
Support for Python 3.12
2 parents 3fd5319 + 7725ccf commit 9995570

16 files changed

+46
-28
lines changed

.github/workflows/python-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v3
19-
- name: Set up Python 3.8
19+
- name: Set up Python 3.9
2020
uses: actions/setup-python@v3
2121
with:
22-
python-version: 3.8
22+
python-version: 3.9
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip

.github/workflows/pythonpublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v3
1919
with:
20-
python-version: 3.8
20+
python-version: 3.9
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM python:3.11-slim-buster
1+
FROM python:3.12-slim-bullseye
22

33
LABEL MAINTAINER="Pradeep Bashyal"
44

55
WORKDIR /app
66

7-
ARG PY_ARD_VERSION=1.2.1
7+
ARG PY_ARD_VERSION=1.5.0
88

99
COPY requirements.txt /app
1010
RUN pip install --no-cache-dir --upgrade pip && \

Dockerfile-local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-slim-buster
1+
FROM python:3.12-slim-bullseye
22

33
LABEL MAINTAINER="Pradeep Bashyal"
44

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Swiss army knife of **HLA** Nomenclature
88

99
**Note:**
1010

11+
- 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
12+
1113
- `ping` mode is default. When in `ping` mode, alleles that do not have a G group, their corresponding P group is used.
1214

1315
- 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.

api-spec.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.3
22
info:
33
title: ARD Reduction
44
description: Reduce to ARD Level
5-
version: "1.2.1"
5+
version: "1.5.0"
66
servers:
77
- url: 'http://localhost:8080'
88
tags:
@@ -28,15 +28,22 @@ paths:
2828
operationId: api.version_controller
2929
summary: IPD-IMGT/HLA Version
3030
description: |
31-
Get IPD-IMGT/HLA DB Version used for this service
31+
Get IPD-IMGT/HLA DB Version and `py-ard` version used for this service
3232
responses:
3333
200:
3434
description: IPD-IMGT/HLA version number
3535
content:
3636
application/json:
3737
schema:
38-
type: integer
39-
example: 3440
38+
properties:
39+
ipd-version:
40+
description: IPD-IMGT/HLA DB Version
41+
type: integer
42+
example: 3560
43+
py-ard-version:
44+
description: py-ard library version
45+
type: string
46+
example: "1.2.1"
4047
/redux:
4148
post:
4249
tags:

api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ def drbx_blender_controller():
105105

106106

107107
def version_controller():
108-
version = ard.get_db_version()
109-
return {"version": version}, 200
108+
ipd_version = ard.get_db_version()
109+
return {
110+
"ipd-version": ipd_version,
111+
"py-ard-version": pyard.__version__,
112+
}, 200
110113

111114

112115
def splits_controller(allele: str):
113-
mapping = pyard.find_broad_splits(allele)
116+
mapping = ard.find_broad_splits(allele)
114117
if mapping:
115118
return {"broad": mapping[0], "splits": mapping[1]}, 200
116119

pyard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from .misc import get_imgt_db_versions as db_versions
2727

2828
__author__ = """NMDP Bioinformatics"""
29-
__version__ = "1.2.1"
29+
__version__ = "1.5.0"
3030

3131

3232
def init(

pyard/data_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def generate_ard_mapping(db_connection: sqlite3.Connection, imgt_version) -> ARS
9898
# filter out the mg with count > 1, leaving only duplicates
9999
# take the index from the 2d version the data frame, make that a column
100100
# and turn that into a list
101-
multiple_g_list = mg[mg > 1].reset_index()["index"].to_list()
101+
multiple_g_list = mg[mg > 1].index.to_list()
102102

103103
# Keep only the alleles that have more than 1 mapping
104104
dup_g = (
@@ -111,7 +111,7 @@ def generate_ard_mapping(db_connection: sqlite3.Connection, imgt_version) -> ARS
111111

112112
# multiple lgx
113113
mlgx = df_g_group.drop_duplicates(["2d", "lgx"])["2d"].value_counts()
114-
multiple_lgx_list = mlgx[mlgx > 1].reset_index()["index"].to_list()
114+
multiple_lgx_list = mlgx[mlgx > 1].index.to_list()
115115

116116
# Keep only the alleles that have more than 1 mapping
117117
dup_lgx = (

requirements-dev.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
allure-behave==2.9.45
2-
flake8==4.0.1
1+
allure-behave==2.13.5
2+
flake8==7.0.0
33
bump2version==1.0.1
4-
coverage==6.3.2
5-
wheel==0.38.1
6-
pre-commit==2.18.1
4+
coverage==7.5.3
5+
wheel==0.43.0
6+
pre-commit==3.7.1

requirements-tests.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
behave==1.2.6
2-
PyHamcrest==2.0.2
3-
pytest==7.1.2
2+
PyHamcrest==2.1.0
3+
pytest==8.2.2

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
toml==0.10.2
2-
numpy==1.24.3
3-
pandas==1.5.3
2+
pandas==2.2.2

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.1
2+
current_version = 1.5.0
33
commit = True
44
tag = True
55

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
setup(
3838
name="py-ard",
39-
version="1.2.1",
39+
version="1.5.0",
4040
description="ARD reduction for HLA with Python",
4141
long_description=readme,
4242
long_description_content_type="text/markdown",
@@ -63,9 +63,10 @@
6363
"Topic :: Scientific/Engineering :: Bio-Informatics",
6464
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
6565
"Natural Language :: English",
66-
"Programming Language :: Python :: 3.8",
6766
"Programming Language :: Python :: 3.9",
6867
"Programming Language :: Python :: 3.10",
68+
"Programming Language :: Python :: 3.11",
69+
"Programming Language :: Python :: 3.12",
6970
],
7071
test_suite="tests",
7172
tests_require=test_requirements,

tests/test_pyard.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def setUpClass(cls) -> None:
4747
cls.db_version = "3440"
4848
cls.ard = pyard.init(cls.db_version, data_dir="/tmp/py-ard")
4949

50+
def addDuration(self, test, elapsed): # Required for Python >= 3.12
51+
pass
52+
5053
def test_no_mac(self):
5154
self.assertEqual(self.ard.redux("A*01:01:01", "G"), "A*01:01:01G")
5255
self.assertEqual(self.ard.redux("A*01:01:01", "lg"), "A*01:01g")

tests/test_smart_sort.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class TestSmartSort(unittest.TestCase):
2828
def setUp(self) -> None:
2929
super().setUp()
3030

31+
def addDuration(self, test, elapsed): # Required for Python >= 3.12
32+
pass
33+
3134
def test_same_comparator(self):
3235
allele = "HLA-A*01:01"
3336
self.assertEqual(smart_sort_comparator(allele, allele), 0)

0 commit comments

Comments
 (0)