Skip to content

Commit

Permalink
Tag-based overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Feb 3, 2024
1 parent 8fdf598 commit b76627e
Show file tree
Hide file tree
Showing 18 changed files with 419 additions and 239 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ jobs:
tags: ${{ steps.info.outputs.local_tag }}
load: true
cache-from: type=gha
build-args: extras_require=dev

- name: Unit tests
run: |
docker run --rm \
-v '${{ github.workspace }}:/src' -w /src \
${{ steps.info.outputs.local_tag }} \
pytest -v --color=yes -o cache_dir=/tmp/pytest
- name: Login to DockerHub
if: (github.event_name == 'push' || github.event_name == 'release') && contains(steps.info.outputs.tags_csv, 'docker.io')
Expand Down
30 changes: 17 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Python version can be changed, e.g.
# FROM python:3.8
# FROM ghcr.io/mamba-org/micromamba:1.5.1-focal-cuda-11.3.1
FROM docker.io/python:3.12.1-slim-bookworm
FROM docker.io/mambaorg/micromamba:1.5.5-bookworm-slim AS micromamba
FROM micromamba AS builder

LABEL org.opencontainers.image.authors="FNNDSC <[email protected]>" \
org.opencontainers.image.title="Publish ChRIS Public Dataset" \
org.opencontainers.image.description="Mark the outputs of a feed as compatible with the public dataset viewer feature of ChRIS_ui."
RUN \
--mount=type=cache,sharing=private,target=/home/mambauser/.mamba/pkgs,uid=57439,gid=57439 \
--mount=type=cache,sharing=private,target=/opt/conda/pkgs,uid=57439,gid=57439 \
micromamba -y -n base install -c conda-forge python=3.12.1 nibabel=5.2.0 numpy=1.26.3 tqdm=4.66.1 pydantic=2.6.0

ARG SRCDIR=/usr/local/src/pl-visual-dataset
ARG SRCDIR=/home/mambauser/pl-visual-dataset
RUN mkdir "${SRCDIR}"
WORKDIR ${SRCDIR}

COPY requirements.txt .
RUN --mount=type=cache,sharing=private,target=/root/.cache/pip pip install -r requirements.txt
ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN pip install -r requirements.txt

COPY . .
COPY --chown=mambauser:mambauser . .
ARG extras_require=none
RUN pip install ".[${extras_require}]" \
&& cd / && rm -rf ${SRCDIR}
RUN pip install ".[${extras_require}]" && cd / && rm -rf ${SRCDIR}
WORKDIR /

CMD ["pub"]
CMD ["visualdataset"]

LABEL org.opencontainers.image.authors="FNNDSC <[email protected]>" \
org.opencontainers.image.title="Create ChRIS Visual Dataset" \
org.opencontainers.image.description="Prepare a dataset for visualization with ChRIS_ui"
83 changes: 0 additions & 83 deletions print_fetal_brain_atlases_options.py

This file was deleted.

133 changes: 0 additions & 133 deletions pubchrisvisual/one.py

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
chris_plugin==0.4.0
nibabel~=5.2.0
numpy~=1.26.3
tqdm~=4.66.1
pydantic~=2.6.0
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ def get_version(rel_path: str) -> str:


setup(
name='publish-chris-dataset',
version=get_version('pubchrisvisual/__init__.py'),
description='Mark the outputs of a feed as compatible with the public dataset viewer feature of ChRIS_ui.',
name='chrisvisualdataset',
version=get_version('visualdataset/__init__.py'),
description='Prepare the outputs of a feed for the "visual datasets" feature of ChRIS_ui.',
author='FNNDSC',
author_email='[email protected]',
url='https://github.com/FNNDSC/pl-visual-dataset',
packages=['pubchrisvisual'],
packages=['visualdataset'],
install_requires=['chris_plugin'],
license='MIT',
entry_points={
'console_scripts': [
'pubone = pubchrisvisual.one:main'
'visualdataset = visualdataset.__main__:main'
]
},
classifiers=[
Expand All @@ -42,7 +42,8 @@ def get_version(rel_path: str) -> str:
extras_require={
'none': [],
'dev': [
'pytest~=7.1'
'pytest~=8.0',
'pytest-unordered~=0.5.2'
]
}
)
Empty file added tests/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions tests/examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
from typing import Sequence

from pydantic import TypeAdapter

from visualdataset.args_types import Matcher


FETAL_ATLAS_MATCHERS: Sequence[Matcher] = [
*(Matcher(key='age', value=str(age), regex=f'Age {age}/') for age in range(10, 40, 1)),

Matcher(key='author', value='Ahmed Serag et al.', regex=r'/serag\.nii\.gz$'),
Matcher(key='author', value="Ali Gholipour et al., CRL", regex=r'/ali.*\.nii\.gz$'),
Matcher(key='author', value="Kiho Im et al., FNNDSC", regex=r'/kiho\.nii\.gz$'),

Matcher(key='institution', value="Boston Children's Hospital", regex=r'/(kiho|ali).*\.nii\.gz$'),
Matcher(key='institution', value="Imperial College London", regex=r'/serag\.nii\.gz$'),

Matcher(key='type', value='mri', regex=r'/(ali|aliexp|kiho|serag)\.nii\.gz$'),
Matcher(key='type', value='segmentation', regex=r'/(ali|aliexp)_.+\.nii\.gz$'),
]

if __name__ == '__main__':
adapter = TypeAdapter(Sequence[Matcher])
print(adapter.dump_json(FETAL_ATLAS_MATCHERS).decode('utf-8'))
Loading

0 comments on commit b76627e

Please sign in to comment.