Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into add-two-step-classifier
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-charlotte committed Jan 20, 2025
2 parents fdf62db + 26ef0dc commit 1c8157f
Show file tree
Hide file tree
Showing 32 changed files with 283 additions and 177 deletions.
61 changes: 61 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[tool.bumpversion]
current_version = "1.9.3-dev0"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_l>[a-zA-Z-]+) # pre_l: pre-release label
(?P<pre_n>0|[1-9]\\d*) # pre_n: pre-release version number
)? # pre-release section is optional
"""
serialize = [
"{major}.{minor}.{patch}-{pre_l}{pre_n}",
"{major}.{minor}.{patch}",
]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = false
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = true
message = "Bump version: {current_version} → {new_version}"
commit_args = ""
setup_hooks = []
pre_commit_hooks = []
post_commit_hooks = []

[tool.bumpversion.parts.pre_l]
# 'final' is just a dummy, but required to have the versioning compatible with the reusable alphashared workflow
values = ["dev", "final"]
optional_value = "final"

[[tool.bumpversion.files]]
filename = "./alphadia/__init__.py"

[[tool.bumpversion.files]]
filename = "./gui/src/main/modules/profile.js"

[[tool.bumpversion.files]]
filename = "./gui/package.json"

[[tool.bumpversion.files]]
filename = "./release/macos/info.plist"

[[tool.bumpversion.files]]
filename = "./release/linux/control"

[[tool.bumpversion.files]]
filename = "./release/macos/build_package_macos.sh"

[[tool.bumpversion.files]]
filename = "./release/macos/distribution.xml"

[[tool.bumpversion.files]]
filename = "./release/windows/alphadia_innoinstaller.iss"
2 changes: 1 addition & 1 deletion .github/workflows/branch-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
install-script: ./pip_install.sh stable,test
install-script: ./pip_install.sh stable,tests
test-script: ./run_unit_tests.sh

get-code-review-input:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Bump the version for releases
# Requires a .bumpversion.toml file in the root of the repository
name: Bump version

on:
workflow_dispatch:
inputs:
bump_type:
description: 'Bump type'
required: true
default: 'patch'
type: choice
options:
- prerelease
- patch
- minor
- major

jobs:
bump-version:
uses: MannLabs/alphashared/.github/workflows/bump_version.yml@v1
secrets: inherit
with:
bump_type: ${{inputs.bump_type}}
64 changes: 49 additions & 15 deletions .github/workflows/e2e_testing.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
name: End to end testing

on:
pull_request:
types: [ labeled ]
push:
branches: [ main, development ]
# push:
# branches: [ main ]
schedule:
- cron: "0 0 * * *" # daily on 12:00 AM
workflow_dispatch:

name: End to end testing
inputs:
test_case:
description: 'Test case to run (see e2e_test_cases.yaml for available cases), "all" to run all test cases.'
required: false
default: 'all'
commitish_to_test:
type: string
description: 'Enter commit hash or branch to test (default: main).'
default: "main"

jobs:
end2end_testing:
name: End to end test
runs-on: self-hosted
parse_inputs:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'test:e2e') || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
outputs:
test_cases: ${{ steps.parse-test-cases.outputs.test_cases }}
commitish_to_test: ${{ steps.parse-commitish-to-test.outputs.commitish_to_test }}
steps:
- id: parse-test-cases
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.test_case }}" != "all" ]; then
echo "test_cases=[\"${{ github.event.inputs.test_case }}\"]" >> $GITHUB_OUTPUT
else
# NEW TEST CASES ARE ADDED HERE:
echo 'test_cases=["basic", "synchropasef", "astral", "astral_automatic_calibration", "multistep"]' >> $GITHUB_OUTPUT
fi
- id: parse-commitish-to-test
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "commitish_to_test=[\"${{ github.event.inputs.commitish_to_test }}\"]" >> $GITHUB_OUTPUT
else
echo "commitish_to_test=main" >> $GITHUB_OUTPUT
fi
end2end_tests:
name: End to end tests
needs: parse_inputs
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
# test case name as defined in e2e_test_cases.yaml
test_case: [ "basic", "synchropasef", "astral", "astral_automatic_calibration", "multistep"]
test_case: ${{ fromJson(needs.parse_inputs.outputs.test_cases) }}
env:
RUN_NAME: alphadia-${{github.sha}}-${{github.run_id}}-${{github.run_attempt}}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
Expand All @@ -28,23 +62,23 @@ jobs:
TQDM_MININTERVAL: 10 # avoid lots of tqdm outputs
steps:
- uses: actions/checkout@v4
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Pip installation with stable dependencies
with:
ref: ${{ needs.parse_inputs.outputs.commitish_to_test }}
- name: Pip installation (stable)
id: pip_installation
shell: bash -el {0}
run: |
conda info
cd misc
. ./pip_install.sh stable $RUN_NAME
- name: Run e2e tests
shell: bash -el {0}
run: |
cd tests
. ./run_e2e_tests.sh ${{ matrix.test_case }} $RUN_NAME True ${GITHUB_SHA::7} $BRANCH_NAME
. ./run_e2e_tests.sh ${{ matrix.test_case }} $RUN_NAME True ${GITHUB_SHA::7} $BRANCH_NAME
- name: Cleanup
if: always()
shell: bash -el {0}
shell: bash -l {0}
run: |
conda remove -n $RUN_NAME --all -y
- name: Delete Caches on Error
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/fdr_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
pull_request:
types: [ labeled ]
push:
branches: [ main, development ]
branches: [ main ]
workflow_dispatch:

name: FDR performance test
Expand All @@ -19,8 +19,8 @@ jobs:
env: # Or as an environment variable
NEPTUNE_API_TOKEN: ${{ secrets.NEPTUNE_FDR_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.11
Expand All @@ -31,11 +31,11 @@ jobs:
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Pip installation with all loose dependencies
- name: Pip installation (stable)
shell: bash -l {0}
run: |
cd misc
. ./pip_install.sh stable,test
. ./pip_install.sh stable,tests alphadia 3.11 true
- name: Run legacy classifier
env: # Or as an environment variable
NEPTUNE_API_TOKEN: ${{ secrets.NEPTUNE_FDR_TOKEN }}
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/performance_testing.yml

This file was deleted.

17 changes: 8 additions & 9 deletions .github/workflows/pip_installation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Perform pip installation (stable, loose) and run tests on all three OS

# For feature branches, we don't test the full matrix (os x [stable, loose]) in order to save time & resources.
# On each push to develop, the whole test matrix runs, additionally, its success is mandatory for merging to main.
# On each push to main, the whole test matrix runs.
# In the (assumed to be rare case) that these full matrix tests fail but the reduced matrix tests passed,
# we will learn about it latest before pushing to main. The merge that caused the issue can then be identified
# from the tests that ran on develop.
# we will learn about it latest after pushing to main.

on:
push:
branches: [ main, development ]
pull_request:
branches: [ main ]
workflow_dispatch:

Expand All @@ -23,25 +20,27 @@ jobs:
run-unit-tests-stable:
name: Test 'stable' on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
uses: ./.github/workflows/_run_tests.yml
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
install-script: ./pip_install.sh stable,test
test-script: ./run_unit_tests.sh
install-script: ./pip_install.sh stable,tests
test-script: ./run_unit_tests.sh true

run-unit-tests-loose:
name: Test 'loose' on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, windows-latest ]
python-version: ["3.10", "3.11", "3.12"]
uses: ./.github/workflows/_run_tests.yml
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
install-script: ./pip_install.sh test
test-script: ./run_unit_tests.sh
install-script: ./pip_install.sh tests
test-script: ./run_unit_tests.sh true
1 change: 1 addition & 0 deletions .github/workflows/publish_on_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
# see the documentation of the workflow for more information on the parameters
package_name: alphadia
tag_to_release: ${{ inputs.tag_to_release }}
test_stable: true
secrets:
test_pypi_api_token: ${{ secrets.TEST_PYPI_API_TOKEN }}
pypi_api_token: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ repos:
- id: ruff-format
- id: ruff
args: [ '--fix' ]

exclude: .bumpversion.cfg
5 changes: 4 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ sphinx:
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: requirements/requirements_docs.txt
- method: pip
path: .
extra_requirements:
- docs
2 changes: 1 addition & 1 deletion alphadia/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!python

__version__ = "1.9.2"
__version__ = "1.9.3-dev0"
2 changes: 1 addition & 1 deletion alphadia/search_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _init_config(

config.update(config_updates, do_print=True)

if ConfigKeys.OUTPUT_DIRECTORY not in config:
if config.get(ConfigKeys.OUTPUT_DIRECTORY, None) is None:
config[ConfigKeys.OUTPUT_DIRECTORY] = output_folder

config.to_yaml(os.path.join(output_folder, "frozen_config.yaml"))
Expand Down
5 changes: 4 additions & 1 deletion alphadia/workflow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import yaml

from alphadia.constants.keys import ConfigKeys
from alphadia.exceptions import KeyAddedConfigError, TypeMismatchConfigError

logger = logging.getLogger()
Expand Down Expand Up @@ -51,7 +52,9 @@ def to_json(self, path: str) -> None:
json.dump(self.data, f)

def __setitem__(self, key, item):
raise NotImplementedError("Use update() to update the config.")
if key != ConfigKeys.OUTPUT_DIRECTORY:
raise NotImplementedError("Use update() to update the config.")
return super().__setitem__(key, item)

def __delitem__(self, key):
raise NotImplementedError("Use update() to update the config.")
Expand Down
12 changes: 4 additions & 8 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,14 @@ See also the [developer guide](developer_guide.md) for more information on how t

### 1. Setting up the repository

Navigate to a folder where you would like to install alphaDIA and
download the alphaDIA repository. This creates a subfolder `alphadia` in your current directory
Navigate to a folder where you would like to set up the repository and execute
```bash
cd ~/work/search_engines
git clone [email protected]:MannLabs/alphadia.git
cd alphadia
git clone [email protected]:MannLabs/alphadia.git && cd alphadia
```

Optionally, to get the latest features, switch to the `development` branch and pull the most recent version
Optionally, get the code version of the latest tag (corresponding to the latest (pre)release):
```bash
git switch development
git pull
git fetch --tags && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
```

### 2. Installation: backend
Expand Down
2 changes: 1 addition & 1 deletion gui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alphadia",
"productName": "alphadia-gui",
"version": "1.9.2",
"version": "1.9.3-dev0",
"description": "Graphical user interface for DIA data analysis",
"main": "dist/electron.js",
"homepage": "./",
Expand Down
Loading

0 comments on commit 1c8157f

Please sign in to comment.