From c829ed1f6343b662d60e5f3cd30408fe04149f6c Mon Sep 17 00:00:00 2001 From: uw0s Date: Thu, 11 Apr 2024 15:39:26 +0300 Subject: [PATCH] Ad-hoc package --- .github/workflows/workflow.yml | 19 +++++++++++++++++-- python/main.py | 10 +++++++++- python/pyproject.toml | 9 ++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index aa9bb90..71b2174 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -8,5 +8,20 @@ jobs: uses: actions/checkout@v4 - name: Check code and build run: | - cd python/python/ && make clean check all && cd ../.. - cd python/ && make clean check all && cd .. \ No newline at end of file + cd python/python && make clean check all && cd .. + cd python/ && make clean check all && cd .. + pip: + needs: [make] + strategy: + matrix: + os: [ubuntu-20.04, windows-2022] + runs-on: ${{ matrix.os }} + steps: + - name: Set up Git repository + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Check pip installation + run: | + pip install https://api.github.com/repos/valab-certh/meddisc/tarball/main#subdirectory=python \ No newline at end of file diff --git a/python/main.py b/python/main.py index 6f12141..daad69f 100644 --- a/python/main.py +++ b/python/main.py @@ -1337,8 +1337,13 @@ async def handle_submit_button_click(user_options: UserOptionsClass) -> list[Any def ndarray_size(arr: NDArray[Any]) -> int: return arr.itemsize * arr.size +def main_cli() -> None: + import fire -if __name__ == "__main__": + fire.Fire(meddisc) + + +def meddisc() -> None: tmp_directories = [ Path("tmp/session-data/raw"), Path("tmp/session-data/clean"), @@ -1374,3 +1379,6 @@ def ndarray_size(arr: NDArray[Any]) -> int: results = pytest.main(["-rA", "-o", "cache_dir=tmp", __file__]) if results.value != 0: # type: ignore[attr-defined] sys.exit(results) + +if __name__ == "__main__": + meddisc() \ No newline at end of file diff --git a/python/pyproject.toml b/python/pyproject.toml index cbf24d7..29247b9 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -2,6 +2,7 @@ dependencies = [ "aiofiles==23.2.1", "fastapi==0.110.0", + "fire==0.6.0", "keras-ocr==0.9.3", "pydicom==2.4.4", "pylibjpeg-libjpeg==2.1.0", @@ -15,7 +16,7 @@ dependencies = [ "torchvision@https://download.pytorch.org/whl/cpu/torchvision-0.17.1%2Bcpu-cp312-cp312-linux_x86_64.whl", "uvicorn==0.27.1" ] -name = "UNKNOWN" +name = "meddisc" version = "0.0.0" [project.optional-dependencies] @@ -27,3 +28,9 @@ dev = [ "ssort==0.12.4", "toml-sort==0.23.1" ] + +[project.scripts] +meddisc = "main:main_cli" + +[tool.setuptools] +py-modules = ["main"] \ No newline at end of file