From 0ecc6eea757fc19dcd8e1ba151cbc2adb9097683 Mon Sep 17 00:00:00 2001 From: Alexander Vowinkel Date: Fri, 17 Jan 2025 16:00:58 +0100 Subject: [PATCH] add ci pipeline --- .github/workflows/ci.yaml | 24 ++++++++++++++++++++++++ medconb_client.py | 15 +++++++-------- requirements-dev.txt | 3 +++ 3 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..5f3ee92 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,24 @@ +name: Lint and Build + +on: push + +jobs: + lint_and_build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + - name: Install Python 3.10 ๐Ÿ + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Set up runner ๐Ÿ“ฆ + run: pip install -r requirements.txt -r requirements-dev.txt + - name: "Black: Code Formatting ๐Ÿ‘ฎ๐Ÿฝโ€โ™€๏ธ" + run: black --check medconb_client.py + - name: "Pylama: Linting ๐Ÿงน" + run: ruff check medconb_client.py + - name: Run mypy ๐Ÿ‘ฎ๐Ÿฝโ€โ™€๏ธ + run: mypy medconb_client.py + - name: Build ๐Ÿ—๏ธ + run: python -m build diff --git a/medconb_client.py b/medconb_client.py index 30c4ff0..a5274ac 100644 --- a/medconb_client.py +++ b/medconb_client.py @@ -1,15 +1,13 @@ import logging -from dataclasses import dataclass -from typing import Optional, overload, Callable from collections import UserList -from uuid import UUID +from dataclasses import dataclass +from typing import Optional, overload -from pydantic import BaseModel import pandas as pd -from gql import Client as GQLClient, gql -from gql.transport.requests import RequestsHTTPTransport +from gql import Client as GQLClient +from gql import gql from gql.transport.aiohttp import AIOHTTPTransport -from msal import PublicClientApplication +from pydantic import BaseModel class Workspace(BaseModel): @@ -279,7 +277,8 @@ async def get_codelist_by_name( mode = "phenotype" else: raise ValueError( - "Invalid arguments: Specify either codelist_collection_name or phenotype_collection_name and phenotype_name" + "Invalid arguments: Specify either codelist_collection_name or" + " phenotype_collection_name and phenotype_name" ) candidates = await self._search_codelist(codelist_name) diff --git a/requirements-dev.txt b/requirements-dev.txt index 2507160..3fdcede 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,3 +6,6 @@ mkdocs-gen-files mkdocs-literate-nav mkdocs-jupyter mkdocs-glightbox +black +ruff +mypy