From 0a4bb99b2fd5706fa69d14bd29628d7ec857de75 Mon Sep 17 00:00:00 2001 From: Jason Kai Date: Fri, 9 Jun 2023 14:13:56 -0400 Subject: [PATCH] update cookiecutter template - change .rst files to .md - update cookiecutter variables - app_name changed to private rendered variable - constants like version numbers set to private unrendered variables - change setup.py to pyproject.toml - updated pipeline_description.json to be more human readible --- pyproject.toml | 3 + snakebids/project_template/cookiecutter.json | 15 +-- .../{{ cookiecutter.__app_name }}/README.md | 3 + .../config/snakebids.yml | 0 .../docs/.gitignore | 0 .../docs/Makefile | 0 .../docs/conf.py | 6 +- .../docs/getting_started/installation.md | 91 +++++++++++++++++++ .../docs/index.md | 27 ++++++ .../docs/requirements.txt | 4 + .../docs/usage/app_cli.md | 7 ++ .../docs/usage/snakemake_cli.md | 7 ++ .../pipeline_description.json | 19 ++++ .../pyproject.toml | 29 ++++++ .../workflow/Snakefile | 0 .../{{ cookiecutter.__app_name }}}/run.py | 0 .../{{cookiecutter.app_name}}/README.rst | 4 - .../docs/getting_started/installation.rst | 86 ------------------ .../{{cookiecutter.app_name}}/docs/index.rst | 32 ------- .../docs/requirements.txt | 4 - .../docs/usage/app_cli.rst | 9 -- .../docs/usage/snakemake_cli.rst | 9 -- .../pipeline_description.json | 11 --- .../{{cookiecutter.app_name}}/setup.py | 43 --------- snakebids/tests/test_template.py | 3 +- 25 files changed, 202 insertions(+), 210 deletions(-) create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/README.md rename snakebids/project_template/{{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}}/config/snakebids.yml (100%) rename snakebids/project_template/{{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}}/docs/.gitignore (100%) rename snakebids/project_template/{{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}}/docs/Makefile (100%) rename snakebids/project_template/{{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}}/docs/conf.py (93%) create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/docs/getting_started/installation.md create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/docs/index.md create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/docs/requirements.txt create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/app_cli.md create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/snakemake_cli.md create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/pipeline_description.json create mode 100644 snakebids/project_template/{{ cookiecutter.__app_name }}/pyproject.toml rename snakebids/project_template/{{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}}/workflow/Snakefile (100%) rename snakebids/project_template/{{{cookiecutter.app_name}}/{{cookiecutter.app_name}} => {{ cookiecutter.__app_name }}/{{ cookiecutter.__app_name }}}/run.py (100%) delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/README.rst delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/docs/getting_started/installation.rst delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/docs/index.rst 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.rst delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/snakemake_cli.rst delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/pipeline_description.json delete mode 100644 snakebids/project_template/{{cookiecutter.app_name}}/setup.py diff --git a/pyproject.toml b/pyproject.toml index 19e1f9b5..123a2771 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,3 +121,6 @@ reportImportCycles = false [tool.ruff] select = ["E", "F", "PL", "RUF"] +exclude = [ + "snakebids/project_template/" +] \ No newline at end of file diff --git a/snakebids/project_template/cookiecutter.json b/snakebids/project_template/cookiecutter.json index 5ce9ea76..8a47bb82 100644 --- a/snakebids/project_template/cookiecutter.json +++ b/snakebids/project_template/cookiecutter.json @@ -1,10 +1,11 @@ { - "full_name": "", + "full_name": "FirstName LastName", "email": "", - "github_username": "", - "app_full_name": "", - "_output_dir": "", - "app_name": "{{ cookiecutter.app_full_name.lower().replace(' ', '_').replace('-', '_') if cookiecutter.app_full_name else cookiecutter._output_dir }}", - "app_description": "", - "snakebids_version": "0.0.0" + "github": "", + "app_full_name": "Snakebids", + "__app_name": "{{ cookiecutter.app_full_name|lower|replace(' ', '_')|replace('-', '_') }}", + "app_description": "Short application description", + "_app_version": "0.1.0", + "_snakebids_version": "0.0.0", + "bids_version": "1.8.0" } diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/README.md b/snakebids/project_template/{{ cookiecutter.__app_name }}/README.md new file mode 100644 index 00000000..84b5ca31 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/README.md @@ -0,0 +1,3 @@ +# {{ cookiecutter.__app_name }} + +{{ cookiecutter.app_description }} diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/config/snakebids.yml b/snakebids/project_template/{{ cookiecutter.__app_name }}/config/snakebids.yml similarity index 100% rename from snakebids/project_template/{{cookiecutter.app_name}}/config/snakebids.yml rename to snakebids/project_template/{{ cookiecutter.__app_name }}/config/snakebids.yml diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/.gitignore b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/.gitignore similarity index 100% rename from snakebids/project_template/{{cookiecutter.app_name}}/docs/.gitignore rename to snakebids/project_template/{{ cookiecutter.__app_name }}/docs/.gitignore diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/Makefile b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/Makefile similarity index 100% rename from snakebids/project_template/{{cookiecutter.app_name}}/docs/Makefile rename to snakebids/project_template/{{ cookiecutter.__app_name }}/docs/Makefile diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/conf.py b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/conf.py similarity index 93% rename from snakebids/project_template/{{cookiecutter.app_name}}/docs/conf.py rename to snakebids/project_template/{{ cookiecutter.__app_name }}/docs/conf.py index 5f211af7..4621d035 100644 --- a/snakebids/project_template/{{cookiecutter.app_name}}/docs/conf.py +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/conf.py @@ -17,9 +17,9 @@ # -- Project information ----------------------------------------------------- -project = "{{cookiecutter.app_name}}" -copyright = "2021, {{cookiecutter.full_name}}" -author = "{{cookiecutter.full_name}}" +project = "{{ cookiecutter.__app_name }}" +copyright = "2021, {{ cookiecutter.full_name }}" +author = "{{ cookiecutter.full_name }}" # -- General configuration --------------------------------------------------- diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/getting_started/installation.md b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/getting_started/installation.md new file mode 100644 index 00000000..dcae41dc --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/getting_started/installation.md @@ -0,0 +1,91 @@ +## Installation + +Install from github with pip: + +```bash +pip install -e git+https://github.com/{{cookiecutter.github}}/{{cookiecutter.__app_name}}#egg={{cookiecutter.__app_name}} +``` + +Note: you can re-run this command to re-install with the latest version + +## Running the app + +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 +``` + +Run the app, using all cores:: + +```bash +{{cookiecutter.__app_name}} /path/to/bids/dir /path/to/output/dir participant --cores all +``` + +If any workflow rules require containers, then run with the `--use-singularity` option. + +## Generating a report + +After your processing is complete, you can use snakemake's `--report` feature to generate +an HTML report. This report will include a graph of all the jobs run, with clickable nodes +to inspect the shell command or python code used in each job, along with the config files and +run times for each job. Workflows may also contain append images for quality assurance or to +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 +``` + +## 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 }}: + +# 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 +``` + +# Follow the steps above to install from github repository + +### Install job submission helpers + +Snakemake can submit jobs with SLURM, but you need to set-up a Snakemake profile to enable this. The Khan lab has a +snakemake profile that is configured for graham but is customizable upon install, please see `cc-slurm ` for more info. + +If you don't need Snakemake to parallelize jobs across different nodes, you can make use of the simple job submission wrappers in `neuroglia-helpers `, e.g. `regularSubmit` or `regularInteractive` wrappers. + +These are used in the instructions below. + +### Running jobs on Compute Canada + +In an interactive job (for testing): + +```bash +regularInteractive -n 8 {{ cookiecutter.__app_name }} 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 +``` + +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 +``` + +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 +``` diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/index.md b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/index.md new file mode 100644 index 00000000..dd12eea1 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/index.md @@ -0,0 +1,27 @@ +```{include} ../README.md + +``` + +```{toctree} +:maxdepth: 1 +:caption: Contents: +``` + +```{toctree} +:caption: Getting started +:name: getting_started +:hidden: +:maxdepth: 1 + +getting_started/installation +``` + +```{toctree} +:caption: Usage +:name: usage +:hidden: +:maxdepth: 1 + +usage/app_cli +usage/snakemake_cli +``` diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/requirements.txt b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/requirements.txt new file mode 100644 index 00000000..21901c99 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/requirements.txt @@ -0,0 +1,4 @@ +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 new file mode 100644 index 00000000..7124ada5 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/app_cli.md @@ -0,0 +1,7 @@ +## Command line interface + +```{argparse} +:filename: ../{{ cookiecutter.__app_name }}/run.py +:func: get_parser +:prog: {{ cookiecutter.__app_name }} +``` diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/snakemake_cli.md b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/snakemake_cli.md new file mode 100644 index 00000000..2e834372 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/docs/usage/snakemake_cli.md @@ -0,0 +1,7 @@ +## Snakemake Command line interface + +```{argparse} +:module: snakemake +:func: get_argument_parser +:prog: snakemake +``` diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/pipeline_description.json b/snakebids/project_template/{{ cookiecutter.__app_name }}/pipeline_description.json new file mode 100644 index 00000000..eb4d9520 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/pipeline_description.json @@ -0,0 +1,19 @@ +{ + "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 %} + } + ] +} diff --git a/snakebids/project_template/{{ cookiecutter.__app_name }}/pyproject.toml b/snakebids/project_template/{{ cookiecutter.__app_name }}/pyproject.toml new file mode 100644 index 00000000..be6f20e5 --- /dev/null +++ b/snakebids/project_template/{{ cookiecutter.__app_name }}/pyproject.toml @@ -0,0 +1,29 @@ +[tool.poetry] +name = "{{ cookiecutter.app_full_name }}" +version = "{{ cookiecutter._app_version }}" +description = "{{ cookiecutter.app_description }}" +authors = [ + "{{ cookiecutter.full_name }}{% if cookiecutter.email %} <{{ cookiecutter.email }}> {% endif %}", +] +readme = "README.md"{% if cookiecutter.github %} +repository = "https://github.com/{{ cookiecutter.github }}/{{ cookiecutter.__app_name }}"{% endif %} +packages = [ + { include = "{{ cookiecutter.__app_name }}" }, +] + +[tool.poetry.metadata] +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent" +] + +[tool.poetry.dependencies] +python = ">=3.7, <4.0", +snakebids = ">={{ cookiecutter._snakebids_version }}", + +[tool.poetry.scripts] +{{ cookiecutter.__app_name }} = '{{ cookiecutter.__app_name }}.run:main' + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"" \ No newline at end of file diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/workflow/Snakefile b/snakebids/project_template/{{ cookiecutter.__app_name }}/workflow/Snakefile similarity index 100% rename from snakebids/project_template/{{cookiecutter.app_name}}/workflow/Snakefile rename to snakebids/project_template/{{ cookiecutter.__app_name }}/workflow/Snakefile diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/run.py b/snakebids/project_template/{{ cookiecutter.__app_name }}/{{ cookiecutter.__app_name }}/run.py similarity index 100% rename from snakebids/project_template/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/run.py rename to snakebids/project_template/{{ cookiecutter.__app_name }}/{{ cookiecutter.__app_name }}/run.py diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/README.rst b/snakebids/project_template/{{cookiecutter.app_name}}/README.rst deleted file mode 100644 index 69e62043..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -{{cookiecutter.app_name}} -============ - -{{cookiecutter.app_description}} diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/getting_started/installation.rst b/snakebids/project_template/{{cookiecutter.app_name}}/docs/getting_started/installation.rst deleted file mode 100644 index eee03d7c..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/docs/getting_started/installation.rst +++ /dev/null @@ -1,86 +0,0 @@ -Installation -============ - -Install from github with pip:: - - pip install -e git+https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.app_name}}#egg={{cookiecutter.app_name}} - -Note: you can re-run this command to re-install with the latest version - -Running the app -=============== - -Do a dry-run first (``-n``) and simply print (``-p``) what would be run:: - - {{cookiecutter.app_name}} /path/to/bids/dir /path/to/output/dir participant -np - -Run the app, using all cores:: - - {{cookiecutter.app_name}} /path/to/bids/dir /path/to/output/dir participant --cores all - -If any workflow rules require containers, then run with the ``--use-singularity`` option. - - -Generating a report -------------------- - -After your processing is complete, you can use snakemake's ``--report`` feature to generate -an HTML report. This report will include a graph of all the jobs run, with clickable nodes -to inspect the shell command or python code used in each job, along with the config files and -run times for each job. Workflows may also contain append images for quality assurance or to -summarize outputs, by using the ``report(...)`` function on any snakemake output. - -To generate a report, run:: - - {{cookiecutter.app_name}} /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 }}: - -#. Create a virtualenv and activate it:: - - cd $SCRATCH - module load python/3 - virtualenv venv_{{ cookiecutter.app_name }} - source venv_{{ cookiecutter.app_name }}/bin/activate - -#. Follow the steps above to install from github repository - -Install job submission helpers ------------------------------- - -Snakemake can submit jobs with SLURM, but you need to set-up a Snakemake profile to enable this. The Khan lab has a -snakemake profile that is configured for graham but is customizable upon install, please see `cc-slurm `_ for more info. - -If you don't need Snakemake to parallelize jobs across different nodes, you can make use of the simple job submission wrappers in `neuroglia-helpers `_, e.g. ``regularSubmit`` or ``regularInteractive`` wrappers. - -These are used in the instructions below. - -Running jobs on Compute Canada ------------------------------- - -In an interactive job (for testing):: - - regularInteractive -n 8 - {{ cookiecutter.app_name }} 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:: - - regularSubmit -j Fat {{ cookiecutter.app_name }} bids_dir out_dir participant -j 32 - - -Scaling up to ~hundred subjects (needs cc-slurm snakemake profile installed), submits 1 16core job per subject:: - - {{ cookiecutter.app_name }} 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):: - - {{ cookiecutter.app_name }} bids_dir out_dir participant --profile cc-slurm --group-components subj=10 - diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/index.rst b/snakebids/project_template/{{cookiecutter.app_name}}/docs/index.rst deleted file mode 100644 index afb812bd..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/docs/index.rst +++ /dev/null @@ -1,32 +0,0 @@ -.. app_name documentation master file, created by - sphinx-quickstart on Thu Jul 30 10:15:34 2020. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -.. include:: ../README.rst - -.. toctree:: - :maxdepth: 1 - :caption: Contents: - - -.. toctree:: - :caption: Getting started - :name: getting_started - :hidden: - :maxdepth: 1 - - getting_started/installation - -.. toctree:: - :caption: Usage - :name: usage - :hidden: - :maxdepth: 1 - - usage/app_cli - usage/snakemake_cli - - - - 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 2b40b00f..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.rst b/snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/app_cli.rst deleted file mode 100644 index 9799d543..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/app_cli.rst +++ /dev/null @@ -1,9 +0,0 @@ -Command line interface --------------------- - -.. argparse:: - :filename: ../{{cookiecutter.app_name}}/run.py - :func: get_parser - :prog: {{cookiecutter.app_name}} - - diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/snakemake_cli.rst b/snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/snakemake_cli.rst deleted file mode 100644 index f8261fbc..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/docs/usage/snakemake_cli.rst +++ /dev/null @@ -1,9 +0,0 @@ -Snakemake Command line interface -________________________________ - -.. argparse:: - :module: snakemake - :func: get_argument_parser - :prog: snakemake - - diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/pipeline_description.json b/snakebids/project_template/{{cookiecutter.app_name}}/pipeline_description.json deleted file mode 100644 index 4e7c7153..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/pipeline_description.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Name": "Dataset generated by {{cookiecutter.app_name}}", - "BIDSVersion": "1.8.0", - "DatasetType": "derivative", - "GeneratedBy": [ - { - "Name": "{{cookiecutter.app_name}}", - "Version": "0.1.0"{{ [',\n "CodeURL": "http://github.com/', cookiecutter.github_username,'/',cookiecutter.app_name,'"']|join if cookiecutter.github_username }}{{ ',\n "Author": "cookiecutter.full_name"' if cookiecutter.full_name }}{{ ',\n "AuthorEmail": "cookiecutter.email",' if cookiecutter.email }} - } - ] -} diff --git a/snakebids/project_template/{{cookiecutter.app_name}}/setup.py b/snakebids/project_template/{{cookiecutter.app_name}}/setup.py deleted file mode 100644 index 48841d7e..00000000 --- a/snakebids/project_template/{{cookiecutter.app_name}}/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -import json - -import setuptools - -with open("README.rst", "r", encoding="utf-8") as fh: - long_description = fh.read() - -with open("pipeline_description.json", "r", encoding="utf-8") as fh: - pipeline = json.load(fh) -name = pipeline["GeneratedBy"][0]["Name"] -description = pipeline["Name"] -version = pipeline["GeneratedBy"][0]["Version"] -optional_vals = { - attr: pipeline["GeneratedBy"][0].get(key) - for attr, key in [ - ("url", "CodeURL"), - ("author", "Author"), - ("author_email", "AuthorEmail"), - ] - if key in pipeline -} - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=long_description, - long_description_content_type="text/x-rst", - packages=setuptools.find_packages(), - include_package_data=True, - classifiers=[ - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - ], - entry_points={ - "console_scripts": [ - "{{cookiecutter.app_name}}={{cookiecutter.app_name}}.run:main" - ] - }, - install_requires=["snakebids>={{cookiecutter.snakebids_version}}", "snakemake"], - python_requires=">=3.7", - **optional_vals, -) diff --git a/snakebids/tests/test_template.py b/snakebids/tests/test_template.py index dd7953ea..66ab8254 100644 --- a/snakebids/tests/test_template.py +++ b/snakebids/tests/test_template.py @@ -10,12 +10,11 @@ def test_template_dry_runs_successfully(tmp_path: Path): - app_name = Path(tmp_path).resolve().name + app_name = "snakebids" cookiecutter( join(list(snakebids.__path__)[0], "project_template"), no_input=True, output_dir=tmp_path, - extra_context={"_output_dir": app_name}, ) app = SnakeBidsApp( tmp_path / app_name,