From d5afa8e2fd53c7db5c1cf730c81109ca8b25c574 Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Thu, 24 Aug 2023 10:45:58 -0400 Subject: [PATCH] Progress --- poetry.lock | 158 +++++++++++++++++- pyproject.toml | 1 + snakebids/project_template/cookiecutter.json | 12 -- snakebids/project_template/copier.yaml | 45 +++++ .../hooks/post_gen_project.py | 37 ---- .../{{ name_slug }}/README.md.jinja | 3 + .../setup.py.jinja} | 4 +- .../.gitignore | 0 .../Makefile | 0 .../conf.py.jinja} | 6 +- .../getting_started/installation.md.jinja} | 24 +-- .../index.md | 0 .../requirements.txt.jinja | 4 + .../usage/app_cli.md.jinja | 7 + .../usage/snakemake_cli.md | 2 +- .../{{name_slug}}}/config/snakebids.yml | 2 +- .../pipeline_description.json.jinja | 22 +++ .../{{name_slug}}/run.py.jinja} | 2 +- .../{{name_slug}}}/workflow/Snakefile | 0 .../{{cookiecutter.__app_name}}/README.md | 3 - .../docs/requirements.txt | 4 - .../docs/usage/app_cli.md | 7 - .../pipeline_description.json | 19 --- 23 files changed, 259 insertions(+), 103 deletions(-) delete mode 100644 snakebids/project_template/cookiecutter.json create mode 100644 snakebids/project_template/copier.yaml delete mode 100644 snakebids/project_template/hooks/post_gen_project.py create mode 100644 snakebids/project_template/{{ name_slug }}/README.md.jinja rename snakebids/project_template/{{{cookiecutter.__app_name}}/setup.py => {{ name_slug }}/setup.py.jinja} (88%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}}/.gitignore (100%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}}/Makefile (100%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs/conf.py => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}/conf.py.jinja} (92%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs/getting_started/installation.md => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}/getting_started/installation.md.jinja} (71%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}}/index.md (100%) create mode 100644 snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/requirements.txt.jinja create mode 100644 snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/app_cli.md.jinja rename snakebids/project_template/{{{cookiecutter.__app_name}}/docs => {{ name_slug }}/{% if create_doc_template %}docs{% endif %}}/usage/snakemake_cli.md (96%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}} => {{ name_slug }}/{{name_slug}}}/config/snakebids.yml (99%) create mode 100644 snakebids/project_template/{{ name_slug }}/{{name_slug}}/pipeline_description.json.jinja rename snakebids/project_template/{{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/run.py => {{ name_slug }}/{{name_slug}}/run.py.jinja} (88%) rename snakebids/project_template/{{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}} => {{ name_slug }}/{{name_slug}}}/workflow/Snakefile (100%) delete mode 100644 snakebids/project_template/{{cookiecutter.__app_name}}/README.md delete mode 100644 snakebids/project_template/{{cookiecutter.__app_name}}/docs/requirements.txt delete mode 100644 snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/app_cli.md delete mode 100644 snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/pipeline_description.json diff --git a/poetry.lock b/poetry.lock index 99025d62..63b0a374 100644 --- a/poetry.lock +++ b/poetry.lock @@ -357,6 +357,33 @@ pyyaml = ">=5.3.1" requests = ">=2.23.0" rich = "*" +[[package]] +name = "copier" +version = "8.1.0" +description = "A library for rendering project templates." +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "copier-8.1.0-py3-none-any.whl", hash = "sha256:56537163b1b24441a63504ebf56b8db588dee20b48ef4fc374a6c5a2b43010c1"}, + {file = "copier-8.1.0.tar.gz", hash = "sha256:902b4eb65fafe7a1621991234d2ebf3bc3fc9323e64e3a2560a00c05c73f6229"}, +] + +[package.dependencies] +colorama = ">=0.4.3" +decorator = ">=5.1.1" +dunamai = ">=1.7.0" +funcy = ">=1.17" +jinja2 = ">=3.1.1" +jinja2-ansible-filters = ">=1.3.1" +packaging = ">=23.0" +pathspec = ">=0.9.0" +plumbum = ">=1.6.9" +pydantic = ">=1.10.2,<2" +pygments = ">=2.7.1" +pyyaml = ">=5.3.1" +pyyaml-include = ">=1.2" +questionary = ">=1.8.1" + [[package]] name = "datrie" version = "0.8.2" @@ -391,6 +418,17 @@ files = [ {file = "datrie-0.8.2.tar.gz", hash = "sha256:525b08f638d5cf6115df6ccd818e5a01298cd230b2dac91c8ff2e6499d18765d"}, ] +[[package]] +name = "decorator" +version = "5.1.1" +description = "Decorators for Humans" +optional = false +python-versions = ">=3.5" +files = [ + {file = "decorator-5.1.1-py3-none-any.whl", hash = "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186"}, + {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, +] + [[package]] name = "distlib" version = "0.3.7" @@ -434,6 +472,20 @@ files = [ {file = "dpath-2.1.6.tar.gz", hash = "sha256:f1e07c72e8605c6a9e80b64bc8f42714de08a789c7de417e49c3f87a19692e47"}, ] +[[package]] +name = "dunamai" +version = "1.18.0" +description = "Dynamic version generation" +optional = false +python-versions = ">=3.5,<4.0" +files = [ + {file = "dunamai-1.18.0-py3-none-any.whl", hash = "sha256:f9284a9f4048f0b809d11539896e78bde94c05b091b966a04a44ab4c48df03ce"}, + {file = "dunamai-1.18.0.tar.gz", hash = "sha256:5200598561ea5ba956a6174c36e402e92206c6a6aa4a93a6c5cb8003ee1e0997"}, +] + +[package.dependencies] +packaging = ">=20.9" + [[package]] name = "exceptiongroup" version = "1.1.2" @@ -502,6 +554,17 @@ wrapt = ">=1.0" arrow = ["pyarrow (>=1)"] calculus = ["sympy (>=1.3,<1.10)"] +[[package]] +name = "funcy" +version = "2.0" +description = "A fancy and practical functional tools" +optional = false +python-versions = "*" +files = [ + {file = "funcy-2.0-py2.py3-none-any.whl", hash = "sha256:53df23c8bb1651b12f095df764bfb057935d49537a56de211b098f4c79614bb0"}, + {file = "funcy-2.0.tar.gz", hash = "sha256:3963315d59d41c6f30c04bc910e10ab50a3ac4a225868bfa96feed133df075cb"}, +] + [[package]] name = "gitdb" version = "4.0.10" @@ -926,6 +989,24 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] +[[package]] +name = "jinja2-ansible-filters" +version = "1.3.2" +description = "A port of Ansible's jinja2 filters without requiring ansible core." +optional = false +python-versions = "*" +files = [ + {file = "jinja2-ansible-filters-1.3.2.tar.gz", hash = "sha256:07c10cf44d7073f4f01102ca12d9a2dc31b41d47e4c61ed92ef6a6d2669b356b"}, + {file = "jinja2_ansible_filters-1.3.2-py3-none-any.whl", hash = "sha256:e1082f5564917649c76fed239117820610516ec10f87735d0338688800a55b34"}, +] + +[package.dependencies] +Jinja2 = "*" +PyYAML = "*" + +[package.extras] +test = ["pytest", "pytest-cov"] + [[package]] name = "jsonschema" version = "4.19.0" @@ -1476,6 +1557,25 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "plumbum" +version = "1.8.2" +description = "Plumbum: shell combinators library" +optional = false +python-versions = ">=3.6" +files = [ + {file = "plumbum-1.8.2-py3-none-any.whl", hash = "sha256:3ad9e5f56c6ec98f6f7988f7ea8b52159662ea9e915868d369dbccbfca0e367e"}, + {file = "plumbum-1.8.2.tar.gz", hash = "sha256:9e6dc032f4af952665f32f3206567bc23b7858b1413611afe603a3f8ad9bfd75"}, +] + +[package.dependencies] +pywin32 = {version = "*", markers = "platform_system == \"Windows\" and platform_python_implementation != \"PyPy\""} + +[package.extras] +dev = ["paramiko", "psutil", "pytest (>=6.0)", "pytest-cov", "pytest-mock", "pytest-timeout"] +docs = ["sphinx (>=4.0.0)", "sphinx-rtd-theme (>=1.0.0)"] +ssh = ["paramiko"] + [[package]] name = "poethepoet" version = "0.21.1" @@ -1512,6 +1612,20 @@ nodeenv = ">=0.11.1" pyyaml = ">=5.1" virtualenv = ">=20.10.0" +[[package]] +name = "prompt-toolkit" +version = "3.0.36" +description = "Library for building powerful interactive command lines in Python" +optional = false +python-versions = ">=3.6.2" +files = [ + {file = "prompt_toolkit-3.0.36-py3-none-any.whl", hash = "sha256:aa64ad242a462c5ff0363a7b9cfe696c20d55d9fc60c11fd8e632d064804d305"}, + {file = "prompt_toolkit-3.0.36.tar.gz", hash = "sha256:3e163f254bef5a03b146397d7c1963bd3e2812f0964bb9a24e6ec761fd28db63"}, +] + +[package.dependencies] +wcwidth = "*" + [[package]] name = "psutil" version = "5.9.5" @@ -1912,6 +2026,37 @@ files = [ {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, ] +[[package]] +name = "pyyaml-include" +version = "1.3.1" +description = "Extending PyYAML with a custom constructor for including YAML files within YAML files" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pyyaml-include-1.3.1.tar.gz", hash = "sha256:4cb3b4e1baae2ec251808fe1e8aed5d3d20699c541864c8e47ed866ab2f15039"}, + {file = "pyyaml_include-1.3.1-py3-none-any.whl", hash = "sha256:e58525721a2938d29c4046350f8aad86f848660a770c29605e6f2700925fa753"}, +] + +[package.dependencies] +PyYAML = ">=5.1,<7.0" + +[package.extras] +toml = ["toml"] + +[[package]] +name = "questionary" +version = "2.0.0" +description = "Python library to build pretty command line user prompts ⭐️" +optional = false +python-versions = ">=3.8" +files = [ + {file = "questionary-2.0.0-py3-none-any.whl", hash = "sha256:564ae8917f141c9ef0ed131bb2671397fcaba7a901988b39cdbb569b8f29ce94"}, + {file = "questionary-2.0.0.tar.gz", hash = "sha256:8681b9d9ec751347ab11af2204d063b856d06845b07b442951e081780e8cb8a6"}, +] + +[package.dependencies] +prompt_toolkit = ">=2.0,<=3.0.36" + [[package]] name = "referencing" version = "0.30.2" @@ -2668,6 +2813,17 @@ platformdirs = ">=3.9.1,<4" docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] +[[package]] +name = "wcwidth" +version = "0.2.6" +description = "Measures the displayed width of unicode strings in a terminal" +optional = false +python-versions = "*" +files = [ + {file = "wcwidth-0.2.6-py2.py3-none-any.whl", hash = "sha256:795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e"}, + {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, +] + [[package]] name = "wrapt" version = "1.15.0" @@ -2786,4 +2942,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "5feae65a50e47a922db7ebe506d573134b8104ba2157f9311064b5b5e226253e" +content-hash = "1bd9e4a4c2c4abaa46d0e71932e5df31f905226f10a0f25f4cf9067416af730d" diff --git a/pyproject.toml b/pyproject.toml index a80354e6..0ac00f85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,7 @@ scipy = [ { version = ">=1.10.0,<=1.10.1", python = "<3.9" }, { version = ">=1.10.0", python = ">=3.9" } ] +copier = "^8.1.0" [tool.poetry.group.dev.dependencies] diff --git a/snakebids/project_template/cookiecutter.json b/snakebids/project_template/cookiecutter.json deleted file mode 100644 index f6bcb48d..00000000 --- a/snakebids/project_template/cookiecutter.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "full_name": "", - "email": "", - "github": "", - "app_full_name": "Snakebids App", - "app_description": "", - "create_doc_template": ["False", "True"], - "_app_version": "0.1.0", - "_bids_version": "1.8.0", - "_snakebids_version": "0.0.0", - "__app_name": "{{ cookiecutter.app_full_name|lower|replace(' ', '_')|replace('-', '_') }}" -} diff --git a/snakebids/project_template/copier.yaml b/snakebids/project_template/copier.yaml new file mode 100644 index 00000000..9d314da2 --- /dev/null +++ b/snakebids/project_template/copier.yaml @@ -0,0 +1,45 @@ +full_name: + type: str + help: What is your name? + placeholder: " optional" + +email: + type: str + help: What is your email? + +github: + type: str + help: What is your github username? + +app_full_name: + type: str + help: What is the name of your app? + default: "{{ dst_path }}" + validator: '{% if not app_full_name %}Required{% endif %}' + +app_description: + type: str + help: Provide a brief description of your app + +app_version: + default: "0.1.0" + help: Starting version number for your app + +create_doc_template: + type: bool + help: Would you to set up basic documentation? + +bids_version: + default: "1.8.0" + when: false + +snakebids_version: + default: "0.0.0" + when: false + +name_slug: + default: "{{ app_full_name|lower|replace(' ', '_')|replace('-', '_') }}" + when: false + +_jinja_extensions: + - jinja2_time.TimeExtension diff --git a/snakebids/project_template/hooks/post_gen_project.py b/snakebids/project_template/hooks/post_gen_project.py deleted file mode 100644 index 155c3896..00000000 --- a/snakebids/project_template/hooks/post_gen_project.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import annotations - -from importlib import metadata -from shutil import rmtree - - -def update_files(files: list[str] | str, replacement_str: str, cc_variable: str): - """Helper function to update cookiecutter content for certain files - - INPUT - ------ - files - file(s) to be updated - replacement_str - text to substitute into file(s) - cc_var - cookiecutter variable to replace (e.g. - {{ cookiecutter._snakebids_version }}) - """ - for fpath in files: - with open(fpath) as fcontent: - content = fcontent.read() - - content = content.replace(cc_variable, replacement_str) - - with open(fpath, "w", encoding="utf-8") as fcontent: - fcontent.write(content) - - -# Replace snakebids version in cookiecutter -sb_file_lists = ["setup.py", "docs/requirements.txt"] -sb_version = metadata.version("snakebids") -update_files(sb_file_lists, sb_version, "{{ cookiecutter._snakebids_version }}") - -# Remove documentation template -if not {{cookiecutter.create_doc_template}}: # noqa: F821 - rmtree("docs") diff --git a/snakebids/project_template/{{ name_slug }}/README.md.jinja b/snakebids/project_template/{{ name_slug }}/README.md.jinja new file mode 100644 index 00000000..c4327223 --- /dev/null +++ b/snakebids/project_template/{{ name_slug }}/README.md.jinja @@ -0,0 +1,3 @@ +# {{app_full_name}} + +{{ app_description }} diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/setup.py b/snakebids/project_template/{{ name_slug }}/setup.py.jinja similarity index 88% rename from snakebids/project_template/{{cookiecutter.__app_name}}/setup.py rename to snakebids/project_template/{{ name_slug }}/setup.py.jinja index d4a2e1ef..13ef84b7 100644 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/setup.py +++ b/snakebids/project_template/{{ name_slug }}/setup.py.jinja @@ -34,11 +34,11 @@ ], entry_points={ "console_scripts": [ - "{{cookiecutter.__app_name}}={{cookiecutter.__app_name}}.run:main" + "{{name_slug}}={{name_slug}}.run:main" ] }, install_requires=[ - "snakebids>={{cookiecutter._snakebids_version}}", + "snakebids>={{snakebids_version}}", "snakemake", ], python_requires=">=3.7", diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/.gitignore b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/.gitignore similarity index 100% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/.gitignore rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/.gitignore diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/Makefile b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/Makefile similarity index 100% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/Makefile rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/Makefile diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/conf.py b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/conf.py.jinja similarity index 92% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/conf.py rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/conf.py.jinja index 869f0a12..ad690830 100644 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/conf.py +++ b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/conf.py.jinja @@ -17,9 +17,9 @@ # -- Project information ----------------------------------------------------- -project = "{{cookiecutter.__app_name}}" -copyright = "{% now 'utc', '%Y' %}, {{cookiecutter.full_name}}" -author = "{{cookiecutter.full_name}}" +project = "{{name_slug}}" +copyright = "{% now 'utc', '%Y' %}, {{full_name}}" +author = "{{full_name}}" # -- General configuration --------------------------------------------------- diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/getting_started/installation.md b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/getting_started/installation.md.jinja similarity index 71% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/getting_started/installation.md rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/getting_started/installation.md.jinja index 56b38bfd..710cc7fe 100644 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/getting_started/installation.md +++ b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/getting_started/installation.md.jinja @@ -3,7 +3,7 @@ Install from github with pip: ```bash -pip install -e git+https://github.com/{{cookiecutter.github}}/{{cookiecutter.__app_name}}#egg={{cookiecutter.__app_name}} +pip install -e git+https://github.com/{{github}}/{{name_slug}}#egg={{name_slug}} ``` Note: you can re-run this command to re-install with the latest version @@ -13,13 +13,13 @@ Note: you can re-run this command to re-install with the latest version Do a dry-run first (`-n`) and simply print (`-p`) what would be run: ```bash -{{cookiecutter.__app_name}} /path/to/bids/dir /path/to/output/dir participant -np +{{name_slug}} /path/to/bids/dir /path/to/output/dir participant -np ``` Run the app, using all cores:: ```bash -{{cookiecutter.__app_name}} /path/to/bids/dir /path/to/output/dir participant --cores all +{{name_slug}} /path/to/bids/dir /path/to/output/dir participant --cores all ``` If any workflow rules require containers, then run with the `--use-singularity` option. @@ -35,22 +35,22 @@ summarize outputs, by using the `report(...)` function on any snakemake output. To generate a report, run: ```bash -{{cookiecutter.__app_name}} /path/to/bids/dir /path/to/output/dir participant --report +{{name_slug}} /path/to/bids/dir /path/to/output/dir participant --report ``` ## Compute Canada Instructions ### Setting up a dev environment -Here are some instructions to get your python environment set-up on graham to run {{ cookiecutter.__app_name }}: +Here are some instructions to get your python environment set-up on graham to run {{name_slug}}: # Create a virtualenv and activate it: ```bash cd $SCRATCH module load python/3 -virtualenv venv_{{ cookiecutter.__app_name }} -source venv_{{ cookiecutter.__app_name }}/bin/activate +virtualenv venv_{{name_slug}} +source venv_{{name_slug}}/bin/activate ``` # Follow the steps above to install from github repository @@ -69,23 +69,23 @@ These are used in the instructions below. In an interactive job (for testing): ```bash -regularInteractive -n 8 {{ cookiecutter.__app_name }} bids_dir out_dir participant --participant_label 001 -j 8 +regularInteractive -n 8 {{name_slug}} bids_dir out_dir participant --participant_label 001 -j 8 ``` Submitting a job (for larger cores, more subjects), still single job, but snakemake will parallelize over the 32 cores: ```bash -regularSubmit -j Fat {{ cookiecutter.__app_name }} bids_dir out_dir participant -j 32 +regularSubmit -j Fat {{name_slug}} bids_dir out_dir participant -j 32 ``` Scaling up to ~hundred subjects (needs cc-slurm snakemake profile installed), submits 1 16core job per subject: ```bash -{{ cookiecutter.__app_name }} bids_dir out_dir participant --profile cc-slurm +{{name_slug}} bids_dir out_dir participant --profile cc-slurm ``` Scaling up to even more subjects (uses group-components to bundle multiple subjects in each job), 1 32core job for N subjects (e.g. 10): ```bash -{{ cookiecutter.__app_name }} bids_dir out_dir participant --profile cc-slurm --group-components subj=10 -``` \ No newline at end of file +{{name_slug}} bids_dir out_dir participant --profile cc-slurm --group-components subj=10 +``` diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/index.md b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/index.md similarity index 100% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/index.md rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/index.md diff --git a/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/requirements.txt.jinja b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/requirements.txt.jinja new file mode 100644 index 00000000..4af5df61 --- /dev/null +++ b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/requirements.txt.jinja @@ -0,0 +1,4 @@ +docutils<0.18 +sphinx-argparse +sphinx_rtd_theme +snakebids=={{ snakebids_version }} diff --git a/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/app_cli.md.jinja b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/app_cli.md.jinja new file mode 100644 index 00000000..4d3625c1 --- /dev/null +++ b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/app_cli.md.jinja @@ -0,0 +1,7 @@ +## Command line interface + +```{argparse} +:filename: ../{{ name_slug }}/run.py +:func: get_parser +:prog: {{ name_slug }} +``` diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/snakemake_cli.md b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/snakemake_cli.md similarity index 96% rename from snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/snakemake_cli.md rename to snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/snakemake_cli.md index d9b0f6b1..2e834372 100644 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/snakemake_cli.md +++ b/snakebids/project_template/{{ name_slug }}/{% if create_doc_template %}docs{% endif %}/usage/snakemake_cli.md @@ -4,4 +4,4 @@ :module: snakemake :func: get_argument_parser :prog: snakemake -``` \ No newline at end of file +``` diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/config/snakebids.yml b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/config/snakebids.yml similarity index 99% rename from snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/config/snakebids.yml rename to snakebids/project_template/{{ name_slug }}/{{name_slug}}/config/snakebids.yml index dd35a12d..9b36f37f 100644 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/config/snakebids.yml +++ b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/config/snakebids.yml @@ -80,7 +80,7 @@ parse_args: # below are examples for plugin and custom parameters (e.g. config['smoothing_fwhm']) --skip_bids_validation: help: 'Skip validation of BIDS dataset. BIDS validation is performed by - default using the bids-validator plugin (if installed/enabled) or with the pybids + default using the bids-validator plugin (if installed/enabled) or with the pybids validator implementation (if bids-validator is not installed/enabled).' dest: "plugins.validator.skip" action: "store_true" diff --git a/snakebids/project_template/{{ name_slug }}/{{name_slug}}/pipeline_description.json.jinja b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/pipeline_description.json.jinja new file mode 100644 index 00000000..ec2c2953 --- /dev/null +++ b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/pipeline_description.json.jinja @@ -0,0 +1,22 @@ +{% + set generated = { + "Name": name_slug, + "Version": app_version, + } +-%} +{%- if github -%} + {%- set _ = generated.update({"CodeURL": "https://github.com/" + github + "/" + name_slug}) -%} +{%- endif -%} +{%- if full_name -%} + {%- set _ = generated.update({"Author": full_name}) -%} +{%- endif -%} +{%- if email -%} + {%- set _ = generated.update({"AuthorEmail": email}) -%} +{%- endif -%} +{{- { + "Name": "Dataset generated by " + name_slug, + "BIDSVersion": bids_version, + "DatasetType": "derivative", + "GeneratedBy": [generated], + } | to_json(indent=2) +}} diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/run.py b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/run.py.jinja similarity index 88% rename from snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/run.py rename to snakebids/project_template/{{ name_slug }}/{{name_slug}}/run.py.jinja index 80d4e2c8..f9426d23 100755 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/run.py +++ b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/run.py.jinja @@ -7,7 +7,7 @@ def get_parser(): """Exposes parser for sphinx doc generation, cwd is the docs dir""" - app = SnakeBidsApp("../{{ cookiecutter.__app_name }}") + app = SnakeBidsApp("../{{ name_slug }}") return app.parser diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/workflow/Snakefile b/snakebids/project_template/{{ name_slug }}/{{name_slug}}/workflow/Snakefile similarity index 100% rename from snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/workflow/Snakefile rename to snakebids/project_template/{{ name_slug }}/{{name_slug}}/workflow/Snakefile diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/README.md b/snakebids/project_template/{{cookiecutter.__app_name}}/README.md deleted file mode 100644 index 84b5ca31..00000000 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# {{ cookiecutter.__app_name }} - -{{ cookiecutter.app_description }} diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/requirements.txt b/snakebids/project_template/{{cookiecutter.__app_name}}/docs/requirements.txt deleted file mode 100644 index 21901c99..00000000 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -docutils<0.18 -sphinx-argparse -sphinx_rtd_theme -snakebids=={{ cookiecutter._snakebids_version }} diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/app_cli.md b/snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/app_cli.md deleted file mode 100644 index e5d49dfb..00000000 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/docs/usage/app_cli.md +++ /dev/null @@ -1,7 +0,0 @@ -## Command line interface - -```{argparse} -:filename: ../{{ cookiecutter.__app_name }}/run.py -:func: get_parser -:prog: {{ cookiecutter.__app_name }} -``` \ No newline at end of file diff --git a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/pipeline_description.json b/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/pipeline_description.json deleted file mode 100644 index e148f804..00000000 --- a/snakebids/project_template/{{cookiecutter.__app_name}}/{{cookiecutter.__app_name}}/pipeline_description.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "Name": "Dataset generated by {{ cookiecutter.__app_name }}", - "BIDSVersion": "{{ cookiecutter._bids_version }}", - "DatasetType": "derivative", - "GeneratedBy": [ - { - "Name": "{{ cookiecutter.__app_name }}", - "Version": "{{ cookiecutter._app_version }}"{%- if cookiecutter.github or cookiecutter.full_name or cookiecutter.email -%},{%- endif -%} - {% if cookiecutter.github %} - "CodeURL": "http://github.com/{{ cookiecutter.github }}/{{ cookiecutter.__app_name }}"{%- if cookiecutter.full_name or cookiecutter.email -%},{%- endif -%} - {%- endif -%} - {% if cookiecutter.full_name %} - "Author": "{{ cookiecutter.full_name }}"{%- if cookiecutter.email -%},{%- endif -%} - {%- endif -%} - {% if cookiecutter.email %} - "AuthorEmail": "{{ cookiecutter.email }}"{% endif %} - } - ] -}