Skip to content

Support for Python 3.12 #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim-buster
FROM python:3.12-slim-bullseye

LABEL MAINTAINER="Pradeep Bashyal"

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 11 additions & 4 deletions api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pyard/data_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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 = (
Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
behave==1.2.6
PyHamcrest==2.0.2
pytest==7.1.2
PyHamcrest==2.1.0
pytest==8.2.2
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
toml==0.10.2
numpy==1.24.3
pandas==1.5.3
pandas==2.2.2
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.1
current_version = 1.5.0
commit = True
tag = True

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_pyard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_smart_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading