diff --git a/.github/workflows/_run_tests.yml b/.github/workflows/_run_tests.yml index 199c09f..1271ed4 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,18 +32,16 @@ jobs: - name: Conda info shell: bash -l {0} run: conda info - - name: Perform pip installation + - name: Install mono + if: ${{ !contains(inputs.os, 'windows') }} shell: bash -l {0} run: | - cd misc - . ./${{ inputs.install-script }} - - name: Install additional dependencies required for testing + conda install mono + - name: Perform pip installation shell: bash -l {0} run: | - conda activate alpharaw - pip install matplotlib - pip install pytest nbmake==1.5.3 - conda deactivate + cd misc + . ./${{ inputs.install-script }} alpharaw ${{ inputs.python-version }} ${{ !contains(inputs.os, 'windows') }} - name: Run tests shell: bash -l {0} run: | diff --git a/.github/workflows/branch-checks.yaml b/.github/workflows/branch-checks.yaml index 0d1c2bb..3029e44 100644 --- a/.github/workflows/branch-checks.yaml +++ b/.github/workflows/branch-checks.yaml @@ -18,8 +18,9 @@ jobs: strategy: matrix: os: [ubuntu-latest] + python-version: [3.9] uses: ./.github/workflows/_run_tests.yml with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} - install-script: "loose_pip_install.sh" + install-script: pip_install.sh loose,tests 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/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/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/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..132a2f0 --- /dev/null +++ b/extra_requirements/tests.txt @@ -0,0 +1,5 @@ +matplotlib +seaborn +pytest +nbmake==1.5.3 +requests 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/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 diff --git a/tests/run_tests.sh b/tests/run_tests.sh old mode 100644 new mode 100755 index c383dfc..a00bcb5 --- 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