From 2d65e476e4be571df67c76d8186b32fd42693999 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 ++++++++++++++++++++++++ README.md | 2 ++ medconb_client.py | 15 +++++++-------- requirements-dev.txt | 5 +++++ 4 files changed, 38 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..0a5351a --- /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: "Mypy: Type checking ๐Ÿ‘ฎ๐Ÿฝโ€โ™€๏ธ" + run: mypy medconb_client.py + - name: Build ๐Ÿ—๏ธ + run: python -m build diff --git a/README.md b/README.md index c77dfb8..732823f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # MedConB Client [![Documentation](https://img.shields.io/badge/Documentation-526CFE?logo=MaterialForMkDocs&logoColor=white)](https://bayer-group.github.io/medconb-client/) +[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Linting: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) This library provides a Python interface to the MedConB API. With this you can easily retrieve whole codelists from MedConB. 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..b39a136 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,3 +6,8 @@ mkdocs-gen-files mkdocs-literate-nav mkdocs-jupyter mkdocs-glightbox +black +ruff +mypy +pandas-stubs +build