diff --git a/.tools/docs/README.md b/.tools/docs/README.md index 31305e1..a59be0b 100644 --- a/.tools/docs/README.md +++ b/.tools/docs/README.md @@ -1,40 +1,57 @@ -# Internal LabConstrictor documentation +# LabConstrictor +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20758747.svg)](https://doi.org/10.5281/zenodo.20758747) -This file temporarily lists all internal LabConstrictor documentation. After you set up and customise the repository, it will be replaced by the [main README.md](../../README.md) file. +![LabConstrictor Comic](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/comic.png) -## From zero to installed notebooks +**LabConstrictor turns your Jupyter notebooks into desktop apps that anyone can install.** Your users download an installer, double-click, and work. They need no Python, no pip and no terminal. -- [Before getting started](before_getting_started.md) -- [Create a new repository from this template](create_repository.md) -- [Initialise your repository](initialise_repository.md) -- [Accept a Pull Request](accept_pull_request.md) -- [Generate notebook requirements](notebook_requirements.md) -- [Upload your notebooks](notebook_upload.md) -- [Create executable installers](executable_creation.md) -- [Install an app](install.md) -- [Download and install the application](download_executable.md) (this file will be available after creating executables) -- [Notebook usage after installation](notebook_usage.md) -- [Troubleshooting an installed app](troubleshooting_installed_app.md) +This repository is a GitHub template. You bring the notebooks; it builds the installers for Windows, macOS and Linux, and gives the app a Welcome page that lists your notebooks. -## Customise and share (optional) +**Website, guides and ready-made apps: ** -- [Customise the installer images](installer_images.md) -- [Describe your app for the App Centre](app_manifest.md) -- [Upload external code, and publish it on PyPI (optional)](external_code_upload.md) -- [Expose tools to napari, Fiji and QuPath](tools_bridge.md) +## Who is it for? -## Keep your app up to date (optional) +- **Researchers** who want colleagues to run an analysis without setting up Python. +- **Developers** who ship interactive notebooks to people who do not code. +- **Teachers** who want a workshop to start with a double-click. -- [Keep your app up to date](keep_app_up_to_date.md) -- [Enable automatic template updates](template_synchronization.md) +Looking for an app to use, not to build? Go to the [App Centre](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/). -## Notebook authoring tips +## What your users get -- [Write notebooks that run in both Google Colab and JupyterLab](notebook_portability.md) -- [Hide code cells in notebooks](code_hiding.md) +![An installed LabConstrictor app: installer, Welcome notebook and a notebook with hidden code](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Summary.gif) -## GitHub management +- An installer for their system: `.exe` (Windows), `.pkg` (macOS) or `.sh` (Linux). +- A Welcome notebook that opens in the browser and lists the app's notebooks. +- Notebooks with the code hidden, so they look like an app. The code can be shown again. +- A notice when a newer version of the app is available. -- [GitHub actions/workflows overview](workflow_status.md) -- [Troubleshooting repository setup](troubleshooting.md) -- [Create a personal access token for notebook access](personal_access_token.md) +## Quick start + +You need a GitHub account and the notebooks you want to share. Read [Before getting started](./before_getting_started.md) first, then: + +1. [Create a new repository from this template](./create_repository.md) +2. [Enable automatic template updates](./template_synchronization.md) +3. [Initialise your repository](./initialise_repository.md) with the web form +4. [Upload external code](./external_code_upload.md) (optional) +5. [Upload your notebooks](./notebook_upload.md) +6. [Create the installers](./executable_creation.md) + +The same guides, with pictures and a search box, are on the [website](https://cellmigrationlab.github.io/LabConstrictor-Site/build/). + +## Go further + +- [List your app in the App Centre](./app_manifest.md) +- [Offer your app's functions in napari, Fiji and QuPath](./tools_bridge.md) +- [Write notebooks that run in both Colab and JupyterLab](./notebook_portability.md) +- [All guides](./README.md) + +## Contributing and questions + +Bug fixes and improvements are welcome: read the [contributing guidelines](.github/CONTRIBUTING.md). Using LabConstrictor, or stuck? [Open an issue](https://github.com/CellMigrationLab/LabConstrictor/issues). + +## Citation + +If you use LabConstrictor in your research, please cite the project to support its development: + +Iván Hidalgo-Cenalmor, Marcela Xiomara Rivera Pineda, Bruno M. Saraiva, Ricardo Henriques, and Guillaume Jacquemet. **Packaging Jupyter notebooks as installable desktop apps using LabConstrictor. arXiv preprint 2026** DOI: https://doi.org/10.48550/arXiv.2603.10704 diff --git a/.tools/docs/external_code_upload.md b/.tools/docs/external_code_upload.md index 6a5f1c6..f39a875 100644 --- a/.tools/docs/external_code_upload.md +++ b/.tools/docs/external_code_upload.md @@ -10,7 +10,7 @@ Organize your external code and follow Python packaging best practices. Set up t ```text src/ -|-- PYTHON_PROJ_NAME/ +|-- alphafold2/ | |-- __init__.py | |-- my_script.py | |-- subpackage/ @@ -24,7 +24,7 @@ Think of `__init__.py` as the file that tells Python “this folder is a package If you leave it empty, that is perfectly fine—the package will still import correctly. When you want to make notebooks feel friendlier, you can re-export helper functions so users can discover them more easily: ```python -# src/PYTHON_PROJ_NAME/__init__.py +# src/alphafold2/__init__.py from .my_script import run_analysis, load_config __all__ = ["run_analysis", "load_config"] @@ -45,19 +45,19 @@ Once uploaded, your external code will be available to your notebooks as a packa **Import the whole package:** ```python -import PYTHON_PROJ_NAME +import alphafold2 ``` If your folder under `src/` is called `celltools`, then `import celltools` will work because `src/celltools/__init__.py` exists. **Import function:** ```python -from PYTHON_PROJ_NAME import my_script +from alphafold2 import my_script ``` **Import submodule:** ```python -from PYTHON_PROJ_NAME.subpackage import submodule1 +from alphafold2.subpackage import submodule1 ``` ## 4. Publish the code on PyPI (optional) diff --git a/.tools/python/bump_constructor.py b/.tools/python/bump_constructor.py index dcbbbb5..36b8111 100644 --- a/.tools/python/bump_constructor.py +++ b/.tools/python/bump_constructor.py @@ -46,7 +46,7 @@ def extract_project_folder(extra_files: list) -> str: if parts: return parts[0] # Fallback - return "PROJECT_NAME" + return "AlphaFold2" def ensure_requirements_in_extra_files(construct_data: dict): extra_files = construct_data.get("extra_files") @@ -59,7 +59,7 @@ def ensure_requirements_in_extra_files(construct_data: dict): isinstance(item, dict) and "requirements.txt" in item for item in extra_files ) if not requirements_included: - extra_files.append({"requirements.txt": "PROJECT_NAME/requirements.txt"}) + extra_files.append({"requirements.txt": "AlphaFold2/requirements.txt"}) debug("Added mapping for requirements.txt") else: debug("requirements.txt mapping already present") @@ -68,7 +68,7 @@ def ensure_requirements_in_extra_files(construct_data: dict): isinstance(item, dict) and "requirements_gpu.txt" in item for item in extra_files ) if not gpu_requirements_included and Path("requirements_gpu.txt").exists(): - extra_files.append({"requirements_gpu.txt": "PROJECT_NAME/requirements_gpu.txt"}) + extra_files.append({"requirements_gpu.txt": "AlphaFold2/requirements_gpu.txt"}) debug("Added mapping for requirements_gpu.txt") elif Path("requirements_gpu.txt").exists(): debug("requirements_gpu.txt mapping already present") @@ -81,7 +81,7 @@ def ensure_requirements_in_extra_files(construct_data: dict): isinstance(item, dict) and "requirements-linux.txt" in item for item in extra_files ) if not linux_included: - extra_files.append({"requirements-linux.txt": "PROJECT_NAME/requirements-linux.txt"}) + extra_files.append({"requirements-linux.txt": "AlphaFold2/requirements-linux.txt"}) debug("Added mapping for requirements-linux.txt") else: debug("requirements-linux.txt mapping already present") @@ -93,7 +93,7 @@ def ensure_requirements_in_extra_files(construct_data: dict): isinstance(item, dict) and "requirements-windows.txt" in item for item in extra_files ) if not windows_included: - extra_files.append({"requirements-windows.txt": "PROJECT_NAME/requirements-windows.txt"}) + extra_files.append({"requirements-windows.txt": "AlphaFold2/requirements-windows.txt"}) debug("Added mapping for requirements-windows.txt") else: debug("requirements-windows.txt mapping already present") @@ -106,7 +106,7 @@ def ensure_requirements_in_extra_files(construct_data: dict): isinstance(item, dict) and "requirements-macos.txt" in item for item in extra_files ) if not macos_included: - extra_files.append({"requirements-macos.txt": "PROJECT_NAME/requirements-macos.txt"}) + extra_files.append({"requirements-macos.txt": "AlphaFold2/requirements-macos.txt"}) debug("Added mapping for requirements-macos.txt") else: debug("requirements-macos.txt mapping already present") @@ -218,7 +218,7 @@ def ensure_extra_files(construct_data: dict, notebooks_root: Path, src_root: Pat # First get the name of the package from setup.py setup_path = repo_root / "setup.py" - project_name = "PROJECT_NAME" + project_name = "AlphaFold2" if setup_path.exists(): setup_text = setup_path.read_text(encoding="utf-8") name_match = re.search(r'name\s*=\s*["\']([^"\']+)["\']', setup_text) diff --git a/.tools/templates/Welcome_template.ipynb b/.tools/templates/Welcome_template.ipynb index 33699e5..8051e59 100644 --- a/.tools/templates/Welcome_template.ipynb +++ b/.tools/templates/Welcome_template.ipynb @@ -5,7 +5,7 @@ "id": "335f15f8", "metadata": {}, "source": [ - "# Welcome to PROJECT_NAME! \n", + "# Welcome to AlphaFold2! \n", "---\n", "\n", "## How does it work?\n", diff --git a/.tools/templates/download_executable_template.md b/.tools/templates/download_executable_template.md index e5404cb..2ed9812 100644 --- a/.tools/templates/download_executable_template.md +++ b/.tools/templates/download_executable_template.md @@ -1,16 +1,16 @@ -# ⬇️ Install PROJECT_NAME Locally +# ⬇️ Install AlphaFold2 Locally -Choose your operating system and follow the instructions below to install PROJECT_NAME on your computer. +Choose your operating system and follow the instructions below to install AlphaFold2 on your computer.
🪟 CLICK HERE TO DISPLAY WINDOWS GUIDELINES -## 1. Click the button to download PROJECT_NAME executable +## 1. Click the button to download AlphaFold2 executable - + Download for Windows @@ -28,11 +28,11 @@ After that, follow the on-screen prompts to complete the installation. ![Installation Dialog](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Windows_Installation_Dialog.gif) -## 3. Launch PROJECT_NAME +## 3. Launch AlphaFold2 -After installation, you can launch PROJECT_NAME from your desktop app or from the Start Menu: +After installation, you can launch AlphaFold2 from your desktop app or from the Start Menu: -![Launch PROJECT_NAME](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Windows_Launch.gif) +![Launch AlphaFold2](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Windows_Launch.gif) Then, start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. @@ -46,9 +46,9 @@ Then, start using it following the instructions on the [Usage of Notebooks After 🐧 CLICK HERE TO DISPLAY UBUNTU GUIDELINES -## 1. Click the button to download PROJECT_NAME executable +## 1. Click the button to download AlphaFold2 executable - + Download for Linux @@ -61,7 +61,7 @@ Then, start using it following the instructions on the [Usage of Notebooks After 2.- Copy and paste the following command: ```bash -bash PROJECT_NAME-VERSION_NUMBER-Linux-x86_64.sh +bash AlphaFold2-VERSION_NUMBER-Linux-x86_64.sh ``` 3.- Click Enter to run the command. @@ -78,9 +78,9 @@ bash PROJECT_NAME-VERSION_NUMBER-Linux-x86_64.sh ## 3. Follow the installation prompts -## 4. Launch PROJECT_NAME +## 4. Launch AlphaFold2 -After installation, you can launch PROJECT_NAME from your applications menu and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. +After installation, you can launch AlphaFold2 from your applications menu and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. ---
@@ -108,13 +108,13 @@ First of all, you will need to choose whether you want to install it with **(A) > 2. Select About This Mac. > 3. A window will pop up displaying your Mac’s information. Look into the `Chip` or `Processor` field. If `Intel` is mentioned, then download the Intel option. Otherwise, if `Mx` (e.g. M1 or M2) is mentioned, then download the ARM64 option. - + Download for Mac ARM64 or - + Download for Mac Intel @@ -125,15 +125,15 @@ Follow the guidelines shown on the following GIF or the instructions bellow: ![MacOS PKG Installation](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/MacOS_Install_Pkg.gif) -1. Double-click the downloaded file to start the installation process. It might give some errors, as shown bellow, go to `Settings > Privacy & Security > Security` and there the PROJECT_NAME package should appear. Click on `Open Anyway`. +1. Double-click the downloaded file to start the installation process. It might give some errors, as shown bellow, go to `Settings > Privacy & Security > Security` and there the AlphaFold2 package should appear. Click on `Open Anyway`. 2. After that, follow the on-screen prompts to complete the installation. > This process may take around 6-8 minutes, don't worry you will only need to do this once. > We recommend you choosing `Install only for me`. -## 4. Launch PROJECT_NAME +## 4. Launch AlphaFold2 -After installation, you can launch PROJECT_NAME from your Applications folder and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. +After installation, you can launch AlphaFold2 from your Applications folder and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. @@ -149,13 +149,13 @@ After installation, you can launch PROJECT_NAME from your Applications folder an > 2. Select About This Mac. > 3. A window will pop up displaying your Mac’s information. Look into the `Chip` or `Processor` field. If `Intel` is mentioned, then download the Intel option. Otherwise, if `Mx` (e.g. M1 or M2) is mentioned, then download the ARM64 option. - + Download for Mac ARM64 or - + Download for Mac Intel @@ -169,15 +169,15 @@ Follow the guidelines shown on the following GIF or the instructions bellow: 1. Open a terminal on the folder where you downloaded the file. 2. Copy and paste the following command: ```bash - bash PROJECT_NAME-VERSION_NUMBER-MacOSX-ARCHITECTURE.sh + bash AlphaFold2-VERSION_NUMBER-MacOSX-ARCHITECTURE.sh ``` 3. Click Enter to run the command. 4. Follow the on-screen prompts to complete the installation. > This process may take around 6-8 minutes, don't worry you will only need to do this once. -## 4. Launch PROJECT_NAME +## 4. Launch AlphaFold2 -After installation, you can launch PROJECT_NAME from your Applications folder and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. +After installation, you can launch AlphaFold2 from your Applications folder and start using it following the instructions on the [Usage of Notebooks After Installation](./notebook_usage.md) guide. @@ -185,7 +185,7 @@ After installation, you can launch PROJECT_NAME from your Applications folder an --- -# 🗑️ Uninstall PROJECT_NAME +# 🗑️ Uninstall AlphaFold2
@@ -197,13 +197,13 @@ After installation, you can launch PROJECT_NAME from your Applications folder an You can do it clicking `Uninstall` in the Start Menu like on the image bellow: -![Uninstall PROJECT_NAME](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Windows_Uninstall.png) +![Uninstall AlphaFold2](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Windows_Uninstall.png) or by directly going to `Settings` > `Apps` > `Installed apps`. -## 2. Uninstall PROJECT_NAME +## 2. Uninstall AlphaFold2 -Once there, search for `PROJECT_NAME` and click the three dots on the right and select `Uninstall`. +Once there, search for `AlphaFold2` and click the three dots on the right and select `Uninstall`. ---
@@ -220,7 +220,7 @@ Once there, search for `PROJECT_NAME` and click the three dots on the right and The default installation folder is: ``` -~/LOWER_PROJ_NAME` +~/alphafold2` ``` You can navigate to this folder using your file explorer or terminal. @@ -262,17 +262,17 @@ bash uninstall.sh ## 1. Uninstall the App 1.- Go to the `Applications` folder. -2.- Find PROJECT_NAME and delete it. +2.- Find AlphaFold2 and delete it. -## 2. Uninstall PROJECT_NAME folder +## 2. Uninstall AlphaFold2 folder -1.- On the installation process, you chose a folder where you would install PROJECT_NAME. Find it. +1.- On the installation process, you chose a folder where you would install AlphaFold2. Find it. 2.- Delete that complete folder. ## 3. Check that the uninstallation has been correctly done 1.- Go to your `Trash` folder. -2.- Check that both PROJECT_NAME App and folder are there. +2.- Check that both AlphaFold2 App and folder are there. diff --git a/README.md b/README.md index 1833119..de1de02 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,16 @@ -# LabConstrictor -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20758747.svg)](https://doi.org/10.5281/zenodo.20758747) +# AlphaFold2 -![LabConstrictor Comic](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/comic.png) +Welcome to AlphaFold2! +This repository was initialised using LabConstrictor. +If you want to start using AlphaFold2, please go to the [How to Download and Install AlphaFold2?](#how-to-download-and-install-alphafold2) below. +> If you are the developer of AlphaFold2, please customise this README file. -**LabConstrictor turns your Jupyter notebooks into desktop apps that anyone can install.** Your users download an installer, double-click, and work. They need no Python, no pip and no terminal. +## How to Download and Install AlphaFold2? -This repository is a GitHub template. You bring the notebooks; it builds the installers for Windows, macOS and Linux, and gives the app a Welcome page that lists your notebooks. +The installer would only be available once AlphaFold2 developer has created a release. +Please, go to [this page](.tools/docs/download_executable.md) and check if the installing instructions are there. +In case there is no documentation there, please [create an issue](https://github.com/CellMigrationLab/AlphaFold2/issues) asking the developer to create a release. +## Documentation for AlphaFold2's Developers -**Website, guides and ready-made apps: ** +Internal documentation on how to upload notebooks or create executables is available in the [.tools/docs](.tools/docs/README.md) folder. -## Who is it for? - -- **Researchers** who want colleagues to run an analysis without setting up Python. -- **Developers** who ship interactive notebooks to people who do not code. -- **Teachers** who want a workshop to start with a double-click. - -Looking for an app to use, not to build? Go to the [App Centre](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/). - -## What your users get - -![An installed LabConstrictor app: installer, Welcome notebook and a notebook with hidden code](https://github.com/CellMigrationLab/LabConstrictor/blob/doc_source/Summary.gif) - -- An installer for their system: `.exe` (Windows), `.pkg` (macOS) or `.sh` (Linux). -- A Welcome notebook that opens in the browser and lists the app's notebooks. -- Notebooks with the code hidden, so they look like an app. The code can be shown again. -- A notice when a newer version of the app is available. - -## Quick start - -You need a GitHub account and the notebooks you want to share. Read [Before getting started](.tools/docs/before_getting_started.md) first, then: - -1. [Create a new repository from this template](.tools/docs/create_repository.md) -2. [Enable automatic template updates](.tools/docs/template_synchronization.md) -3. [Initialise your repository](.tools/docs/initialise_repository.md) with the web form -4. [Upload external code](.tools/docs/external_code_upload.md) (optional) -5. [Upload your notebooks](.tools/docs/notebook_upload.md) -6. [Create the installers](.tools/docs/executable_creation.md) - -The same guides, with pictures and a search box, are on the [website](https://cellmigrationlab.github.io/LabConstrictor-Site/build/). - -## Go further - -- [List your app in the App Centre](.tools/docs/app_manifest.md) -- [Offer your app's functions in napari, Fiji and QuPath](.tools/docs/tools_bridge.md) -- [Write notebooks that run in both Colab and JupyterLab](.tools/docs/notebook_portability.md) -- [All guides](.tools/docs/README.md) - -## Contributing and questions - -Bug fixes and improvements are welcome: read the [contributing guidelines](.github/CONTRIBUTING.md). Using LabConstrictor, or stuck? [Open an issue](https://github.com/CellMigrationLab/LabConstrictor/issues). - -## Citation - -If you use LabConstrictor in your research, please cite the project to support its development: - -Iván Hidalgo-Cenalmor, Marcela Xiomara Rivera Pineda, Bruno M. Saraiva, Ricardo Henriques, and Guillaume Jacquemet. **Packaging Jupyter notebooks as installable desktop apps using LabConstrictor. arXiv preprint 2026** DOI: https://doi.org/10.48550/arXiv.2603.10704 diff --git a/app/bash_bat_scripts/post_install.bat b/app/bash_bat_scripts/post_install.bat index c69b3c9..a308569 100644 --- a/app/bash_bat_scripts/post_install.bat +++ b/app/bash_bat_scripts/post_install.bat @@ -3,7 +3,7 @@ SETLOCAL EnableExtensions DisableDelayedExpansion SET "LOG_FILE=%PREFIX%\menuinst_debug.log" SET "PYTHON_EXE=%PREFIX%\python.exe" -SET "PROJECT_ROOT=%PREFIX%\PROJECT_NAME" +SET "PROJECT_ROOT=%PREFIX%\AlphaFold2" SET "BASE_REQUIREMENTS=%PROJECT_ROOT%\requirements.txt" SET "GPU_REQUIREMENTS=%PROJECT_ROOT%\requirements_gpu.txt" SET "SELECTED_REQUIREMENTS=%BASE_REQUIREMENTS%" @@ -93,10 +93,10 @@ REM External Python code is optional in LabConstrictor projects. If setup.py is REM bundled, install it without a temporary build environment and verify that REM the generated import package is usable. Otherwise continue without it. IF EXIST "%PROJECT_ROOT%\setup.py" ( - echo Found setup.py, installing PROJECT_NAME package locally without build isolation. >> "%LOG_FILE%" + echo Found setup.py, installing AlphaFold2 package locally without build isolation. >> "%LOG_FILE%" "%PYTHON_EXE%" -m pip install --no-deps --no-build-isolation "%PROJECT_ROOT%" >> "%LOG_FILE%" 2>&1 IF ERRORLEVEL 1 ( - SET "FAILURE_MESSAGE=PROJECT_NAME package installation failed." + SET "FAILURE_MESSAGE=AlphaFold2 package installation failed." GOTO :fail ) @@ -104,9 +104,9 @@ IF EXIST "%PROJECT_ROOT%\setup.py" ( REM so labconstrictor-tools is installed BEFORE the import check below. A failed install is only a WARNING, see :install_lc_tools at the end of this file. CALL :install_lc_tools - "%PYTHON_EXE%" -c "import PYTHON_PROJ_NAME; print('PROJECT_NAME import successful:', PYTHON_PROJ_NAME.__file__)" >> "%LOG_FILE%" 2>&1 + "%PYTHON_EXE%" -c "import alphafold2; print('AlphaFold2 import successful:', alphafold2.__file__)" >> "%LOG_FILE%" 2>&1 IF ERRORLEVEL 1 ( - SET "FAILURE_MESSAGE=Installed PROJECT_NAME package could not be imported as PYTHON_PROJ_NAME." + SET "FAILURE_MESSAGE=Installed AlphaFold2 package could not be imported as alphafold2." GOTO :fail ) ) ELSE ( @@ -128,17 +128,17 @@ REM Napari, Fiji and QuPath list the app only in the hosts its hosts: line names REM registered without hosts (every host lists it) and the log says so (see the lines after "Found ... registering" below). SET "LC_APP_MANIFEST=" IF EXIST "%PROJECT_ROOT%\labconstrictor-app.yaml" SET "LC_APP_MANIFEST=%PROJECT_ROOT%\labconstrictor-app.yaml" -"%PYTHON_EXE%" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('PYTHON_PROJ_NAME_lc_tools') else 1)" >> "%LOG_FILE%" 2>&1 +"%PYTHON_EXE%" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('alphafold2_lc_tools') else 1)" >> "%LOG_FILE%" 2>&1 IF NOT ERRORLEVEL 1 ( - echo Found PYTHON_PROJ_NAME_lc_tools: registering the tools of PROJECT_NAME for Napari, Fiji and QuPath. >> "%LOG_FILE%" + echo Found alphafold2_lc_tools: registering the tools of AlphaFold2 for Napari, Fiji and QuPath. >> "%LOG_FILE%" REM Which hosts list the app (the sentence is the one Tools uses for an app without hosts). Logged before the READY check, which sets the errorlevel. - IF NOT DEFINED LC_APP_MANIFEST echo WARNING: labconstrictor-app.yaml was not found in "%PROJECT_ROOT%" ^(add it to extra_files in construct.yaml^), so PROJECT_NAME is registered without hosts. 'PROJECT_NAME' declares no hosts, so it is listed in every host; register it with --app-manifest ^(or --hosts^) to choose >> "%LOG_FILE%" + IF NOT DEFINED LC_APP_MANIFEST echo WARNING: labconstrictor-app.yaml was not found in "%PROJECT_ROOT%" ^(add it to extra_files in construct.yaml^), so AlphaFold2 is registered without hosts. 'AlphaFold2' declares no hosts, so it is listed in every host; register it with --app-manifest ^(or --hosts^) to choose >> "%LOG_FILE%" IF DEFINED LC_APP_MANIFEST echo Passing the hosts of "%LC_APP_MANIFEST%" to Tools ^(--app-manifest^); Tools logs the same sentence if the file declares no hosts. >> "%LOG_FILE%" REM labconstrictor-tools was installed before the import check (:install_lc_tools): register only if that worked (errorlevel 1 otherwise). "%PYTHON_EXE%" -c "import sys; sys.exit(0 if sys.argv[1] == '1' else 1)" "%LC_TOOLS_READY%" >> "%LOG_FILE%" 2>&1 - IF NOT ERRORLEVEL 1 IF DEFINED LC_APP_MANIFEST "%PYTHON_EXE%" -m labconstrictor_tools register --name "PROJECT_NAME" --prefix "%PREFIX%" --module PYTHON_PROJ_NAME_lc_tools --version "%LC_APP_VERSION%" --display-name "PROJECT_NAME" --app-manifest "%LC_APP_MANIFEST%" >> "%LOG_FILE%" 2>&1 - IF NOT ERRORLEVEL 1 IF NOT DEFINED LC_APP_MANIFEST "%PYTHON_EXE%" -m labconstrictor_tools register --name "PROJECT_NAME" --prefix "%PREFIX%" --module PYTHON_PROJ_NAME_lc_tools --version "%LC_APP_VERSION%" --display-name "PROJECT_NAME" >> "%LOG_FILE%" 2>&1 - IF ERRORLEVEL 1 echo WARNING: tool registration failed - see the pip and register output above in this file; PROJECT_NAME itself is installed. >> "%LOG_FILE%" + IF NOT ERRORLEVEL 1 IF DEFINED LC_APP_MANIFEST "%PYTHON_EXE%" -m labconstrictor_tools register --name "AlphaFold2" --prefix "%PREFIX%" --module alphafold2_lc_tools --version "%LC_APP_VERSION%" --display-name "AlphaFold2" --app-manifest "%LC_APP_MANIFEST%" >> "%LOG_FILE%" 2>&1 + IF NOT ERRORLEVEL 1 IF NOT DEFINED LC_APP_MANIFEST "%PYTHON_EXE%" -m labconstrictor_tools register --name "AlphaFold2" --prefix "%PREFIX%" --module alphafold2_lc_tools --version "%LC_APP_VERSION%" --display-name "AlphaFold2" >> "%LOG_FILE%" 2>&1 + IF ERRORLEVEL 1 echo WARNING: tool registration failed - see the pip and register output above in this file; AlphaFold2 itself is installed. >> "%LOG_FILE%" ) "%PYTHON_EXE%" "%PROJECT_ROOT%\include_path.py" --path "%PREFIX%" --files "%PROJECT_ROOT%\notebook_launcher.json" --keyword "BASE_PATH_KEYWORD" >> "%LOG_FILE%" 2>&1 @@ -176,23 +176,23 @@ IF ERRORLEVEL 1 ( GOTO :fail ) -"%PYTHON_EXE%" -c "from menuinst.api import install; import os; print(install(os.path.join(r'%PREFIX%', 'PROJECT_NAME', 'notebook_launcher.json')))" >> "%LOG_FILE%" 2>&1 +"%PYTHON_EXE%" -c "from menuinst.api import install; import os; print(install(os.path.join(r'%PREFIX%', 'AlphaFold2', 'notebook_launcher.json')))" >> "%LOG_FILE%" 2>&1 IF ERRORLEVEL 1 ( SET "FAILURE_MESSAGE=Application shortcut creation failed." GOTO :fail ) -SET "ARP_KEY=HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\UNDERSCORED_PROJECT_NAME" -SET "UNINSTALL_EXE=%PREFIX%\Uninstall-UNDERSCORED_PROJECT_NAME.exe" +SET "ARP_KEY=HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\AlphaFold2" +SET "UNINSTALL_EXE=%PREFIX%\Uninstall-AlphaFold2.exe" REM Windows Apps list: the version of this installer (the version: line of the bundled construct.yaml, written by each release), REM and the app icon the installer copied (the first .ico in the app folder); no icon entry when there is none. -SET "DISPLAY_VERSION=VERSION_NUMBER" +SET "DISPLAY_VERSION=0.0.1" IF EXIST "%PROJECT_ROOT%\construct.yaml" FOR /F "usebackq tokens=1,* delims=: " %%A IN (`findstr /B /C:"version:" "%PROJECT_ROOT%\construct.yaml"`) DO SET "DISPLAY_VERSION=%%~B" SET "DISPLAY_ICON=" FOR %%I IN ("%PROJECT_ROOT%\*.ico") DO IF NOT DEFINED DISPLAY_ICON SET "DISPLAY_ICON=%%~fI" -SET "PUBLISHER=GITHUB_OWNER" -echo Registering PROJECT_NAME in Windows Apps list >> "%LOG_FILE%" -reg add "%ARP_KEY%" /v DisplayName /d "PROJECT_NAME" /f >> "%LOG_FILE%" 2>&1 +SET "PUBLISHER=CellMigrationLab" +echo Registering AlphaFold2 in Windows Apps list >> "%LOG_FILE%" +reg add "%ARP_KEY%" /v DisplayName /d "AlphaFold2" /f >> "%LOG_FILE%" 2>&1 reg add "%ARP_KEY%" /v DisplayVersion /d "%DISPLAY_VERSION%" /f >> "%LOG_FILE%" 2>&1 reg add "%ARP_KEY%" /v Publisher /d "%PUBLISHER%" /f >> "%LOG_FILE%" 2>&1 reg add "%ARP_KEY%" /v InstallLocation /d "%PREFIX%" /f >> "%LOG_FILE%" 2>&1 @@ -242,13 +242,13 @@ REM because the package is not on PyPI yet. Once it is, use "labconstrictor-tool SET "LC_TOOLS_PIN=v0.3.0-alpha.4" IF NOT DEFINED LC_TOOLS_SPEC SET "LC_TOOLS_SPEC=https://github.com/CellMigrationLab/LabConstrictor-Tools/archive/refs/tags/%LC_TOOLS_PIN%.zip" SET "LC_TOOLS_READY=0" -"%PYTHON_EXE%" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('PYTHON_PROJ_NAME_lc_tools') else 1)" >> "%LOG_FILE%" 2>&1 +"%PYTHON_EXE%" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('alphafold2_lc_tools') else 1)" >> "%LOG_FILE%" 2>&1 IF ERRORLEVEL 1 GOTO :EOF -echo Found PYTHON_PROJ_NAME_lc_tools: installing labconstrictor-tools before the import check of PROJECT_NAME. >> "%LOG_FILE%" +echo Found alphafold2_lc_tools: installing labconstrictor-tools before the import check of AlphaFold2. >> "%LOG_FILE%" REM LC_TOOLS_SPEC goes to pip as one argument through Python: cmd.exe never re-parses it (a quote or & in it cannot run anything). "%PYTHON_EXE%" -c "import os, subprocess, sys; sys.exit(subprocess.call([sys.executable, '-m', 'pip', 'install', os.environ['LC_TOOLS_SPEC']]))" >> "%LOG_FILE%" 2>&1 IF ERRORLEVEL 1 ( - echo WARNING: labconstrictor-tools could not be installed - see the pip output above in this file; the tools of PROJECT_NAME will not be registered ^(the import check fails only if the package needs labconstrictor-tools at import time^). >> "%LOG_FILE%" + echo WARNING: labconstrictor-tools could not be installed - see the pip output above in this file; the tools of AlphaFold2 will not be registered ^(the import check fails only if the package needs labconstrictor-tools at import time^). >> "%LOG_FILE%" GOTO :EOF ) SET "LC_TOOLS_READY=1" diff --git a/app/bash_bat_scripts/post_install.sh b/app/bash_bat_scripts/post_install.sh index 6cf3075..94d00eb 100644 --- a/app/bash_bat_scripts/post_install.sh +++ b/app/bash_bat_scripts/post_install.sh @@ -3,7 +3,7 @@ set -euo pipefail LOG_FILE="$PREFIX/menuinst_debug.log" PYTHON_EXE="$PREFIX/bin/python" -PROJECT_ROOT="$PREFIX/PROJECT_NAME" +PROJECT_ROOT="$PREFIX/AlphaFold2" BASE_REQUIREMENTS="$PROJECT_ROOT/requirements.txt" GPU_REQUIREMENTS="$PROJECT_ROOT/requirements_gpu.txt" SELECTED_REQUIREMENTS="$BASE_REQUIREMENTS" @@ -69,7 +69,7 @@ fi # External Python code is optional. Verify the generated package only when the # constructor bundled setup.py and src/. if [ -f "$PROJECT_ROOT/setup.py" ]; then - echo "Found setup.py, installing PROJECT_NAME package locally without build isolation" >> "$LOG_FILE" + echo "Found setup.py, installing AlphaFold2 package locally without build isolation" >> "$LOG_FILE" "$PYTHON_EXE" -m pip install --no-deps --no-build-isolation "$PROJECT_ROOT" >> "$LOG_FILE" 2>&1 # Tools first, only for an app whose package ships a _lc_tools module: the app package may import labconstrictor_tools # at module level, so labconstrictor-tools must be installed BEFORE the import check below. A failed install is only a WARNING @@ -77,17 +77,17 @@ if [ -f "$PROJECT_ROOT/setup.py" ]; then # Default source: the GitHub archive of the labconstrictor-tools release TAG below (a plain zip: no git needed on the user's computer), # because the package is not on PyPI yet. Once it is, use "labconstrictor-tools" here. To move the pin, change only this tag. LC_TOOLS_PIN="v0.3.0-alpha.4" - LC_TOOLS_MODULE="PYTHON_PROJ_NAME_lc_tools" + LC_TOOLS_MODULE="alphafold2_lc_tools" LC_TOOLS_READY=0 if "$PYTHON_EXE" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('$LC_TOOLS_MODULE') else 1)" >> "$LOG_FILE" 2>&1; then - echo "Found $LC_TOOLS_MODULE: installing labconstrictor-tools before the import check of PROJECT_NAME" >> "$LOG_FILE" || : + echo "Found $LC_TOOLS_MODULE: installing labconstrictor-tools before the import check of AlphaFold2" >> "$LOG_FILE" || : if "$PYTHON_EXE" -m pip install "${LC_TOOLS_SPEC:-https://github.com/CellMigrationLab/LabConstrictor-Tools/archive/refs/tags/${LC_TOOLS_PIN}.zip}" >> "$LOG_FILE" 2>&1; then LC_TOOLS_READY=1 else - echo "WARNING: labconstrictor-tools could not be installed - see the pip output above in this file; the tools of PROJECT_NAME will not be registered (the import check below fails only if the package needs labconstrictor-tools at import time)." >> "$LOG_FILE" || : + echo "WARNING: labconstrictor-tools could not be installed - see the pip output above in this file; the tools of AlphaFold2 will not be registered (the import check below fails only if the package needs labconstrictor-tools at import time)." >> "$LOG_FILE" || : fi fi - "$PYTHON_EXE" -c "import PYTHON_PROJ_NAME; print('PROJECT_NAME import successful:', PYTHON_PROJ_NAME.__file__)" >> "$LOG_FILE" 2>&1 + "$PYTHON_EXE" -c "import alphafold2; print('AlphaFold2 import successful:', alphafold2.__file__)" >> "$LOG_FILE" 2>&1 else echo "No setup.py detected; this project does not bundle an optional Python package." >> "$LOG_FILE" fi @@ -99,7 +99,7 @@ fi # labconstrictor-tools is installed above, before the import check of the package (LC_TOOLS_PIN, LC_TOOLS_MODULE and LC_TOOLS_READY are set there). if [ -f "$PROJECT_ROOT/setup.py" ] && "$PYTHON_EXE" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('$LC_TOOLS_MODULE') else 1)" >> "$LOG_FILE" 2>&1; then lc_note() { echo "$*" >> "$LOG_FILE" || :; } # a full or unwritable log must not fail the installation - lc_note "Found $LC_TOOLS_MODULE: registering the tools of PROJECT_NAME for Napari, Fiji and QuPath" + lc_note "Found $LC_TOOLS_MODULE: registering the tools of AlphaFold2 for Napari, Fiji and QuPath" LC_APP_VERSION="$(sed -n 's/^version: *//p' "$PROJECT_ROOT/construct.yaml" 2>/dev/null | head -1 | tr -d "\"'\r" || true)" if [ -z "$LC_APP_VERSION" ]; then lc_note "WARNING: no version: line at the start of a line in construct.yaml - registering the tools with version 0." @@ -111,19 +111,19 @@ if [ -f "$PROJECT_ROOT/setup.py" ] && "$PYTHON_EXE" -c "import importlib.util, s # without a hosts: line (or with an invalid one) is answered by Tools, whose message goes to this log. LC_APP_MANIFEST="$PROJECT_ROOT/labconstrictor-app.yaml" LC_HOSTS_ARGS=() - LC_NO_HOSTS="'PROJECT_NAME' declares no hosts, so it is listed in every host; register it with --app-manifest (or --hosts) to choose" + LC_NO_HOSTS="'AlphaFold2' declares no hosts, so it is listed in every host; register it with --app-manifest (or --hosts) to choose" if [ ! -f "$LC_APP_MANIFEST" ]; then - lc_note "WARNING: $LC_APP_MANIFEST was not found (add labconstrictor-app.yaml to extra_files in construct.yaml), so PROJECT_NAME is registered without hosts. $LC_NO_HOSTS" + lc_note "WARNING: $LC_APP_MANIFEST was not found (add labconstrictor-app.yaml to extra_files in construct.yaml), so AlphaFold2 is registered without hosts. $LC_NO_HOSTS" else LC_HOSTS_ARGS=(--app-manifest "$LC_APP_MANIFEST") lc_note "Passing the hosts of $LC_APP_MANIFEST to Tools (--app-manifest); Tools logs the same sentence if the file declares no hosts." fi if [ "${LC_TOOLS_READY:-0}" = 1 ] \ - && "$PYTHON_EXE" -m labconstrictor_tools register --name "PROJECT_NAME" --prefix "$PREFIX" \ - --module "$LC_TOOLS_MODULE" --version "$LC_APP_VERSION" --display-name "PROJECT_NAME" ${LC_HOSTS_ARGS[@]+"${LC_HOSTS_ARGS[@]}"} >> "$LOG_FILE" 2>&1; then + && "$PYTHON_EXE" -m labconstrictor_tools register --name "AlphaFold2" --prefix "$PREFIX" \ + --module "$LC_TOOLS_MODULE" --version "$LC_APP_VERSION" --display-name "AlphaFold2" ${LC_HOSTS_ARGS[@]+"${LC_HOSTS_ARGS[@]}"} >> "$LOG_FILE" 2>&1; then lc_note "Tools registered (labconstrictor-tools list shows them)." else - lc_note "WARNING: tool registration failed - see the pip and register output above in this file; PROJECT_NAME itself is installed." + lc_note "WARNING: tool registration failed - see the pip and register output above in this file; AlphaFold2 itself is installed." fi fi @@ -143,7 +143,7 @@ fi echo "Launcher preflight completed successfully." >> "$LOG_FILE" "$PYTHON_EXE" -c "import os, sys; print('Python:', sys.executable); print('Prefix:', os.environ.get('PREFIX'))" >> "$LOG_FILE" 2>&1 -"$PYTHON_EXE" -c "from menuinst.api import install; import os; print(install(os.path.join('$PREFIX', 'PROJECT_NAME', 'notebook_launcher.json')))" >> "$LOG_FILE" 2>&1 +"$PYTHON_EXE" -c "from menuinst.api import install; import os; print(install(os.path.join('$PREFIX', 'AlphaFold2', 'notebook_launcher.json')))" >> "$LOG_FILE" 2>&1 echo "Post-install completed successfully." >> "$LOG_FILE" diff --git a/app/bash_bat_scripts/pre_uninstall.bat b/app/bash_bat_scripts/pre_uninstall.bat index 14cdff0..415028b 100644 --- a/app/bash_bat_scripts/pre_uninstall.bat +++ b/app/bash_bat_scripts/pre_uninstall.bat @@ -1,9 +1,9 @@ @ECHO ON echo Running pre-uninstall -"%PREFIX%\python.exe" -m labconstrictor_tools unregister --name "PROJECT_NAME" --prefix "%PREFIX%" >NUL 2>&1 -IF ERRORLEVEL 1 IF EXIST "%USERPROFILE%\.labconstrictor\apps\PROJECT_NAME.json" echo WARNING: could not remove PROJECT_NAME from the LabConstrictor tools list; if Napari or Fiji still list it, delete the files %USERPROFILE%\.labconstrictor\apps\PROJECT_NAME.json and PROJECT_NAME.schema.json. 1>&2 -"%PREFIX%\python.exe" -c "from menuinst.api import remove; import os; remove(os.path.join(r'%PREFIX%', 'PROJECT_NAME', 'notebook_launcher.json'))" -SET "ARP_KEY=HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\UNDERSCORED_PROJECT_NAME" +"%PREFIX%\python.exe" -m labconstrictor_tools unregister --name "AlphaFold2" --prefix "%PREFIX%" >NUL 2>&1 +IF ERRORLEVEL 1 IF EXIST "%USERPROFILE%\.labconstrictor\apps\AlphaFold2.json" echo WARNING: could not remove AlphaFold2 from the LabConstrictor tools list; if Napari or Fiji still list it, delete the files %USERPROFILE%\.labconstrictor\apps\AlphaFold2.json and AlphaFold2.schema.json. 1>&2 +"%PREFIX%\python.exe" -c "from menuinst.api import remove; import os; remove(os.path.join(r'%PREFIX%', 'AlphaFold2', 'notebook_launcher.json'))" +SET "ARP_KEY=HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\AlphaFold2" reg delete "%ARP_KEY%" /f >NUL 2>&1 echo Pre-uninstall completed! SetLocal EnableDelayedExpansion diff --git a/app/bash_bat_scripts/pre_uninstall.sh b/app/bash_bat_scripts/pre_uninstall.sh index d3c3c0c..ca53d64 100644 --- a/app/bash_bat_scripts/pre_uninstall.sh +++ b/app/bash_bat_scripts/pre_uninstall.sh @@ -2,10 +2,10 @@ set -e echo "Running pre_uninstall" # best effort: a failure must not stop the uninstall, but it is reported (a stale entry can stay in the Napari/Fiji list) -if ! "BASE_PATH/bin/python" -m labconstrictor_tools unregister --name "PROJECT_NAME" --prefix "BASE_PATH" > /dev/null 2>&1; then - LC_ENTRY="${LC_HOME:-$HOME/.labconstrictor}/apps/PROJECT_NAME" +if ! "BASE_PATH/bin/python" -m labconstrictor_tools unregister --name "AlphaFold2" --prefix "BASE_PATH" > /dev/null 2>&1; then + LC_ENTRY="${LC_HOME:-$HOME/.labconstrictor}/apps/AlphaFold2" if [ -e "$LC_ENTRY.json" ]; then - echo "WARNING: could not remove PROJECT_NAME from the LabConstrictor tools list; if Napari or Fiji still list it, delete the files $LC_ENTRY.json and $LC_ENTRY.schema.json." >&2 + echo "WARNING: could not remove AlphaFold2 from the LabConstrictor tools list; if Napari or Fiji still list it, delete the files $LC_ENTRY.json and $LC_ENTRY.schema.json." >&2 fi fi -"BASE_PATH/bin/python" -c "from menuinst.api import remove; import os; remove(os.path.join(r'BASE_PATH', 'PROJECT_NAME', 'notebook_launcher.json'))" +"BASE_PATH/bin/python" -c "from menuinst.api import remove; import os; remove(os.path.join(r'BASE_PATH', 'AlphaFold2', 'notebook_launcher.json'))" diff --git a/app/bash_bat_scripts/uninstall.sh b/app/bash_bat_scripts/uninstall.sh index cb6d153..8bb8b42 100644 --- a/app/bash_bat_scripts/uninstall.sh +++ b/app/bash_bat_scripts/uninstall.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash PREFIX="BASE_PATH" -echo "Uninstalling PROJECT_NAME from $PREFIX" +echo "Uninstalling AlphaFold2 from $PREFIX" if [ -f "$PREFIX/pre_uninstall.sh" ]; then # best effort: shortcut/registry cleanup must not stop the removal, but a failure must be visible if ! bash "$PREFIX/pre_uninstall.sh"; then @@ -8,11 +8,11 @@ if [ -f "$PREFIX/pre_uninstall.sh" ]; then fi fi if ! rm -rf -- "$PREFIX"; then - echo "ERROR: could not remove $PREFIX; PROJECT_NAME is only partly uninstalled. Close anything using it and delete that folder manually." >&2 + echo "ERROR: could not remove $PREFIX; AlphaFold2 is only partly uninstalled. Close anything using it and delete that folder manually." >&2 exit 1 fi -echo "PROJECT_NAME removed." +echo "AlphaFold2 removed." if [ -t 0 ]; then echo diff --git a/app/logo/ColabFold_Marv_Logo.icns b/app/logo/ColabFold_Marv_Logo.icns new file mode 100644 index 0000000..692e114 Binary files /dev/null and b/app/logo/ColabFold_Marv_Logo.icns differ diff --git a/app/logo/ColabFold_Marv_Logo.ico b/app/logo/ColabFold_Marv_Logo.ico new file mode 100644 index 0000000..945d85e Binary files /dev/null and b/app/logo/ColabFold_Marv_Logo.ico differ diff --git a/app/logo/ColabFold_Marv_Logo.png b/app/logo/ColabFold_Marv_Logo.png new file mode 100644 index 0000000..c459197 Binary files /dev/null and b/app/logo/ColabFold_Marv_Logo.png differ diff --git a/app/menuinst/notebook_launcher.json b/app/menuinst/notebook_launcher.json index fef18e0..9ef7e39 100644 --- a/app/menuinst/notebook_launcher.json +++ b/app/menuinst/notebook_launcher.json @@ -1,34 +1,34 @@ { "$schema": "https://schemas.conda.org/menuinst/menuinst-1-1-3.schema.json", - "menu_name": "PROJECT_NAME", + "menu_name": "AlphaFold2", "menu_items": [ { - "name": "PROJECT_NAME", - "description": "Launch PROJECT_NAME in its packaged JupyterLab environment.", + "name": "AlphaFold2", + "description": "Launch AlphaFold2 in its packaged JupyterLab environment.", "activate": true, "terminal": true, "working_dir": "{{ HOME }}", "command": [ "{{ PYTHON }}", - "{{ PREFIX }}/PROJECT_NAME/launch_jupyter.py", - "{{ PREFIX }}/PROJECT_NAME/notebooks/Welcome.ipynb" + "{{ PREFIX }}/AlphaFold2/launch_jupyter.py", + "{{ PREFIX }}/AlphaFold2/notebooks/Welcome.ipynb" ], "platforms": { "win": { - "icon": "ICON_ICO_IMAGE_PATH", + "icon": "BASE_PATH_KEYWORD/AlphaFold2/ColabFold_Marv_Logo.ico", "command": [ "{{ PYTHON }}", - "{{ PREFIX }}/PROJECT_NAME/launch_jupyter.py", - "{{ PREFIX }}/PROJECT_NAME/notebooks/Welcome.ipynb", + "{{ PREFIX }}/AlphaFold2/launch_jupyter.py", + "{{ PREFIX }}/AlphaFold2/notebooks/Welcome.ipynb", "&", "exit" ] }, "linux": { - "icon": "ICON_IMAGE_PATH" + "icon": "BASE_PATH_KEYWORD/AlphaFold2/ColabFold_Marv_Logo.png" }, "osx": { - "icon": "ICON_ICNS_IMAGE_PATH" + "icon": "BASE_PATH_KEYWORD/AlphaFold2/ColabFold_Marv_Logo.icns" } } } diff --git a/app/python_scripts/hide_code_cells.py b/app/python_scripts/hide_code_cells.py new file mode 100644 index 0000000..35524e1 --- /dev/null +++ b/app/python_scripts/hide_code_cells.py @@ -0,0 +1,104 @@ +"""Utility to hide code cells in Jupyter notebooks by updating metadata.""" +from __future__ import annotations + +import argparse +from pathlib import Path +from typing import Iterable + +import nbformat + +# Metadata values required to hide code cells in supported viewers. +CELL_VIEW_VALUE = "form" +COLLAPSED_VALUE = False +SOURCE_HIDDEN_VALUE = True + +# Placeholder for repository initialisiation that enables or disables this script. +DISABLED = False + + +def collect_notebooks(root: Path) -> Iterable[Path]: + """Yield every notebook under root (recursively for directories).""" + if root.is_file(): + if root.suffix == ".ipynb": + yield root + return + + for path in root.rglob("*.ipynb"): + if path.is_file(): + yield path + + +def hide_code_cells(notebook_path: Path) -> bool: + """Apply metadata updates to every code cell in the given notebook.""" + notebook = nbformat.read(notebook_path, as_version=nbformat.NO_CONVERT) + changed = False + + for cell in notebook.cells: + if cell.get("cell_type") != "code": + continue + + # Remove saved output + if cell.get("outputs"): + cell["outputs"] = [] + changed = True + if cell.get("execution_count") is not None: + cell["execution_count"] = None + changed = True + + metadata = cell.setdefault("metadata", {}) + + if metadata.get("cellView") != CELL_VIEW_VALUE: + metadata["cellView"] = CELL_VIEW_VALUE + changed = True + + if metadata.get("collapsed") != COLLAPSED_VALUE: + metadata["collapsed"] = COLLAPSED_VALUE + changed = True + + jupyter_meta = metadata.get("jupyter") if isinstance(metadata.get("jupyter"), dict) else {} + if jupyter_meta.get("source_hidden") != SOURCE_HIDDEN_VALUE: + jupyter_meta["source_hidden"] = SOURCE_HIDDEN_VALUE + metadata["jupyter"] = jupyter_meta + changed = True + + jupyterlab_meta = metadata.get("jupyterlabHideCode") if isinstance(metadata.get("jupyterlabHideCode"), dict) else {} + if jupyterlab_meta.get("locked") != True: + jupyterlab_meta["locked"] = True + metadata["jupyterlabHideCode"] = jupyterlab_meta + changed = True + + if changed: + nbformat.write(notebook, notebook_path) + + return changed + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description="Hide the code cells in notebooks under the given path.") + parser.add_argument("path", type=Path, help="File or directory to process for Jupyter notebooks") + return parser.parse_args() + + +def main() -> None: + args = parse_args() + notebooks = list(collect_notebooks(args.path)) + + if DISABLED: + print("Hiding code cells is disabled for this repository.") + print("To enable, set False to False in app/python_scripts/hide_code_cells.py") + print("or go to https://labconstrictor-form.streamlit.app/ and initialise your repository again but with hiding code cells enabled.") + return + + if not notebooks: + print("No notebooks found.") + return + + for notebook_path in notebooks: + if hide_code_cells(notebook_path): + print(f"Updated {notebook_path}") + else: + print(f"No changes needed for {notebook_path}") + + +if __name__ == "__main__": + main() diff --git a/app/python_scripts/launch_jupyter.py b/app/python_scripts/launch_jupyter.py index 693d1cf..df70cf6 100644 --- a/app/python_scripts/launch_jupyter.py +++ b/app/python_scripts/launch_jupyter.py @@ -1,4 +1,4 @@ -"""TLS-resilient JupyterLab launcher for PROJECT_NAME. +"""TLS-resilient JupyterLab launcher for AlphaFold2. Certificate handling is configured before JupyterLab imports Tornado. On Windows this prevents one malformed certificate-store entry from terminating @@ -22,7 +22,7 @@ from importlib import metadata from pathlib import Path -PROJECT_DISPLAY_NAME = "PROJECT_NAME" +PROJECT_DISPLAY_NAME = "AlphaFold2" SCRIPT_DIR = Path(__file__).resolve().parent _INSTALLED_LAYOUT = (SCRIPT_DIR / "notebooks").is_dir() if _INSTALLED_LAYOUT: diff --git a/construct.yaml b/construct.yaml index 872a552..b899224 100644 --- a/construct.yaml +++ b/construct.yaml @@ -1,36 +1,29 @@ -name: UNDERSCORED_PROJECT_NAME -version: VERSION_NUMBER - +name: AlphaFold2 +version: 0.0.1 environment_file: environment.yaml installer_type: all license_file: LICENSE - -welcome_image: WELCOME_IMAGE -header_image: HEADER_IMAGE -icon_image: ICON_IMAGE - -conclusion_text: 'Thank you! You have successfully installed PROJECT_NAME VERSION_NUMBER.' - +icon_image: app/logo/ColabFold_Marv_Logo.png +conclusion_text: Thank you! You have successfully installed AlphaFold2 0.0.1. keep_pkgs: false register_python: false initialize_conda: false - extra_files: - app/bash_bat_scripts/pre_uninstall.sh: pre_uninstall.sh - app/bash_bat_scripts/uninstall.sh: uninstall.sh -- app/menuinst/Welcome.ipynb: PROJECT_NAME/notebooks/Welcome.ipynb -- app/menuinst/notebook_launcher.json: PROJECT_NAME/notebook_launcher.json -- app/python_scripts/hide_code_cells.py: PROJECT_NAME/hide_code_cells.py -- app/python_scripts/include_path.py: PROJECT_NAME/include_path.py -- app/python_scripts/launch_jupyter.py: PROJECT_NAME/launch_jupyter.py -- notebooks/notebook_latest_versions.yaml: PROJECT_NAME/notebook_latest_versions.yaml -- requirements.txt: PROJECT_NAME/requirements.txt -- requirements_gpu.txt: PROJECT_NAME/requirements_gpu.txt -- construct.yaml: PROJECT_NAME/construct.yaml - +- app/logo/ColabFold_Marv_Logo.icns: AlphaFold2/ColabFold_Marv_Logo.icns +- app/logo/ColabFold_Marv_Logo.ico: AlphaFold2/ColabFold_Marv_Logo.ico +- app/logo/ColabFold_Marv_Logo.png: AlphaFold2/ColabFold_Marv_Logo.png +- app/menuinst/Welcome.ipynb: AlphaFold2/notebooks/Welcome.ipynb +- app/menuinst/notebook_launcher.json: AlphaFold2/notebook_launcher.json +- app/python_scripts/hide_code_cells.py: AlphaFold2/hide_code_cells.py +- app/python_scripts/include_path.py: AlphaFold2/include_path.py +- app/python_scripts/launch_jupyter.py: AlphaFold2/launch_jupyter.py +- construct.yaml: AlphaFold2/construct.yaml +- notebooks/notebook_latest_versions.yaml: AlphaFold2/notebook_latest_versions.yaml +- requirements.txt: AlphaFold2/requirements.txt +- requirements_gpu.txt: AlphaFold2/requirements_gpu.txt post_install: app/bash_bat_scripts/post_install.bat # [win] post_install: app/bash_bat_scripts/post_install.sh # [unix] - pre_uninstall: app/bash_bat_scripts/pre_uninstall.bat # [win] pre_uninstall: app/bash_bat_scripts/pre_uninstall.sh # [unix] - diff --git a/environment.yaml b/environment.yaml index 93b9e12..ef620ce 100644 --- a/environment.yaml +++ b/environment.yaml @@ -1,4 +1,4 @@ -name: LOWER_PROJ_NAME +name: alphafold2 channels: - conda-forge - bioconda diff --git a/labconstrictor-app.yaml b/labconstrictor-app.yaml new file mode 100644 index 0000000..2d5b675 --- /dev/null +++ b/labconstrictor-app.yaml @@ -0,0 +1,10 @@ +# yaml-language-server: $schema=https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-app.schema.json +schema: 1 +name: AlphaFold2 +summary: Easy to use protein structure and complex prediction using AlphaFold2 and Alphafold2-multimer. +kind: simulation +hosts: +- notebook +distribution: + installer: true +icon: app/logo/ColabFold_Marv_Logo.png diff --git a/setup.py b/setup.py index ac5f8f4..622ae18 100644 --- a/setup.py +++ b/setup.py @@ -45,8 +45,8 @@ def read_readme(): REPOSITORY = os.environ.get("GITHUB_REPOSITORY") setup( - name="PYTHON_PROJ_NAME", - version="VERSION_NUMBER", + name="alphafold2", + version="0.0.1", long_description=read_readme(), long_description_content_type="text/markdown", project_urls={"Source": f"https://github.com/{REPOSITORY}"} if REPOSITORY else {}, diff --git a/src/alphafold2/__init__.py b/src/alphafold2/__init__.py new file mode 100644 index 0000000..e69de29