diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 866a822..97bf7f4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -35,7 +35,7 @@ jobs: flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics - name: Check with black run: | - pip install black + pip install black==25.11.0 black --check -S -l 100 pori_python tests - name: Full Tests with pytest run: | diff --git a/.github/workflows/quick-pytest.yml b/.github/workflows/quick-pytest.yml index 9c5318a..867b5e5 100644 --- a/.github/workflows/quick-pytest.yml +++ b/.github/workflows/quick-pytest.yml @@ -32,7 +32,7 @@ jobs: flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics - name: Check with black run: | - pip install black + pip install black==25.11.0 black --check -S -l 100 pori_python tests - name: Short Tests with pytest run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov ipr --cov-report term --cov-report xml diff --git a/pori_python/graphkb/util.py b/pori_python/graphkb/util.py index bbc6776..85bfa51 100644 --- a/pori_python/graphkb/util.py +++ b/pori_python/graphkb/util.py @@ -125,6 +125,10 @@ def __init__( if username and password: self.login(username=username, password=password) + # URL check + if not self.url: + raise ValueError("URL to a GraphKB API instance is required") + @property def load(self) -> Optional[float]: if self.first_request and self.last_request: @@ -252,6 +256,7 @@ def login(self, username: str, password: str, pori_demo: bool = False) -> None: # KBDEV-1328. Alt. GraphKB login for GSC's PORI online demo if pori_demo or "pori-demo" in self.url: + logger.warning("login demo") self.login_demo() # use requests package directly to avoid recursion loop on login failure diff --git a/pori_python/ipr/main.py b/pori_python/ipr/main.py index 3194779..3a44a6d 100644 --- a/pori_python/ipr/main.py +++ b/pori_python/ipr/main.py @@ -419,16 +419,13 @@ def ipr_report( ) # GKB CONNECTION - if graphkb_url: - logger.info(f"connecting to graphkb: {graphkb_url}") - graphkb_conn = GraphKBConnection(graphkb_url) - else: - graphkb_conn = GraphKBConnection() - - gkb_user = graphkb_username if graphkb_username else username - gkb_pass = graphkb_password if graphkb_password else password + graphkb_conn = GraphKBConnection(graphkb_url) if graphkb_url else GraphKBConnection() + logger.info(f"connecting to graphkb: {graphkb_conn.url}") - graphkb_conn.login(gkb_user, gkb_pass) + graphkb_conn.login( + graphkb_username if graphkb_username else username, + graphkb_password if graphkb_password else password, + ) # DISEASE # Disease term from bioapps; expected OncoTree term @@ -502,7 +499,7 @@ def ipr_report( if include_ipr_variant_text: if not ipr_conn: - raise ValueError("ipr_url required to to include ipr variant text") + raise ValueError("ipr_url required to include ipr variant text") ipr_comments = get_ipr_analyst_comments( ipr_conn, gkb_matches, diff --git a/setup.cfg b/setup.cfg index e466a48..b5d3df0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ dev = mkdocs-redirects markdown-refdocs flake8 - black + black==25.11.0 # black >25.11 requires python >=3.10 flake8-annotations isort mypy