From a712348329ee7050a07114e3d380d3ba98e36688 Mon Sep 17 00:00:00 2001 From: Martin Salinas Date: Mon, 5 Aug 2024 11:22:45 +0200 Subject: [PATCH 1/3] Extra spaces --- protox/__init__.py | 3 --- protox/constants.py | 2 -- protox/protocols/protocol_protox.py | 15 --------------- protox/viewers/viewers_protox.py | 2 -- requirements.txt | 1 - 5 files changed, 23 deletions(-) diff --git a/protox/__init__.py b/protox/__init__.py index 33205cf..0902139 100755 --- a/protox/__init__.py +++ b/protox/__init__.py @@ -69,6 +69,3 @@ def getPluginH(cls, path=""): @classmethod def getScriptsPath(cls): return cls.getPluginH('scripts/') - - - diff --git a/protox/constants.py b/protox/constants.py index 04f5519..d6091e0 100755 --- a/protox/constants.py +++ b/protox/constants.py @@ -28,5 +28,3 @@ # Version constants V1_0 = '1.0' PLUGIN_VERSION = '0.1' - -# Package dictionaries diff --git a/protox/protocols/protocol_protox.py b/protox/protocols/protocol_protox.py index 22c0fec..1849caf 100644 --- a/protox/protocols/protocol_protox.py +++ b/protox/protocols/protocol_protox.py @@ -4,7 +4,6 @@ import os from urllib.request import urlopen - # Specific imports from pyworkflow.protocol.params import PointerParam, EnumParam from pwem.protocols import EMProtocol @@ -15,7 +14,6 @@ import pandas as pd from pwchem.constants import RDKIT_DIC - class ProtChemProtox(EMProtocol): """Toxicity prediction of small ligands with Protox""" @@ -157,16 +155,3 @@ def getMainNameFromCID(self,cid): main_name = None return main_name - - - - - - - - - - - - - diff --git a/protox/viewers/viewers_protox.py b/protox/viewers/viewers_protox.py index 1e0af3e..fd14435 100644 --- a/protox/viewers/viewers_protox.py +++ b/protox/viewers/viewers_protox.py @@ -72,5 +72,3 @@ def save_html_file(self, html_content): f.write(html_content) webbrowser.open('file://' + os.path.realpath(html_path)) - - diff --git a/requirements.txt b/requirements.txt index ced83e0..efef8c1 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ scipion-pyworkflow scipion-em scipion-chem - From 6b993619faa20a9bc8df3cd34c625fa0e7a47063 Mon Sep 17 00:00:00 2001 From: Martin Salinas Date: Mon, 5 Aug 2024 11:26:20 +0200 Subject: [PATCH 2/3] Added CI/CD pipelines --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4fd3346 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build plugin on Pull Request +on: + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Free Disk Space (Ubuntu only) + uses: jlumbroso/free-disk-space@main + + - name: Set up MPI + uses: mpi4py/setup-mpi@master + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y wget gcc-10 g++-10 make + + - name: Install Miniconda + uses: conda-incubator/setup-miniconda@main + with: + miniconda-version: "latest" + auto-update-conda: true + auto-activate-base: true + activate-environment: scipion3 + python-version: "3.8" + + - name: Install Scipion + working-directory: ${{ github.workspace }}/../ + run: | + pip cache purge + pip install --user scipion-installer + python3 -m scipioninstaller -conda -noXmipp -noAsk scipion + + - name: Checkout repository + uses: actions/checkout@main + with: + ref: ${{ github.head_ref }} + + - name: Install plugin from pull request + working-directory: ${{ github.workspace }} + run: | + pip cache purge + ../scipion/scipion3 installp -p . --devel diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e901078 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Generate release (Pypi, tag, & GitHub Release) +on: workflow_dispatch + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@main + + - name: Set up MPI + uses: mpi4py/setup-mpi@master + + - name: Set up Python + uses: actions/setup-python@main + with: + python-version: '3.10' + + - name: Install dependencies + run: | + pip install setuptools wheel twine + pip install -r requirements.txt + + - name: Get tag name + id: variables + env: + FOLDER_WITH_VERSION: ${{ vars.FOLDER_WITH_VERSION }} + run: | + VERSION=$(python -c "import $FOLDER_WITH_VERSION; print('VERSION', 'v'+$FOLDER_WITH_VERSION.__version__)" | grep VERSION | sed "s/VERSION //g") || (echo "Could not import version, check that variables are correctly set!" && exit 1) + echo "TAG_NAME=${VERSION#v}" >> $GITHUB_OUTPUT + echo "TAG NAME (must not contain version prefix): ${VERSION#v}" + + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist + twine upload dist/* -c "${{ secrets.PYPI_COMMENT }}" + + - name: Generate tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ steps.variables.outputs.TAG_NAME }} + + - name: Create a GitHub release + uses: ncipollo/release-action@main + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: ${{ steps.variables.outputs.TAG_NAME }} From c049e54adf95894fa9ef870f0b790ef457f25021 Mon Sep 17 00:00:00 2001 From: Martin Salinas Date: Mon, 5 Aug 2024 11:34:35 +0200 Subject: [PATCH 3/3] Add scipion-chem --- .github/workflows/build.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fd3346..5e9e36b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,20 @@ jobs: pip install --user scipion-installer python3 -m scipioninstaller -conda -noXmipp -noAsk scipion + # Installing scipion-chem + # Checkout to Pull Request branch if exists, by default stays in devel + - name: Install scipion-chem (in branch ${{ github.head_ref }} if exists) + working-directory: ${{ github.workspace }}/../ + env: + REPO_NAME: scipion-chem + BRANCH_NAME: ${{ github.head_ref }} + run: | + git clone https://github.com/scipion-chem/$REPO_NAME.git + if [ $(git ls-remote --heads https://github.com/scipion-chem/$REPO_NAME.git $BRANCH_NAME | wc -l) -eq 1 ]; then + cd $REPO_NAME && git checkout $BRANCH_NAME && cd - + fi + scipion/scipion3 installp -p $REPO_NAME --devel + - name: Checkout repository uses: actions/checkout@main with: