From 578891deda589eafebe31126dab80a0302740801 Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:50:06 +0100 Subject: [PATCH 1/5] adapt to new alphabase --- docs/tutorials/ms_methods.ipynb | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/ms_methods.ipynb b/docs/tutorials/ms_methods.ipynb index 10065a4..346cfd0 100644 --- a/docs/tutorials/ms_methods.ipynb +++ b/docs/tutorials/ms_methods.ipynb @@ -23,7 +23,7 @@ "\n", "from alpharaw import thermo\n", "import tempfile\n", - "from alphabase.test_data_downloader import DataShareDownloader\n", + "from alphabase.tools.data_downloader import DataShareDownloader\n", "import os\n", "import pandas as pd\n", "import numpy as np\n", diff --git a/requirements.txt b/requirements.txt index 688d120..090c50b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ sqlalchemy pyteomics lxml -alphabase>=1.1.0 +alphabase>=1.5.0 alphatims plotly From 74dfc58cd6bbc2a66753c7d6f02ca91fad163ed6 Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:59:18 +0100 Subject: [PATCH 2/5] fix tests --- .github/workflows/_run_tests.yml | 9 ++++++-- .github/workflows/branch-checks.yaml | 2 +- .github/workflows/pip_installation.yml | 4 ++-- misc/loose_pip_install.sh | 5 ----- misc/pip_install.sh | 31 ++++++++++++++++++++++++++ misc/stable_pip_install.sh | 5 ----- tests/run_tests.sh | 0 7 files changed, 41 insertions(+), 15 deletions(-) delete mode 100644 misc/loose_pip_install.sh create mode 100644 misc/pip_install.sh delete mode 100644 misc/stable_pip_install.sh mode change 100644 => 100755 tests/run_tests.sh diff --git a/.github/workflows/_run_tests.yml b/.github/workflows/_run_tests.yml index 199c09f..2121913 100644 --- a/.github/workflows/_run_tests.yml +++ b/.github/workflows/_run_tests.yml @@ -14,7 +14,7 @@ on: required: true type: string jobs: - pre-commit: + run-tests: runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v3 @@ -32,11 +32,16 @@ jobs: - name: Conda info shell: bash -l {0} run: conda info + - name: Install mono + if: ${{ !contains(inputs.os, 'windows') }} + shell: bash -l {0} + run: | + conda install mono - name: Perform pip installation shell: bash -l {0} run: | cd misc - . ./${{ inputs.install-script }} + . ./${{ inputs.install-script }} alpharaw ${{ inputs.python-version }} ${{ !contains(inputs.os, 'windows') }} - name: Install additional dependencies required for testing shell: bash -l {0} run: | diff --git a/.github/workflows/branch-checks.yaml b/.github/workflows/branch-checks.yaml index 0d1c2bb..50a38c6 100644 --- a/.github/workflows/branch-checks.yaml +++ b/.github/workflows/branch-checks.yaml @@ -22,4 +22,4 @@ jobs: with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} - install-script: "loose_pip_install.sh" + install-script: pip_install.sh loose diff --git a/.github/workflows/pip_installation.yml b/.github/workflows/pip_installation.yml index 0edff52..5eba6b0 100644 --- a/.github/workflows/pip_installation.yml +++ b/.github/workflows/pip_installation.yml @@ -25,7 +25,7 @@ jobs: with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} - install-script: "stable_pip_install.sh" + install-script: pip_install.sh stable loose_installation: name: Test loose pip installation on ${{ matrix.os }} @@ -37,4 +37,4 @@ jobs: with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} - install-script: "loose_pip_install.sh" + install-script: pip_install.sh loose diff --git a/misc/loose_pip_install.sh b/misc/loose_pip_install.sh deleted file mode 100644 index e230aba..0000000 --- a/misc/loose_pip_install.sh +++ /dev/null @@ -1,5 +0,0 @@ -conda create -n alpharaw python=3.9 -y -conda activate alpharaw -pip install -e '../.[development]' -python -c "import alpharaw" -conda deactivate diff --git a/misc/pip_install.sh b/misc/pip_install.sh new file mode 100644 index 0000000..bc25a46 --- /dev/null +++ b/misc/pip_install.sh @@ -0,0 +1,31 @@ +#!/bin/bash +### Install the package with a given type in a defined conda environment with a define python version, +### and call it to check if it works +### example usage: +### ./pip_install.sh stable my_env 3.9 +set -e -u + +INSTALL_TYPE=$1 # stable, loose, etc.. +ENV_NAME=${2:-alpharaw} +PYTHON_VERSION=${3:-3.9} +INSTALL_MONO=${4:-false} + + +if [ "$INSTALL_MONO" = "true" ]; then + conda create -n $ENV_NAME python=$PYTHON_VERSION mono -y +else + conda create -n $ENV_NAME python=$PYTHON_VERSION -y +fi + +if [ "$INSTALL_TYPE" = "loose" ]; then + INSTALL_STRING="" +else + INSTALL_STRING="[${INSTALL_TYPE}]" +fi + +# print pip environment for reproducibility +conda run -n $ENV_NAME --no-capture-output pip freeze + +# conda 'run' vs. 'activate', cf. https://stackoverflow.com/a/72395091 +conda run -n $ENV_NAME --no-capture-output pip install -e "../.$INSTALL_STRING" +conda run -n $ENV_NAME --no-capture-output python -c "import alpharaw" diff --git a/misc/stable_pip_install.sh b/misc/stable_pip_install.sh deleted file mode 100644 index c206240..0000000 --- a/misc/stable_pip_install.sh +++ /dev/null @@ -1,5 +0,0 @@ -conda create -n alpharaw python=3.9 -y -conda activate alpharaw -pip install -e '../.[stable,development-stable]' -python -c "import alpharaw" -conda deactivate diff --git a/tests/run_tests.sh b/tests/run_tests.sh old mode 100644 new mode 100755 From a272e7e9ed90a8018e11e47a49442d4c6fa5e1db Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:02:54 +0100 Subject: [PATCH 3/5] fix tests --- .github/workflows/branch-checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/branch-checks.yaml b/.github/workflows/branch-checks.yaml index 50a38c6..1f985fa 100644 --- a/.github/workflows/branch-checks.yaml +++ b/.github/workflows/branch-checks.yaml @@ -18,6 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] + python-version: [3.9] uses: ./.github/workflows/_run_tests.yml with: python-version: ${{ matrix.python-version }} From 1ddb2754d8b2890c3cdb7f7b3ae232535ed269fe Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:52:27 +0100 Subject: [PATCH 4/5] fix tests --- .github/workflows/_run_tests.yml | 7 ------- .github/workflows/branch-checks.yaml | 2 +- alpharaw/__init__.py | 1 + extra_requirements/development.txt | 13 ------------- extra_requirements/tests.txt | 4 ++++ 5 files changed, 6 insertions(+), 21 deletions(-) create mode 100644 extra_requirements/tests.txt diff --git a/.github/workflows/_run_tests.yml b/.github/workflows/_run_tests.yml index 2121913..1271ed4 100644 --- a/.github/workflows/_run_tests.yml +++ b/.github/workflows/_run_tests.yml @@ -42,13 +42,6 @@ jobs: run: | cd misc . ./${{ inputs.install-script }} alpharaw ${{ inputs.python-version }} ${{ !contains(inputs.os, 'windows') }} - - name: Install additional dependencies required for testing - shell: bash -l {0} - run: | - conda activate alpharaw - pip install matplotlib - pip install pytest nbmake==1.5.3 - conda deactivate - name: Run tests shell: bash -l {0} run: | diff --git a/.github/workflows/branch-checks.yaml b/.github/workflows/branch-checks.yaml index 1f985fa..3029e44 100644 --- a/.github/workflows/branch-checks.yaml +++ b/.github/workflows/branch-checks.yaml @@ -23,4 +23,4 @@ jobs: with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} - install-script: pip_install.sh loose + install-script: pip_install.sh loose,tests diff --git a/alpharaw/__init__.py b/alpharaw/__init__.py index 03caef5..6505175 100644 --- a/alpharaw/__init__.py +++ b/alpharaw/__init__.py @@ -67,4 +67,5 @@ def register_all_readers(): ] __extra_requirements__ = { "development": "extra_requirements/development.txt", + "tests": "extra_requirements/tests.txt", } diff --git a/extra_requirements/development.txt b/extra_requirements/development.txt index 6b8c7e8..534f813 100644 --- a/extra_requirements/development.txt +++ b/extra_requirements/development.txt @@ -1,17 +1,9 @@ -pywin32; sys_platform=='win32' -pythonnet; sys_platform=='win32' - jupyter -twine bumpversion pipdeptree ipykernel tqdm psutil -h5py -numba -pandas -numpy # sphinx autodocsumm @@ -22,9 +14,4 @@ jinja2 contextfilter furo -alphabase>=1.1.0 -alphatims - -pytest pre-commit==3.7.0 -nbmake==1.5.3 diff --git a/extra_requirements/tests.txt b/extra_requirements/tests.txt new file mode 100644 index 0000000..ccd0b8a --- /dev/null +++ b/extra_requirements/tests.txt @@ -0,0 +1,4 @@ +matplotlib +pytest +nbmake==1.5.3 +requests From 9ccd991883aeac37cd506b2a6a676876d73411ad Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:07:31 +0100 Subject: [PATCH 5/5] fix tests --- extra_requirements/tests.txt | 1 + tests/run_tests.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extra_requirements/tests.txt b/extra_requirements/tests.txt index ccd0b8a..132a2f0 100644 --- a/extra_requirements/tests.txt +++ b/extra_requirements/tests.txt @@ -1,4 +1,5 @@ matplotlib +seaborn pytest nbmake==1.5.3 requests diff --git a/tests/run_tests.sh b/tests/run_tests.sh index c383dfc..a00bcb5 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -3,4 +3,4 @@ TUTORIAL_NBS=$(find ../docs/tutorials -name "*.ipynb") ALL_NBS=$(echo $TEST_NBS$'\n'$TUTORIAL_NBS) -python -m pytest --nbmake $(echo $ALL_NBS) +python -m pytest --nbmake $(echo $ALL_NBS) --nbmake-timeout=1800