Skip to content

Commit

Permalink
build: update requirements and build system (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Jul 15, 2024
1 parent 4df0acc commit 9f7e149
Show file tree
Hide file tree
Showing 114 changed files with 564 additions and 766 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4

Expand Down
16 changes: 3 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"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",
]
requires-python = ">=3.8"
requires-python = ">=3.10"
description = "VICC normalization routine for variations"
license = {file = "LICENSE"}
dependencies = [
Expand Down Expand Up @@ -50,18 +48,10 @@ Source = "https://github.com/cancervariants/variation-normalization"
"Bug Tracker" = "https://github.com/cancervariants/variation-normalization/issues"

[build-system]
requires = ["setuptools>=64"]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "variation.version.__version__"}

# Scanning for namespace packages in the ``src`` directory is true by
# default in pyproject.toml, so you do NOT need to include the
# `tool.setuptools.packages.find` if it looks like the following:
# [tool.setuptools.packages.find]
# namespaces = true
# where = ["src"]
[tool.setuptools_scm]

[tool.pytest.ini_options]
addopts = "--cov=src --cov-report term-missing"
Expand Down
9 changes: 9 additions & 0 deletions src/variation/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
"""The Variation Normalization package."""

from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("variation-normalizer")
except PackageNotFoundError:
__version__ = "unknown"
finally:
del version, PackageNotFoundError
6 changes: 2 additions & 4 deletions src/variation/classifiers/amplification_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Amplification Classifier"""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
AmplificationClassification,
Expand All @@ -13,15 +11,15 @@
class AmplificationClassifier(Classifier):
"""The Amplification Classifier class"""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the amplification classification.
:return: List of list of tokens, where order matters, that represent an
amplification classification.
"""
return [[TokenType.GENE, TokenType.AMPLIFICATION]]

def match(self, tokens: List[Token]) -> AmplificationClassification:
def match(self, tokens: list[Token]) -> AmplificationClassification:
"""Return the amplification classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for an
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/cdna_deletion_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Cdna Deletion Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
CdnaDeletionClassification,
Expand All @@ -13,15 +11,15 @@
class CdnaDeletionClassifier(Classifier):
"""The Cdna Deletion Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the cdna deletion classification.
:return: List of list of tokens, where order matters, that represent a cdna
deletion classification.
"""
return [[TokenType.GENE, TokenType.CDNA_DELETION]]

def match(self, tokens: List[Token]) -> CdnaDeletionClassification:
def match(self, tokens: list[Token]) -> CdnaDeletionClassification:
"""Return the cdna deletion classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/cdna_delins_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Cdna DelIns Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
CdnaDelInsClassification,
Expand All @@ -13,15 +11,15 @@
class CdnaDelInsClassifier(Classifier):
"""The Cdna DelIns Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the cdna delins classification.
:return: List of list of tokens, where order matters, that represent a cdna
delins classification.
"""
return [[TokenType.GENE, TokenType.CDNA_DELINS]]

def match(self, tokens: List[Token]) -> CdnaDelInsClassification:
def match(self, tokens: list[Token]) -> CdnaDelInsClassification:
"""Return the cdna delins classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/cdna_insertion_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Cdna insertion Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
CdnaInsertionClassification,
Expand All @@ -13,15 +11,15 @@
class CdnaInsertionClassifier(Classifier):
"""The Cdna insertion Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the cdna insertion classification.
:return: List of list of tokens, where order matters, that represent a cdna
insertion classification.
"""
return [[TokenType.GENE, TokenType.CDNA_INSERTION]]

def match(self, tokens: List[Token]) -> CdnaInsertionClassification:
def match(self, tokens: list[Token]) -> CdnaInsertionClassification:
"""Return the cdna insertion classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/cdna_reference_agree_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the cDNA Reference Agree Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
CdnaReferenceAgreeClassification,
Expand All @@ -13,7 +11,7 @@
class CdnaReferenceAgreeClassifier(Classifier):
"""The Cdna Reference Agree Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the cdna reference agree
classification.
Expand All @@ -29,7 +27,7 @@ def exact_match_candidates(self) -> List[List[TokenType]]:
],
]

def match(self, tokens: List[Token]) -> CdnaReferenceAgreeClassification:
def match(self, tokens: list[Token]) -> CdnaReferenceAgreeClassification:
"""Return the cdna reference agree classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/cdna_substitution_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Cdna Substitution Classifier."""

from typing import List, Optional

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
CdnaSubstitutionClassification,
Expand All @@ -13,7 +11,7 @@
class CdnaSubstitutionClassifier(Classifier):
"""The Cdna Substitution Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the cdna substitution classification.
:return: List of list of tokens, where order matters, that represent a cdna
Expand All @@ -28,7 +26,7 @@ def exact_match_candidates(self) -> List[List[TokenType]]:
],
]

def match(self, tokens: List[Token]) -> Optional[CdnaSubstitutionClassification]:
def match(self, tokens: list[Token]) -> CdnaSubstitutionClassification | None:
"""Return the cdna substitution classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
9 changes: 4 additions & 5 deletions src/variation/classifiers/classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Module for Classification methods."""

from abc import ABC, abstractmethod
from typing import List, Optional

