diff --git a/carwatch/scripts/prepare_study.py b/carwatch/scripts/prepare_study.py index 1ec2acd..5063f93 100644 --- a/carwatch/scripts/prepare_study.py +++ b/carwatch/scripts/prepare_study.py @@ -6,6 +6,7 @@ from typing import Optional, Sequence, Union import click +from trogon import tui from carwatch.labels import LabelGenerator from carwatch.labels.print_layout import CustomLayout @@ -25,6 +26,7 @@ DEFAULT_QR_FILE_SUFFIX = "_qr_code" +@tui() @click.command() @click.option( "--study-name", required=True, prompt="Study name", type=str, help="A descriptive abbreviation for your study name." @@ -36,6 +38,7 @@ "--subject-data", required=True, prompt="Read subject IDs from file?", + help="Whether the subject IDs should be read from a file.", is_flag=True, ) @click.option( @@ -72,6 +75,7 @@ @click.option( "--has-subject-prefix", prompt="Add prefix to participant number (e.g., 'VP_')?", + help="Whether a prefix should be added to the participant number.", is_flag=True, cls=Condition, neg_condition="subject_path", @@ -107,6 +111,7 @@ required=True, default=0, prompt="Should biomarker IDs start at 0 or at 1 (i.e., S0 vs. S1)?", + help="Whether the biomarker IDs should start at 0 or at 1.", type=click.IntRange(0, 1), ) @click.option( @@ -114,6 +119,7 @@ required=True, default=CAR_STUDY, prompt="Type of study? (1 for CAR study, 2 for Lab-based study, 3 for Other)?", + help="The type of study. 1 for CAR study, 2 for Lab-based study, 3 for Other.", type=click.IntRange(1, len(STUDY_TYPES)), ) @click.option( diff --git a/poetry.lock b/poetry.lock index 02ab3e3..e530ee3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1521,6 +1521,54 @@ files = [ {file = "kiwisolver-1.4.4.tar.gz", hash = "sha256:d41997519fcba4a1e46eb4a2fe31bc12f0ff957b2b81bac28db24744f333e955"}, ] +[[package]] +name = "linkify-it-py" +version = "2.0.2" +description = "Links recognition library with FULL unicode support." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "linkify-it-py-2.0.2.tar.gz", hash = "sha256:19f3060727842c254c808e99d465c80c49d2c7306788140987a1a7a29b0d6ad2"}, + {file = "linkify_it_py-2.0.2-py3-none-any.whl", hash = "sha256:a3a24428f6c96f27370d7fe61d2ac0be09017be5190d68d8658233171f1b6541"}, +] + +[package.dependencies] +uc-micro-py = "*" + +[package.extras] +benchmark = ["pytest", "pytest-benchmark"] +dev = ["black", "flake8", "isort", "pre-commit", "pyproject-flake8"] +doc = ["myst-parser", "sphinx", "sphinx-book-theme"] +test = ["coverage", "pytest", "pytest-cov"] + +[[package]] +name = "markdown-it-py" +version = "2.2.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "markdown-it-py-2.2.0.tar.gz", hash = "sha256:7c9a5e412688bc771c67432cbfebcdd686c93ce6484913dccf06cb5a0bea35a1"}, + {file = "markdown_it_py-2.2.0-py3-none-any.whl", hash = "sha256:5a35f8d1870171d9acc47b99612dc146129b631baf04970128b568f190d0cc30"}, +] + +[package.dependencies] +linkify-it-py = {version = ">=1,<3", optional = true, markers = "extra == \"linkify\""} +mdit-py-plugins = {version = "*", optional = true, markers = "extra == \"plugins\""} +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "markupsafe" version = "2.1.2" @@ -1659,6 +1707,38 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "mdit-py-plugins" +version = "0.4.0" +description = "Collection of plugins for markdown-it-py" +category = "main" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mdit_py_plugins-0.4.0-py3-none-any.whl", hash = "sha256:b51b3bb70691f57f974e257e367107857a93b36f322a9e6d44ca5bf28ec2def9"}, + {file = "mdit_py_plugins-0.4.0.tar.gz", hash = "sha256:d8ab27e9aed6c38aa716819fedfde15ca275715955f8a185a8e1cf90fb1d2c1b"}, +] + +[package.dependencies] +markdown-it-py = ">=1.0.0,<4.0.0" + +[package.extras] +code-style = ["pre-commit"] +rtd = ["myst-parser", "sphinx-book-theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + [[package]] name = "mistune" version = "2.0.5" @@ -2724,6 +2804,26 @@ files = [ {file = "rfc3986_validator-0.1.1.tar.gz", hash = "sha256:3d44bde7921b3b9ec3ae4e3adca370438eccebc676456449b145d533b240d055"}, ] +[[package]] +name = "rich" +version = "13.4.1" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +category = "main" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "rich-13.4.1-py3-none-any.whl", hash = "sha256:d204aadb50b936bf6b1a695385429d192bc1fdaf3e8b907e8e26f4c4e4b5bf75"}, + {file = "rich-13.4.1.tar.gz", hash = "sha256:76f6b65ea7e5c5d924ba80e322231d7cb5b5981aa60bfc1e694f1bc097fe6fe1"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0,<3.0.0" +pygments = ">=2.13.0,<3.0.0" +typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + [[package]] name = "ruff" version = "0.0.261" @@ -2902,6 +3002,27 @@ tornado = ">=6.1.0" docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] test = ["pre-commit", "pytest (>=7.0)", "pytest-timeout"] +[[package]] +name = "textual" +version = "0.27.0" +description = "Modern Text User Interface framework" +category = "main" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "textual-0.27.0-py3-none-any.whl", hash = "sha256:dc45eaf7da330686c56d6f76f59d05fd216ce6aad90fa44ee269881efc622151"}, + {file = "textual-0.27.0.tar.gz", hash = "sha256:8bdcb09dc35a706ef939b1276ccfdec10eaaee6147b41cb7587cf33298a8dd33"}, +] + +[package.dependencies] +importlib-metadata = ">=4.11.3" +markdown-it-py = {version = ">=2.1.0,<3.0.0", extras = ["linkify", "plugins"]} +rich = ">=13.3.3" +typing-extensions = ">=4.4.0,<5.0.0" + +[package.extras] +dev = ["aiohttp (>=3.8.1)", "click (>=8.1.2)", "msgpack (>=1.0.3)"] + [[package]] name = "tinycss2" version = "1.2.1" @@ -2970,6 +3091,22 @@ files = [ docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] +[[package]] +name = "trogon" +version = "0.4.0" +description = "Automatically generate a Textual TUI for your Click CLI" +category = "main" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "trogon-0.4.0-py3-none-any.whl", hash = "sha256:65fadb5bc25dbd3a2e2f49235fb16735f7b822e24d88b5c68980bb38e1124f99"}, + {file = "trogon-0.4.0.tar.gz", hash = "sha256:b87736dfebf011e7b7c541e30105d2ecc0ed09fb0b874d4fa09a6416fa83db34"}, +] + +[package.dependencies] +click = ">=8.0.0" +textual = ">=0.26.0" + [[package]] name = "typing-extensions" version = "4.6.2" @@ -2982,6 +3119,21 @@ files = [ {file = "typing_extensions-4.6.2.tar.gz", hash = "sha256:06006244c70ac8ee83fa8282cb188f697b8db25bc8b4df07be1873c43897060c"}, ] +[[package]] +name = "uc-micro-py" +version = "1.0.2" +description = "Micro subset of unicode data files for linkify-it-py projects." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "uc-micro-py-1.0.2.tar.gz", hash = "sha256:30ae2ac9c49f39ac6dce743bd187fcd2b574b16ca095fa74cd9396795c954c54"}, + {file = "uc_micro_py-1.0.2-py3-none-any.whl", hash = "sha256:8c9110c309db9d9e87302e2f4ad2c3152770930d88ab385cd544e7a7e75f3de0"}, +] + +[package.extras] +test = ["coverage", "pytest", "pytest-cov"] + [[package]] name = "uri-template" version = "1.2.0" @@ -3202,4 +3354,4 @@ plotting = ["matplotlib", "seaborn", "ipywidgets", "ipympl", "fau_colors"] [metadata] lock-version = "2.0" python-versions = ">=3.8, <3.11" -content-hash = "9a98bf89486faa90065850592cb3cb3c6ef412baccb67c7090da130e9d9dc26f" +content-hash = "a5d0474b6fb9ec3a1305df13c3fd7084fa4a0fe44005cad5d3eb37e09abb8b1a" diff --git a/pyproject.toml b/pyproject.toml index 3db7a98..ef784eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ seaborn = { version = "^0.11.2", optional = true } ipywidgets = {version = "^8", optional = true} ipympl = {version = "^0.9", optional = true} fau_colors = {version = "^1.6.0", optional=true} +trogon = "^0.4.0" [tool.poetry.extras] plotting = ["matplotlib", "seaborn", "ipywidgets", "ipympl", "fau_colors"]