From cfb73faa97918beec9f7ab58353faa9239bba78b Mon Sep 17 00:00:00 2001 From: ChristianOertlin Date: Thu, 28 Nov 2024 15:32:21 +0100 Subject: [PATCH] add( rich click to cg) (#3975) (patch) # Description add rich click --- cg/apps/demultiplex/sample_sheet/api.py | 2 +- cg/cli/add.py | 2 +- cg/cli/archive.py | 2 +- cg/cli/backup.py | 2 +- cg/cli/base.py | 2 +- cg/cli/clean.py | 2 +- cg/cli/compress/base.py | 2 +- cg/cli/compress/fastq.py | 2 +- cg/cli/delete/base.py | 2 +- cg/cli/delete/case.py | 2 +- cg/cli/delete/cases.py | 2 +- cg/cli/delete/illumina_sequencing_run.py | 2 +- cg/cli/delete/observations.py | 2 +- cg/cli/deliver/base.py | 2 +- cg/cli/demultiplex/base.py | 2 +- cg/cli/demultiplex/demux.py | 2 +- cg/cli/demultiplex/finish.py | 2 +- cg/cli/demultiplex/sample_sheet.py | 2 +- cg/cli/downsample.py | 2 +- cg/cli/generate/base.py | 2 +- cg/cli/generate/delivery_report/base.py | 2 +- cg/cli/generate/delivery_report/options.py | 2 +- cg/cli/generate/delivery_report/utils.py | 2 +- cg/cli/get.py | 2 +- cg/cli/post_process/post_process.py | 2 +- cg/cli/sequencing_qc/sequencing_qc.py | 2 +- cg/cli/set/base.py | 2 +- cg/cli/set/case.py | 2 +- cg/cli/set/cases.py | 2 +- cg/cli/store/base.py | 2 +- cg/cli/store/store.py | 2 +- cg/cli/transfer.py | 2 +- cg/cli/upload/base.py | 2 +- cg/cli/upload/coverage.py | 2 +- cg/cli/upload/delivery_report.py | 2 +- cg/cli/upload/fohm.py | 2 +- cg/cli/upload/genotype.py | 2 +- cg/cli/upload/gens.py | 2 +- cg/cli/upload/gisaid.py | 2 +- cg/cli/upload/mutacc.py | 2 +- cg/cli/upload/nipt/base.py | 2 +- cg/cli/upload/nipt/ftp.py | 2 +- cg/cli/upload/nipt/statina.py | 2 +- cg/cli/upload/observations/observations.py | 2 +- cg/cli/upload/scout.py | 2 +- cg/cli/upload/utils.py | 2 +- cg/cli/upload/validate.py | 2 +- cg/cli/utils.py | 2 +- cg/cli/workflow/balsamic/base.py | 2 +- cg/cli/workflow/balsamic/options.py | 2 +- cg/cli/workflow/balsamic/pon.py | 2 +- cg/cli/workflow/balsamic/qc.py | 2 +- cg/cli/workflow/balsamic/umi.py | 2 +- cg/cli/workflow/base.py | 2 +- cg/cli/workflow/commands.py | 2 +- cg/cli/workflow/fluffy/base.py | 2 +- cg/cli/workflow/jasen/base.py | 2 +- cg/cli/workflow/microsalt/base.py | 2 +- cg/cli/workflow/mip/base.py | 2 +- cg/cli/workflow/mip/options.py | 2 +- cg/cli/workflow/mip_dna/base.py | 2 +- cg/cli/workflow/mip_rna/base.py | 2 +- cg/cli/workflow/mutant/base.py | 2 +- cg/cli/workflow/nf_analysis.py | 2 +- cg/cli/workflow/raredisease/base.py | 2 +- cg/cli/workflow/raw_data/base.py | 2 +- cg/cli/workflow/rnafusion/base.py | 2 +- cg/cli/workflow/taxprofiler/base.py | 2 +- cg/cli/workflow/tomte/base.py | 2 +- cg/cli/workflow/utils.py | 2 +- cg/constants/cli_options.py | 2 +- cg/meta/archive/archive.py | 2 +- cg/meta/upload/balsamic/balsamic.py | 2 +- .../upload/microsalt/microsalt_upload_api.py | 2 +- cg/meta/upload/mip/mip_dna.py | 2 +- cg/meta/upload/mip/mip_rna.py | 2 +- cg/meta/upload/nf_analysis.py | 2 +- cg/meta/upload/raredisease/raredisease.py | 2 +- cg/meta/upload/tomte/tomte.py | 2 +- cg/meta/upload/upload_api.py | 2 +- cg/meta/workflow/analysis.py | 2 +- cg/meta/workflow/microsalt/microsalt.py | 2 +- cg/utils/click/EnumChoice.py | 2 +- poetry.lock | 24 +++++++++++++++++-- pyproject.toml | 1 + .../demultiplex/test_validate_sample_sheet.py | 4 +--- .../context_fixtures.py | 2 +- 87 files changed, 108 insertions(+), 89 deletions(-) diff --git a/cg/apps/demultiplex/sample_sheet/api.py b/cg/apps/demultiplex/sample_sheet/api.py index 353587f450..c581c0de0c 100644 --- a/cg/apps/demultiplex/sample_sheet/api.py +++ b/cg/apps/demultiplex/sample_sheet/api.py @@ -1,7 +1,7 @@ import logging from pathlib import Path -import click +import rich_click as click from cg.apps.demultiplex.sample_sheet.read_sample_sheet import get_samples_from_content from cg.apps.demultiplex.sample_sheet.sample_models import IlluminaSampleIndexSetting diff --git a/cg/cli/add.py b/cg/cli/add.py index 3aae8edbac..be9bb5b961 100644 --- a/cg/cli/add.py +++ b/cg/cli/add.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS, is_case_name_allowed from cg.constants import DataDelivery, Priority, Workflow diff --git a/cg/cli/archive.py b/cg/cli/archive.py index 35a76a3e9b..08ca079a78 100644 --- a/cg/cli/archive.py +++ b/cg/cli/archive.py @@ -1,4 +1,4 @@ -import click +import rich_click as click from click.core import ParameterSource from cg.cli.utils import CLICK_CONTEXT_SETTINGS diff --git a/cg/cli/backup.py b/cg/cli/backup.py index 7b18cdb127..b59b618acd 100644 --- a/cg/cli/backup.py +++ b/cg/cli/backup.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Iterable -import click +import rich_click as click import housekeeper.store.models as hk_models from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/base.py b/cg/cli/base.py index 761644d3bb..9ba7925f52 100644 --- a/cg/cli/base.py +++ b/cg/cli/base.py @@ -4,7 +4,7 @@ import sys from pathlib import Path -import click +import rich_click as click import coloredlogs from sqlalchemy.orm import scoped_session diff --git a/cg/cli/clean.py b/cg/cli/clean.py index 384c6f5fed..5dff4f00d2 100644 --- a/cg/cli/clean.py +++ b/cg/cli/clean.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta from pathlib import Path -import click +import rich_click as click from housekeeper.store.models import File, Version from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/compress/base.py b/cg/cli/compress/base.py index 07094e925d..c64ee62d7c 100644 --- a/cg/cli/compress/base.py +++ b/cg/cli/compress/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.compress.fastq import ( clean_fastq, diff --git a/cg/cli/compress/fastq.py b/cg/cli/compress/fastq.py index 7ce779c8e8..156cb3ae77 100644 --- a/cg/cli/compress/fastq.py +++ b/cg/cli/compress/fastq.py @@ -3,7 +3,7 @@ import logging from typing import Iterable -import click +import rich_click as click from cg.apps.housekeeper.hk import HousekeeperAPI from cg.cli.compress.helpers import ( diff --git a/cg/cli/delete/base.py b/cg/cli/delete/base.py index 456e51d8b8..35d9b797da 100644 --- a/cg/cli/delete/base.py +++ b/cg/cli/delete/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.delete.case import delete_case from cg.cli.delete.cases import delete_cases diff --git a/cg/cli/delete/case.py b/cg/cli/delete/case.py index 54e6c88940..775c70aaf8 100644 --- a/cg/cli/delete/case.py +++ b/cg/cli/delete/case.py @@ -3,7 +3,7 @@ import datetime import logging -import click +import rich_click as click from cg.cli.get import get_case as print_case from cg.constants.cli_options import DRY_RUN, SKIP_CONFIRMATION diff --git a/cg/cli/delete/cases.py b/cg/cli/delete/cases.py index bcc9f2654b..e39373fe42 100644 --- a/cg/cli/delete/cases.py +++ b/cg/cli/delete/cases.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.delete.case import delete_case from cg.constants.cli_options import DRY_RUN diff --git a/cg/cli/delete/illumina_sequencing_run.py b/cg/cli/delete/illumina_sequencing_run.py index 8043582a35..0a0c70801e 100644 --- a/cg/cli/delete/illumina_sequencing_run.py +++ b/cg/cli/delete/illumina_sequencing_run.py @@ -1,4 +1,4 @@ -import click +import rich_click as click from cg.constants.cli_options import DRY_RUN from cg.services.illumina.post_processing.housekeeper_storage import ( diff --git a/cg/cli/delete/observations.py b/cg/cli/delete/observations.py index 32db5fa4cf..1ce8566314 100644 --- a/cg/cli/delete/observations.py +++ b/cg/cli/delete/observations.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from sqlalchemy.orm import Query from cg.cli.upload.observations.utils import get_observations_api diff --git a/cg/cli/deliver/base.py b/cg/cli/deliver/base.py index 39ba54e19e..265fba2f8f 100644 --- a/cg/cli/deliver/base.py +++ b/cg/cli/deliver/base.py @@ -3,7 +3,7 @@ import logging from pathlib import Path -import click +import rich_click as click from cg.apps.tb import TrailblazerAPI from cg.cli.deliver.utils import deliver_raw_data_for_analyses diff --git a/cg/cli/demultiplex/base.py b/cg/cli/demultiplex/base.py index 4954b8b27b..a6baa60669 100644 --- a/cg/cli/demultiplex/base.py +++ b/cg/cli/demultiplex/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.demultiplex.demux import ( diff --git a/cg/cli/demultiplex/demux.py b/cg/cli/demultiplex/demux.py index 4bc41f1103..187ead1222 100644 --- a/cg/cli/demultiplex/demux.py +++ b/cg/cli/demultiplex/demux.py @@ -2,7 +2,7 @@ from glob import glob from pathlib import Path -import click +import rich_click as click from pydantic import ValidationError from cg.apps.demultiplex.demultiplex_api import DemultiplexingAPI diff --git a/cg/cli/demultiplex/finish.py b/cg/cli/demultiplex/finish.py index db710ce96d..0328f24c25 100644 --- a/cg/cli/demultiplex/finish.py +++ b/cg/cli/demultiplex/finish.py @@ -3,7 +3,7 @@ import logging from pathlib import Path -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.cli_options import DRY_RUN, FORCE diff --git a/cg/cli/demultiplex/sample_sheet.py b/cg/cli/demultiplex/sample_sheet.py index 3a860601df..42be67952c 100644 --- a/cg/cli/demultiplex/sample_sheet.py +++ b/cg/cli/demultiplex/sample_sheet.py @@ -1,7 +1,7 @@ import logging from pathlib import Path -import click +import rich_click as click from pydantic import ValidationError from cg.apps.demultiplex.sample_sheet.api import IlluminaSampleSheetService diff --git a/cg/cli/downsample.py b/cg/cli/downsample.py index bd24e94a33..2b1695ee45 100644 --- a/cg/cli/downsample.py +++ b/cg/cli/downsample.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Tuple -import click +import rich_click as click from cg.apps.downsample.downsample import DownsampleAPI from cg.apps.downsample.utils import store_downsampled_sample_bundle diff --git a/cg/cli/generate/base.py b/cg/cli/generate/base.py index c1f32e0efd..67de232244 100644 --- a/cg/cli/generate/base.py +++ b/cg/cli/generate/base.py @@ -1,6 +1,6 @@ """Common CLI file generation functions""" -import click +import rich_click as click from cg.cli.generate.delivery_report.base import ( generate_available_delivery_reports, diff --git a/cg/cli/generate/delivery_report/base.py b/cg/cli/generate/delivery_report/base.py index 834c4900b8..ab1676f985 100644 --- a/cg/cli/generate/delivery_report/base.py +++ b/cg/cli/generate/delivery_report/base.py @@ -5,7 +5,7 @@ from datetime import datetime from pathlib import Path -import click +import rich_click as click from housekeeper.store.models import Version from cg.cli.generate.delivery_report.options import ( diff --git a/cg/cli/generate/delivery_report/options.py b/cg/cli/generate/delivery_report/options.py index f41af3a4eb..54ac10aac7 100644 --- a/cg/cli/generate/delivery_report/options.py +++ b/cg/cli/generate/delivery_report/options.py @@ -1,6 +1,6 @@ """Delivery report specific command options.""" -import click +import rich_click as click from cg.constants import REPORT_SUPPORTED_WORKFLOW diff --git a/cg/cli/generate/delivery_report/utils.py b/cg/cli/generate/delivery_report/utils.py index 66ab9ad6c7..fc11f4e321 100644 --- a/cg/cli/generate/delivery_report/utils.py +++ b/cg/cli/generate/delivery_report/utils.py @@ -3,7 +3,7 @@ import logging from datetime import datetime -import click +import rich_click as click from cg.constants import REPORT_SUPPORTED_DATA_DELIVERY, REPORT_SUPPORTED_WORKFLOW, Workflow from cg.meta.delivery_report.balsamic import BalsamicDeliveryReportAPI diff --git a/cg/cli/get.py b/cg/cli/get.py index bf73a29121..ea49e4d5fd 100644 --- a/cg/cli/get.py +++ b/cg/cli/get.py @@ -2,7 +2,7 @@ import re from typing import Iterable -import click +import rich_click as click from tabulate import tabulate from cg.cli.utils import CLICK_CONTEXT_SETTINGS diff --git a/cg/cli/post_process/post_process.py b/cg/cli/post_process/post_process.py index f0fc1ccd8f..861d42c853 100644 --- a/cg/cli/post_process/post_process.py +++ b/cg/cli/post_process/post_process.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.post_process.utils import ( UnprocessedRunInfo, diff --git a/cg/cli/sequencing_qc/sequencing_qc.py b/cg/cli/sequencing_qc/sequencing_qc.py index 031c25fa2e..c1b20e6681 100644 --- a/cg/cli/sequencing_qc/sequencing_qc.py +++ b/cg/cli/sequencing_qc/sequencing_qc.py @@ -1,5 +1,5 @@ import logging -import click +import rich_click as click from cg.models.cg_config import CGConfig from cg.services.sequencing_qc_service.sequencing_qc_service import SequencingQCService diff --git a/cg/cli/set/base.py b/cg/cli/set/base.py index 08a9fc9034..d06aad0522 100644 --- a/cg/cli/set/base.py +++ b/cg/cli/set/base.py @@ -5,7 +5,7 @@ import logging from typing import Iterable -import click +import rich_click as click from cg.cli.set.case import set_case from cg.cli.set.cases import set_cases diff --git a/cg/cli/set/case.py b/cg/cli/set/case.py index e84c8af929..40c1df7c18 100644 --- a/cg/cli/set/case.py +++ b/cg/cli/set/case.py @@ -3,7 +3,7 @@ import logging from typing import Callable -import click +import rich_click as click from cg.constants import DataDelivery, Priority, Workflow from cg.constants.constants import CaseActions diff --git a/cg/cli/set/cases.py b/cg/cli/set/cases.py index 1c4b81433a..243d5f5020 100644 --- a/cg/cli/set/cases.py +++ b/cg/cli/set/cases.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.set.case import set_case from cg.constants import Priority diff --git a/cg/cli/store/base.py b/cg/cli/store/base.py index a9319605b2..8ef8520f41 100644 --- a/cg/cli/store/base.py +++ b/cg/cli/store/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.apps.crunchy.crunchy import CrunchyAPI from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/store/store.py b/cg/cli/store/store.py index 95513d8267..0f54f18045 100644 --- a/cg/cli/store/store.py +++ b/cg/cli/store/store.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import Iterable -import click +import rich_click as click from housekeeper.store.models import File from cg.apps.crunchy.files import update_metadata_paths diff --git a/cg/cli/transfer.py b/cg/cli/transfer.py index 720eca446b..13cd3318c5 100644 --- a/cg/cli/transfer.py +++ b/cg/cli/transfer.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.apps.lims import LimsAPI from cg.cli.utils import CLICK_CONTEXT_SETTINGS diff --git a/cg/cli/upload/base.py b/cg/cli/upload/base.py index 4840e1af7d..4bf46d6303 100644 --- a/cg/cli/upload/base.py +++ b/cg/cli/upload/base.py @@ -4,7 +4,7 @@ import sys import traceback -import click +import rich_click as click from cg.cli.upload.coverage import upload_coverage from cg.cli.upload.delivery_report import upload_delivery_report_to_scout diff --git a/cg/cli/upload/coverage.py b/cg/cli/upload/coverage.py index f37ed7b028..7e53e1581b 100644 --- a/cg/cli/upload/coverage.py +++ b/cg/cli/upload/coverage.py @@ -1,6 +1,6 @@ """Code for uploading coverage reports via CLI""" -import click +import rich_click as click from cg.meta.upload.coverage import UploadCoverageApi from cg.models.cg_config import CGConfig diff --git a/cg/cli/upload/delivery_report.py b/cg/cli/upload/delivery_report.py index 25e8d15c5a..03cf990558 100644 --- a/cg/cli/upload/delivery_report.py +++ b/cg/cli/upload/delivery_report.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from housekeeper.store.models import Version from cg.cli.generate.delivery_report.options import ARGUMENT_CASE_ID diff --git a/cg/cli/upload/fohm.py b/cg/cli/upload/fohm.py index 194b610cdb..6571e0be8c 100644 --- a/cg/cli/upload/fohm.py +++ b/cg/cli/upload/fohm.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.cli_options import DRY_RUN diff --git a/cg/cli/upload/genotype.py b/cg/cli/upload/genotype.py index ee79a25641..9371c51a6c 100644 --- a/cg/cli/upload/genotype.py +++ b/cg/cli/upload/genotype.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.apps.gt import GenotypeAPI from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/upload/gens.py b/cg/cli/upload/gens.py index a2ae7f55c0..ad317c4bae 100644 --- a/cg/cli/upload/gens.py +++ b/cg/cli/upload/gens.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from housekeeper.store.models import File from cg.apps.gens import GensAPI diff --git a/cg/cli/upload/gisaid.py b/cg/cli/upload/gisaid.py index 96b4e24d63..0a4461023d 100644 --- a/cg/cli/upload/gisaid.py +++ b/cg/cli/upload/gisaid.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.meta.upload.gisaid import GisaidAPI from cg.models.cg_config import CGConfig diff --git a/cg/cli/upload/mutacc.py b/cg/cli/upload/mutacc.py index c8f315fd52..a57aee91a6 100644 --- a/cg/cli/upload/mutacc.py +++ b/cg/cli/upload/mutacc.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.apps.mutacc_auto import MutaccAutoAPI from cg.apps.scout.scout_export import ScoutExportCase diff --git a/cg/cli/upload/nipt/base.py b/cg/cli/upload/nipt/base.py index 7c76e97158..72fd2ad482 100644 --- a/cg/cli/upload/nipt/base.py +++ b/cg/cli/upload/nipt/base.py @@ -3,7 +3,7 @@ import logging import traceback -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.cli_options import DRY_RUN, FORCE diff --git a/cg/cli/upload/nipt/ftp.py b/cg/cli/upload/nipt/ftp.py index bfd69c2f47..12c07ac7de 100644 --- a/cg/cli/upload/nipt/ftp.py +++ b/cg/cli/upload/nipt/ftp.py @@ -1,7 +1,7 @@ import logging from pathlib import Path -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.cli_options import DRY_RUN, FORCE diff --git a/cg/cli/upload/nipt/statina.py b/cg/cli/upload/nipt/statina.py index febe3f15c3..56f52be463 100644 --- a/cg/cli/upload/nipt/statina.py +++ b/cg/cli/upload/nipt/statina.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.cli_options import DRY_RUN, FORCE diff --git a/cg/cli/upload/observations/observations.py b/cg/cli/upload/observations/observations.py index 1f51e40dda..abddad3c38 100644 --- a/cg/cli/upload/observations/observations.py +++ b/cg/cli/upload/observations/observations.py @@ -3,7 +3,7 @@ import logging from datetime import datetime -import click +import rich_click as click from sqlalchemy.orm import Query from cg.cli.upload.observations.utils import get_observations_api diff --git a/cg/cli/upload/scout.py b/cg/cli/upload/scout.py index a8a4064609..88812528ca 100644 --- a/cg/cli/upload/scout.py +++ b/cg/cli/upload/scout.py @@ -3,7 +3,7 @@ import logging from pathlib import Path -import click +import rich_click as click from housekeeper.store.models import File, Version from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/upload/utils.py b/cg/cli/upload/utils.py index 5276b47475..8ca6db9d28 100644 --- a/cg/cli/upload/utils.py +++ b/cg/cli/upload/utils.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.constants import Workflow from cg.constants.constants import MAX_ITEMS_TO_RETRIEVE diff --git a/cg/cli/upload/validate.py b/cg/cli/upload/validate.py index 220934153e..bd2bd09055 100644 --- a/cg/cli/upload/validate.py +++ b/cg/cli/upload/validate.py @@ -1,6 +1,6 @@ """Code for validating an upload via CLI""" -import click +import rich_click as click from cg.apps.coverage import ChanjoAPI from cg.models.cg_config import CGConfig diff --git a/cg/cli/utils.py b/cg/cli/utils.py index 6e55703502..be13b5c52b 100644 --- a/cg/cli/utils.py +++ b/cg/cli/utils.py @@ -1,7 +1,7 @@ import re import shutil -import click +import rich_click as click from cg.constants import Workflow from cg.meta.workflow.raredisease import RarediseaseAnalysisAPI diff --git a/cg/cli/workflow/balsamic/base.py b/cg/cli/workflow/balsamic/base.py index b3028c1c30..afb18bc185 100644 --- a/cg/cli/workflow/balsamic/base.py +++ b/cg/cli/workflow/balsamic/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from pydantic.v1 import ValidationError from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/workflow/balsamic/options.py b/cg/cli/workflow/balsamic/options.py index 744393ee38..374640ecfe 100644 --- a/cg/cli/workflow/balsamic/options.py +++ b/cg/cli/workflow/balsamic/options.py @@ -1,4 +1,4 @@ -import click +import rich_click as click from cg.constants.constants import GenomeVersion from cg.constants.priority import SlurmQos diff --git a/cg/cli/workflow/balsamic/pon.py b/cg/cli/workflow/balsamic/pon.py index 6c07b35925..186a3c038b 100644 --- a/cg/cli/workflow/balsamic/pon.py +++ b/cg/cli/workflow/balsamic/pon.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.balsamic.base import config_case, run, start diff --git a/cg/cli/workflow/balsamic/qc.py b/cg/cli/workflow/balsamic/qc.py index 2ea997e454..e2690ce334 100644 --- a/cg/cli/workflow/balsamic/qc.py +++ b/cg/cli/workflow/balsamic/qc.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.balsamic.base import ( diff --git a/cg/cli/workflow/balsamic/umi.py b/cg/cli/workflow/balsamic/umi.py index b5b4914fa2..34df4328b1 100644 --- a/cg/cli/workflow/balsamic/umi.py +++ b/cg/cli/workflow/balsamic/umi.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.balsamic.base import ( diff --git a/cg/cli/workflow/base.py b/cg/cli/workflow/base.py index 98b2451e8b..e159534808 100644 --- a/cg/cli/workflow/base.py +++ b/cg/cli/workflow/base.py @@ -1,6 +1,6 @@ """Common CLI workflow functions""" -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.balsamic.base import balsamic diff --git a/cg/cli/workflow/commands.py b/cg/cli/workflow/commands.py index 8172181585..3d30b7e221 100644 --- a/cg/cli/workflow/commands.py +++ b/cg/cli/workflow/commands.py @@ -3,7 +3,7 @@ import shutil from pathlib import Path -import click +import rich_click as click from dateutil.parser import parse as parse_date from cg.apps.housekeeper.hk import HousekeeperAPI diff --git a/cg/cli/workflow/fluffy/base.py b/cg/cli/workflow/fluffy/base.py index 1302f711d2..6da80b5639 100644 --- a/cg/cli/workflow/fluffy/base.py +++ b/cg/cli/workflow/fluffy/base.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import link, resolve_compression, store, store_available diff --git a/cg/cli/workflow/jasen/base.py b/cg/cli/workflow/jasen/base.py index c4aafee671..c8a9fb747c 100644 --- a/cg/cli/workflow/jasen/base.py +++ b/cg/cli/workflow/jasen/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.constants.constants import MetaApis diff --git a/cg/cli/workflow/microsalt/base.py b/cg/cli/workflow/microsalt/base.py index a34e76fa8d..474feb8e57 100644 --- a/cg/cli/workflow/microsalt/base.py +++ b/cg/cli/workflow/microsalt/base.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Any -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import resolve_compression, store, store_available diff --git a/cg/cli/workflow/mip/base.py b/cg/cli/workflow/mip/base.py index 924310283d..ac6ac3e2c5 100644 --- a/cg/cli/workflow/mip/base.py +++ b/cg/cli/workflow/mip/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.apps.environ import environ_email from cg.cli.utils import echo_lines diff --git a/cg/cli/workflow/mip/options.py b/cg/cli/workflow/mip/options.py index 5a99124c28..7ad022fd81 100644 --- a/cg/cli/workflow/mip/options.py +++ b/cg/cli/workflow/mip/options.py @@ -1,4 +1,4 @@ -import click +import rich_click as click from cg.constants.priority import SlurmQos diff --git a/cg/cli/workflow/mip_dna/base.py b/cg/cli/workflow/mip_dna/base.py index de629558e6..eb503cc77e 100644 --- a/cg/cli/workflow/mip_dna/base.py +++ b/cg/cli/workflow/mip_dna/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import ( diff --git a/cg/cli/workflow/mip_rna/base.py b/cg/cli/workflow/mip_rna/base.py index 62c1d9d97e..a345c83e7e 100644 --- a/cg/cli/workflow/mip_rna/base.py +++ b/cg/cli/workflow/mip_rna/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import link, resolve_compression, store, store_available diff --git a/cg/cli/workflow/mutant/base.py b/cg/cli/workflow/mutant/base.py index 740eb16e2e..e2f7f9310f 100644 --- a/cg/cli/workflow/mutant/base.py +++ b/cg/cli/workflow/mutant/base.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import ( diff --git a/cg/cli/workflow/nf_analysis.py b/cg/cli/workflow/nf_analysis.py index 7011df85b2..f645975923 100644 --- a/cg/cli/workflow/nf_analysis.py +++ b/cg/cli/workflow/nf_analysis.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from pydantic import ValidationError from cg.cli.workflow.commands import ARGUMENT_CASE_ID diff --git a/cg/cli/workflow/raredisease/base.py b/cg/cli/workflow/raredisease/base.py index 7910a8a3e0..172f225557 100644 --- a/cg/cli/workflow/raredisease/base.py +++ b/cg/cli/workflow/raredisease/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS, echo_lines from cg.cli.workflow.commands import ARGUMENT_CASE_ID, resolve_compression diff --git a/cg/cli/workflow/raw_data/base.py b/cg/cli/workflow/raw_data/base.py index a771b09014..490db36db7 100644 --- a/cg/cli/workflow/raw_data/base.py +++ b/cg/cli/workflow/raw_data/base.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import ARGUMENT_CASE_ID diff --git a/cg/cli/workflow/rnafusion/base.py b/cg/cli/workflow/rnafusion/base.py index 27901d336e..18f9977feb 100644 --- a/cg/cli/workflow/rnafusion/base.py +++ b/cg/cli/workflow/rnafusion/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import resolve_compression diff --git a/cg/cli/workflow/taxprofiler/base.py b/cg/cli/workflow/taxprofiler/base.py index 14a6782d67..6c22a8b8bb 100644 --- a/cg/cli/workflow/taxprofiler/base.py +++ b/cg/cli/workflow/taxprofiler/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import resolve_compression diff --git a/cg/cli/workflow/tomte/base.py b/cg/cli/workflow/tomte/base.py index 4fc3a0c85c..0a0ab8a4e2 100644 --- a/cg/cli/workflow/tomte/base.py +++ b/cg/cli/workflow/tomte/base.py @@ -2,7 +2,7 @@ import logging -import click +import rich_click as click from cg.cli.utils import CLICK_CONTEXT_SETTINGS from cg.cli.workflow.commands import resolve_compression diff --git a/cg/cli/workflow/utils.py b/cg/cli/workflow/utils.py index 832266712e..bbcc0f6298 100644 --- a/cg/cli/workflow/utils.py +++ b/cg/cli/workflow/utils.py @@ -1,6 +1,6 @@ """CLI utility methods.""" -import click +import rich_click as click def validate_force_store_option(force: bool, comment: str | None): diff --git a/cg/constants/cli_options.py b/cg/constants/cli_options.py index d6976797fe..d03116a35a 100644 --- a/cg/constants/cli_options.py +++ b/cg/constants/cli_options.py @@ -1,4 +1,4 @@ -import click +import rich_click as click DRY_RUN = click.option( "--dry-run", diff --git a/cg/meta/archive/archive.py b/cg/meta/archive/archive.py index b744d5e0d6..553ab98bda 100644 --- a/cg/meta/archive/archive.py +++ b/cg/meta/archive/archive.py @@ -1,7 +1,7 @@ import logging from typing import Callable, Type -import click +import rich_click as click from housekeeper.store.models import Archive, File from pydantic import BaseModel, ConfigDict diff --git a/cg/meta/upload/balsamic/balsamic.py b/cg/meta/upload/balsamic/balsamic.py index c9ce637fba..f297a367bc 100644 --- a/cg/meta/upload/balsamic/balsamic.py +++ b/cg/meta/upload/balsamic/balsamic.py @@ -3,7 +3,7 @@ import datetime as dt import logging -import click +import rich_click as click from cg.apps.gens import GensAPI from cg.cli.generate.delivery_report.base import generate_delivery_report diff --git a/cg/meta/upload/microsalt/microsalt_upload_api.py b/cg/meta/upload/microsalt/microsalt_upload_api.py index f2d35a1f24..9bc966d9ad 100644 --- a/cg/meta/upload/microsalt/microsalt_upload_api.py +++ b/cg/meta/upload/microsalt/microsalt_upload_api.py @@ -1,6 +1,6 @@ import logging -import click +import rich_click as click from cg.meta.upload.upload_api import UploadAPI diff --git a/cg/meta/upload/mip/mip_dna.py b/cg/meta/upload/mip/mip_dna.py index 9b045b6448..423d9cf30f 100644 --- a/cg/meta/upload/mip/mip_dna.py +++ b/cg/meta/upload/mip/mip_dna.py @@ -3,7 +3,7 @@ import datetime as dt import logging -import click +import rich_click as click from cg.cli.generate.delivery_report.base import generate_delivery_report from cg.cli.upload.coverage import upload_coverage diff --git a/cg/meta/upload/mip/mip_rna.py b/cg/meta/upload/mip/mip_rna.py index 8223242a5f..ddfacff544 100644 --- a/cg/meta/upload/mip/mip_rna.py +++ b/cg/meta/upload/mip/mip_rna.py @@ -3,7 +3,7 @@ import logging from subprocess import CalledProcessError -import click +import rich_click as click from cg.cli.upload.scout import upload_rna_to_scout diff --git a/cg/meta/upload/nf_analysis.py b/cg/meta/upload/nf_analysis.py index 11da3a7ee8..a9e90fef56 100644 --- a/cg/meta/upload/nf_analysis.py +++ b/cg/meta/upload/nf_analysis.py @@ -3,7 +3,7 @@ import datetime as dt import logging -import click +import rich_click as click from cg.cli.generate.delivery_report.base import generate_delivery_report from cg.cli.upload.scout import upload_to_scout diff --git a/cg/meta/upload/raredisease/raredisease.py b/cg/meta/upload/raredisease/raredisease.py index 3646daed11..17bea8738b 100644 --- a/cg/meta/upload/raredisease/raredisease.py +++ b/cg/meta/upload/raredisease/raredisease.py @@ -3,7 +3,7 @@ import datetime as dt import logging -import click +import rich_click as click from cg.cli.generate.delivery_report.base import generate_delivery_report from cg.cli.upload.genotype import upload_genotypes diff --git a/cg/meta/upload/tomte/tomte.py b/cg/meta/upload/tomte/tomte.py index 57cad6fbc4..f676c93dc5 100644 --- a/cg/meta/upload/tomte/tomte.py +++ b/cg/meta/upload/tomte/tomte.py @@ -3,7 +3,7 @@ import logging from subprocess import CalledProcessError -import click +import rich_click as click from cg.cli.generate.delivery_report.base import generate_delivery_report from cg.cli.upload.scout import upload_tomte_to_scout diff --git a/cg/meta/upload/upload_api.py b/cg/meta/upload/upload_api.py index 4593395ad1..d455079f92 100644 --- a/cg/meta/upload/upload_api.py +++ b/cg/meta/upload/upload_api.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta from pathlib import Path -import click +import rich_click as click from cg.exc import AnalysisAlreadyUploadedError, AnalysisUploadError from cg.meta.meta import MetaAPI diff --git a/cg/meta/workflow/analysis.py b/cg/meta/workflow/analysis.py index e64d68db0d..b650383b7e 100644 --- a/cg/meta/workflow/analysis.py +++ b/cg/meta/workflow/analysis.py @@ -6,7 +6,7 @@ from subprocess import CalledProcessError from typing import Iterator -import click +import rich_click as click from housekeeper.store.models import Bundle, Version from cg.apps.environ import environ_email diff --git a/cg/meta/workflow/microsalt/microsalt.py b/cg/meta/workflow/microsalt/microsalt.py index 59f191d485..c3cd228bed 100644 --- a/cg/meta/workflow/microsalt/microsalt.py +++ b/cg/meta/workflow/microsalt/microsalt.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Any -import click +import rich_click as click from cg.constants import EXIT_FAIL, EXIT_SUCCESS, Priority, Workflow from cg.constants.constants import FileExtensions diff --git a/cg/utils/click/EnumChoice.py b/cg/utils/click/EnumChoice.py index 0f77dd639f..5a3a64dd0c 100644 --- a/cg/utils/click/EnumChoice.py +++ b/cg/utils/click/EnumChoice.py @@ -4,7 +4,7 @@ from enum import EnumMeta -import click +import rich_click as click class EnumChoice(click.Choice): diff --git a/poetry.lock b/poetry.lock index 7903d670bf..7df6adc182 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "alembic" @@ -1990,6 +1990,26 @@ pygments = ">=2.13.0,<3.0.0" [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] +[[package]] +name = "rich-click" +version = "1.8.4" +description = "Format click help output nicely with rich" +optional = false +python-versions = ">=3.7" +files = [ + {file = "rich_click-1.8.4-py3-none-any.whl", hash = "sha256:2d2841b3cebe610d5682baa1194beaf78ab00c4fa31931533261b5eba2ee80b7"}, + {file = "rich_click-1.8.4.tar.gz", hash = "sha256:0f49471f04439269d0e66a6f43120f52d11d594869a2a0be600cfb12eb0616b9"}, +] + +[package.dependencies] +click = ">=7" +rich = ">=10.7" +typing-extensions = ">=4" + +[package.extras] +dev = ["mypy", "packaging", "pre-commit", "pytest", "pytest-cov", "rich-codex", "ruff", "types-setuptools"] +docs = ["markdown-include", "mkdocs", "mkdocs-glightbox", "mkdocs-material-extensions", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-rss-plugin", "mkdocstrings[python]", "rich-codex"] + [[package]] name = "rsa" version = "4.9" @@ -2288,4 +2308,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "7849ceb358ed7655482144407fa2b0fc2a11091906b696c957b283480415e9a1" +content-hash = "3b7bcec9c2a1a49b6a5a0f7cc3018d1f63bccff0d8fdf6cac6f139876933dc1b" diff --git a/pyproject.toml b/pyproject.toml index b35e610173..a6e4424240 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ genologics = "*" housekeeper = ">=4.11.3" pydantic-settings = "^2.3.3" email-validator = "^2.2.0" +rich-click = "^1.8.4" [tool.poetry.dev-dependencies] diff --git a/tests/cli/demultiplex/test_validate_sample_sheet.py b/tests/cli/demultiplex/test_validate_sample_sheet.py index 7ccb32daa2..c2874d965e 100644 --- a/tests/cli/demultiplex/test_validate_sample_sheet.py +++ b/tests/cli/demultiplex/test_validate_sample_sheet.py @@ -19,7 +19,7 @@ def test_validate_non_existing_sample_sheet( sample_sheet: Path = Path("a_sample_sheet_that_does_not_exist.csv") assert sample_sheet.exists() is False - # WHEN validating the sample sheet + # WHEN validating the sample sheetresult = {Result} result = cli_runner.invoke( validate_sample_sheet, [str(sample_sheet)], @@ -28,8 +28,6 @@ def test_validate_non_existing_sample_sheet( # THEN assert that it exits with a non-zero exit code assert result.exit_code != EXIT_SUCCESS - # THEN assert the correct information was communicated - assert f"File '{sample_sheet.name}' does not exist" in result.output def test_validate_sample_sheet_wrong_file_type( diff --git a/tests/fixture_plugins/delivery_report_fixtures/context_fixtures.py b/tests/fixture_plugins/delivery_report_fixtures/context_fixtures.py index 2831f3fddf..dd6d5b06bd 100644 --- a/tests/fixture_plugins/delivery_report_fixtures/context_fixtures.py +++ b/tests/fixture_plugins/delivery_report_fixtures/context_fixtures.py @@ -3,7 +3,7 @@ from datetime import datetime from pathlib import Path -import click +import rich_click as click import pytest from pytest_mock import MockFixture