from variation.schemas.classification_response_schema import Classification
from variation.schemas.token_response_schema import Token, TokenType
Expand All @@ -11,7 +10,7 @@ class Classifier(ABC):
"""The Classifier class."""

@abstractmethod
def match(self, tokens: List[Token]) -> Optional[Classification]:
def match(self, tokens: list[Token]) -> Classification | None:
"""Return the classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand All @@ -20,14 +19,14 @@ def match(self, tokens: List[Token]) -> Optional[Classification]:
"""

@abstractmethod
def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for a given classification.
:return: List of list of tokens, where order matters, that represent a given
classification.
"""

def can_classify(self, tokens: List[Token]) -> bool:
def can_classify(self, tokens: list[Token]) -> bool:
"""Return whether or not a list of tokens can be classified by a given
classification
Expand All @@ -36,7 +35,7 @@ def can_classify(self, tokens: List[Token]) -> bool:
matters, to represent a given classification. `False`, otherwise.
"""
token_types = [t.token_type for t in tokens]
exact_matches: List[List[TokenType]] = [
exact_matches: list[list[TokenType]] = [
c for c in self.exact_match_candidates() if token_types == c
]

Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/genomic_deletion_ambiguous.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Genomic Deletion Ambiguous Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
GenomicDeletionAmbiguousClassification,
Expand All @@ -14,7 +12,7 @@
class GenomicDeletionAmbiguousClassifier(Classifier):
"""The Genomic Deletion Ambiguous Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the genomic ambiguous deletion
classification.
Expand All @@ -23,7 +21,7 @@ def exact_match_candidates(self) -> List[List[TokenType]]:
"""
return [[TokenType.GENE, TokenType.GENOMIC_DELETION_AMBIGUOUS]]

def match(self, tokens: List[Token]) -> GenomicDeletionAmbiguousClassification:
def match(self, tokens: list[Token]) -> GenomicDeletionAmbiguousClassification:
"""Return the genomic ambiguous deletion classification from a list of token
matches.
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/genomic_deletion_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Genomic Deletion Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
GenomicDeletionClassification,
Expand All @@ -13,15 +11,15 @@
class GenomicDeletionClassifier(Classifier):
"""The Genomic Deletion Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the genomic deletion classification.
:return: List of list of tokens, where order matters, that represent a genomic
deletion classification.
"""
return [[TokenType.GENE, TokenType.GENOMIC_DELETION]]

def match(self, tokens: List[Token]) -> GenomicDeletionClassification:
def match(self, tokens: list[Token]) -> GenomicDeletionClassification:
"""Return the genomic deletion classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/genomic_delins_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Genomic DelIns Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
GenomicDelInsClassification,
Expand All @@ -13,15 +11,15 @@
class GenomicDelInsClassifier(Classifier):
"""The Genomic DelIns Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the genomic delins classification.
:return: List of list of tokens, where order matters, that represent a genomic
delins classification.
"""
return [[TokenType.GENE, TokenType.GENOMIC_DELINS]]

def match(self, tokens: List[Token]) -> GenomicDelInsClassification:
def match(self, tokens: list[Token]) -> GenomicDelInsClassification:
"""Return the genomic delins classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/genomic_duplication_ambiguous.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Genomic Duplication Ambiguous Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
GenomicDuplicationAmbiguousClassification,
Expand All @@ -14,7 +12,7 @@
class GenomicDuplicationAmbiguousClassifier(Classifier):
"""The Genomic Duplication Ambiguous Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the genomic ambiguous duplication
classification.
Expand All @@ -23,7 +21,7 @@ def exact_match_candidates(self) -> List[List[TokenType]]:
"""
return [[TokenType.GENE, TokenType.GENOMIC_DUPLICATION_AMBIGUOUS]]

def match(self, tokens: List[Token]) -> GenomicDuplicationAmbiguousClassification:
def match(self, tokens: list[Token]) -> GenomicDuplicationAmbiguousClassification:
"""Return the genomic ambiguous duplication classification from a list of token
matches.
Expand Down
6 changes: 2 additions & 4 deletions src/variation/classifiers/genomic_duplication_classifier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the Genomic Duplication Classifier."""

from typing import List

from variation.classifiers.classifier import Classifier
from variation.schemas.classification_response_schema import (
GenomicDuplicationClassification,
Expand All @@ -13,15 +11,15 @@
class GenomicDuplicationClassifier(Classifier):
"""The Genomic Duplication Classifier class."""

def exact_match_candidates(self) -> List[List[TokenType]]:
def exact_match_candidates(self) -> list[list[TokenType]]:
"""Return the token match candidates for the genomic duplication classification.
:return: List of list of tokens, where order matters, that represent a genomic
duplication classification.
"""
return [[TokenType.GENE, TokenType.GENOMIC_DUPLICATION]]

def match(self, tokens: List[Token]) -> GenomicDuplicationClassification:
def match(self, tokens: list[Token]) -> GenomicDuplicationClassification:
"""Return the genomic duplication classification from a list of token matches.
:param tokens: List of ordered tokens that are exact match candidates for a
Expand Down
Loading

0 comments on commit 9f7e149

Please sign in to comment.