Skip to content

Commit f92bf05

Browse files
author
David Rickett
committed
update for python 3.10.12, isort, black
1 parent e669c79 commit f92bf05

File tree

14 files changed

+776
-76
lines changed

14 files changed

+776
-76
lines changed

.github/workflows/python.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
concurrency:
10+
group: test-${{ github.head_ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
PYTHONUNBUFFERED: "1"
15+
FORCE_COLOR: "1"
16+
17+
jobs:
18+
run:
19+
name: Python ${{ matrix.python-version }} Tests
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-latest]
25+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-beta.5 - 3.11"]
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Install Hatch
36+
run: pip install --upgrade hatch
37+
38+
- name: Run tests
39+
run: hatch run ci-report
40+
41+
- name: Upload coverage data
42+
uses: actions/upload-artifact@v3
43+
with:
44+
name: coverage-data
45+
path: coverage.xml
46+
47+
- name: Publish Test Report
48+
uses: mikepenz/action-junit-report@v3
49+
if: success() || failure()
50+
with:
51+
report_paths: unit_test.xml

Pipfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
biopython = "*"
8+
numpy = "*"
9+
pydantic = "*"
10+
pydantic-numpy = "*"
11+
typer = "*"
12+
pytz = "*"
13+
14+
[dev-packages]
15+
pytest = "*"
16+
mypy = "*"
17+
mypy-extensions = "*"
18+
isort = "*"
19+
black = "*"
20+
pytest-cov = "*"
21+
pytest-html = "*"
22+
pytest-mock = "*"
23+
pytest-xdist = "*"
24+
25+
[requires]
26+
python_version = "3.10"

Pipfile.lock

Lines changed: 637 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "easyhla"
77
description = ''
88
readme = "README.md"
9-
requires-python = ">=3.8"
9+
requires-python = ">=3.10"
1010
license = "MIT"
1111
keywords = []
1212
authors = [
@@ -16,8 +16,6 @@ authors = [
1616
classifiers = [
1717
"Development Status :: 4 - Beta",
1818
"Programming Language :: Python",
19-
"Programming Language :: Python :: 3.8",
20-
"Programming Language :: Python :: 3.9",
2119
"Programming Language :: Python :: 3.10",
2220
"Programming Language :: Python :: 3.11",
2321
"Programming Language :: Python :: Implementation :: CPython",
@@ -29,7 +27,7 @@ dependencies = [
2927
"pydantic-numpy",
3028
"typer",
3129
"pytz",
32-
"numpy"
30+
"numpy",
3331
]
3432

3533
dynamic = ["version"]
@@ -55,7 +53,7 @@ exclude = [
5553
"src/easyhla/check_date_modified.py",
5654
"tools",
5755
"tests/output",
58-
"tests/input"
56+
"tests/input",
5957
]
6058
skip-excluded-dirs = true
6159
directory = "output"
@@ -70,7 +68,7 @@ dependencies = [
7068
"pydantic-numpy",
7169
"typer",
7270
"pytz",
73-
"numpy"
71+
"numpy",
7472
]
7573

7674
[tool.hatch.envs.test]
@@ -92,7 +90,8 @@ extra-dependencies = [
9290
"pytest-mock",
9391
"pytest-xdist",
9492
"black",
95-
"mypy-extensions"
93+
"mypy-extensions",
94+
"isort",
9695
]
9796

9897
[tool.hatch.envs.test.scripts]
@@ -103,14 +102,13 @@ full-report = "pytest --junitxml=unit_test.xml --html=easyhla_test_report.html -
103102
no-cov = "cov --no-cov {args}"
104103

105104
[[tool.hatch.envs.test.matrix]]
106-
python = ["38", "39", "310", "311"]
105+
python = ["310", "311"]
107106

108107
[tool.pytest.ini_options]
108+
pythonpath = "src"
109109
minversion = "6.0"
110110
addopts = "-ra -n 4 --cov --cov-report xml --strict-markers -m 'not slow'"
111-
testpaths = [
112-
"tests",
113-
]
111+
testpaths = ["tests"]
114112
markers = [
115113
"integration: Run integration tests",
116114
"slow: Run integration tests that take a really long time",
@@ -124,15 +122,11 @@ omit = [
124122
"src/easyhla/__about__.py",
125123
"tests/__init__.py",
126124
"src/easyhla/entrypoint.py",
127-
"tools/*.py"
125+
"tools/*.py",
128126
]
129127

130128
[tool.coverage.report]
131-
exclude_lines = [
132-
"no cov",
133-
"if __name__ == .__main__.:",
134-
"if TYPE_CHECKING:",
135-
]
129+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
136130

137131
[tool.pydocstyle]
138132
match = "src/**/*.py"

requirements.txt

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

src/easyhla/easyhla.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1+
import logging
12
import os
23
import re
3-
import logging
4-
import typer
5-
import numpy as np
6-
from pathlib import Path
74
from datetime import datetime
8-
from typing import List, Optional, Dict, Tuple, Any, Final, Literal
9-
import Bio.SeqIO
105
from enum import Enum
6+
from pathlib import Path
7+
from typing import Any, Dict, Final, List, Literal, Optional, Tuple
118

9+
import Bio.SeqIO
10+
import numpy as np
11+
import typer
1212

1313
from .models import (
14-
Exon,
1514
Alleles,
16-
HLAStandard,
17-
HLAStandardMatch,
15+
Exon,
1816
HLACombinedStandardResult,
1917
HLAResult,
2018
HLAResultRow,
19+
HLAStandard,
20+
HLAStandardMatch,
2121
)
2222

2323

src/easyhla/entrypoint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import typer
21
import logging
32
from pathlib import Path
3+
4+
import typer
5+
46
from easyhla import EasyHLA, HLAType
57

68

src/easyhla/models.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import numpy as np
21
import re
3-
from pydantic import BaseModel
4-
from typing import Optional, Dict, List, Tuple, Set
5-
from pydantic_numpy.ndarray import NDArray
2+
from typing import Dict, List, Optional, Set, Tuple
63

4+
import numpy as np
5+
import pydantic_numpy.typing as pnd
6+
from pydantic import BaseModel
7+
from pydantic_numpy.model import NumpyModel
78

89
ALLELES_MAX_REPORTABLE_STRING: int = 3900
910

@@ -140,14 +141,14 @@ def stringify(self) -> str:
140141
return alleles_all_str
141142

142143

143-
class HLASequence(BaseModel):
144+
class HLASequence(NumpyModel):
144145
exon: Exon
145-
sequence: NDArray
146+
sequence: pnd.NpNDArray
146147

147148

148-
class HLAStandard(BaseModel):
149+
class HLAStandard(NumpyModel):
149150
allele: str
150-
sequence: NDArray
151+
sequence: pnd.NpNDArray
151152

152153
def __eq__(self, other):
153154
if type(self) != type(other):

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from src.easyhla import EasyHLA
21
from typing import Tuple
32

3+
from easyhla import EasyHLA
4+
45

56
def make_comparison(easyhla: EasyHLA, ref_seq: str, test_seq: str) -> str:
67
"""

tests/easyhla_test.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import pytest
21
import json
32
import os
4-
import pytz
5-
import numpy as np
6-
from datetime import datetime
73
from contextlib import nullcontext as does_not_raise
4+
from datetime import datetime
85
from pathlib import Path
9-
from src.easyhla.easyhla import EasyHLA, DATE_FORMAT
10-
from src.easyhla.models import (
6+
from typing import Any, Dict, List, Optional, Tuple
7+
8+
import numpy as np
9+
import pytest
10+
import pytz
11+
12+
from easyhla.easyhla import DATE_FORMAT, EasyHLA
13+
from easyhla.models import (
14+
Alleles,
15+
HLACombinedStandardResult,
1116
HLAStandard,
1217
HLAStandardMatch,
13-
HLACombinedStandardResult,
14-
Alleles,
1518
)
16-
from typing import List, Optional, Dict, Tuple, Any
1719

18-
from .conftest import make_comparison, compare_ref_vs_test
20+
from .conftest import compare_ref_vs_test, make_comparison
1921

2022

2123
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)