Skip to content

Commit 876e4ca

Browse files
authored
Merge pull request #236 from CompOmics/v3.2.0-release
Various fixes and improvements for v3.2.0
2 parents e7bd07e + aa572ea commit 876e4ca

File tree

23 files changed

+5877
-115
lines changed

23 files changed

+5877
-115
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,26 @@ jobs:
99
python-package:
1010
runs-on: ubuntu-latest
1111
permissions:
12-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
12+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Set up Python
17-
uses: actions/setup-python@v5
16+
- name: Install uv and set the Python version
17+
uses: astral-sh/setup-uv@v6
1818
with:
1919
python-version: "3.11"
20+
enable-cache: true
2021

21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
python -m pip install --upgrade build pytest
22+
- name: Install the project
23+
run: uv sync --all-extras --dev
2524

2625
- name: Build source and wheel
27-
run: |
28-
python -m build --sdist --wheel --outdir dist/
26+
run: uv build --sdist --wheel --out-dir dist/
2927

3028
- name: Test built package
3129
run: |
32-
pip install --only-binary :all: dist/ms2rescore-*.whl
33-
# pytest
34-
ms2rescore --help
30+
uv run pip install --only-binary :all: dist/ms2rescore-*.whl
31+
uv run ms2rescore --help
3532
3633
- name: Upload build artifacts
3734
uses: actions/upload-artifact@v4
@@ -53,6 +50,7 @@ jobs:
5350

5451
- name: Install package and dependencies
5552
run: |
53+
# Using pip to ensure proper environment discovery by PyInstaller
5654
python -m pip install --upgrade pip
5755
pip install --only-binary :all: .[ionmob] pyinstaller
5856

.github/workflows/test.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,40 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
check-python-package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
19+
- name: Run Ruff
20+
run: uvx ruff check --output-format=github .
21+
1122
test-python-package:
23+
needs: check-python-package
1224
runs-on: ubuntu-latest
1325
strategy:
1426
matrix:
1527
python-version: ["3.9", "3.10", "3.11"]
1628
steps:
1729
- uses: actions/checkout@v4
1830

19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v5
31+
- name: Install uv and set the Python version
32+
uses: astral-sh/setup-uv@v6
2133
with:
2234
python-version: ${{ matrix.python-version }}
35+
enable-cache: true
2336

24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install ruff
28-
29-
- name: Run Ruff
30-
run: ruff check --output-format=github .
37+
- name: Install the project
38+
run: uv sync --all-extras --dev
3139

32-
- name: Build and install ms2rescore package
33-
run: |
34-
pip install --only-binary :all: .[dev]
35-
36-
- name: Test with pytest
37-
run: |
38-
pytest
40+
- name: Run tests
41+
run: uv run pytest
3942

4043
- name: Test installation
41-
run: |
42-
ms2rescore --help
44+
run: uv run ms2rescore --help
4345

4446
test-windows-installer:
4547
# Only run on push to main (e.g., after PR merge)
@@ -54,6 +56,7 @@ jobs:
5456

5557
- name: Install package and dependencies
5658
run: |
59+
# Using pip to ensure proper environment discovery by PyInstaller
5760
python -m pip install --upgrade pip
5861
pip install --only-binary :all: .[ionmob] pyinstaller
5962

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ repos:
1616
args: ["--output-format", "json"]
1717

1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v2.3.0
19+
rev: v4.6.0
2020
hooks:
2121
- id: check-yaml
2222
- id: trailing-whitespace
2323
# - id: end-of-file-fixer
2424

2525
# - repo: https://github.com/pycqa/isort
26-
# rev: 5.11.2
26+
# rev: 5.13.2
2727
# hooks:
2828
# - id: isort
2929
# name: isort (python)
3030

3131
- repo: https://github.com/psf/black
32-
rev: 22.10.0
32+
rev: 24.8.0
3333
hooks:
3434
- id: black

Dockerfile

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
1-
FROM python:3.11
2-
3-
# ARG DEBIAN_FRONTEND=noninteractive
1+
FROM ghcr.io/astral-sh/uv:python3.12-trixie-slim
42

53
LABEL name="ms2rescore"
64

7-
# ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/ms2rescore
5+
# Setup a non-root user
6+
RUN groupadd --system --gid 999 nonroot \
7+
&& useradd --system --gid 999 --uid 999 --create-home nonroot
8+
9+
# Install the project into `/ms2rescore`
10+
WORKDIR /ms2rescore
11+
12+
# Enable bytecode compilation
13+
ENV UV_COMPILE_BYTECODE=1
14+
15+
# Copy from the cache instead of linking since it's a mounted volume
16+
ENV UV_LINK_MODE=copy
817

18+
# Ensure installed tools can be executed out of the box
19+
ENV UV_TOOL_BIN_DIR=/usr/local/bin
20+
21+
RUN apt-get update && apt-get install -y procps
22+
23+
# Then, add the rest of the project source code and install it
24+
# Installing separately from its dependencies allows optimal layer caching
925
ADD pyproject.toml /ms2rescore/pyproject.toml
1026
ADD LICENSE /ms2rescore/LICENSE
1127
ADD README.md /ms2rescore/README.md
1228
ADD MANIFEST.in /ms2rescore/MANIFEST.in
29+
ADD uv.lock /ms2rescore/uv.lock
1330
ADD ms2rescore /ms2rescore/ms2rescore
1431

15-
RUN apt-get update \
16-
&& apt install -y procps \
17-
&& pip install /ms2rescore --only-binary :all:
32+
# Install the project and its dependencies using the lockfile and settings
33+
RUN --mount=type=cache,target=/root/.cache/uv \
34+
uv sync --no-dev
35+
36+
# Place executables in the environment at the front of the path
37+
ENV PATH="/ms2rescore/.venv/bin:$PATH"
38+
39+
# Reset the entrypoint, don't invoke `uv`
40+
ENTRYPOINT []
1841

19-
ENTRYPOINT [""]
42+
# Use the non-root user to run our application
43+
USER nonroot

docs/source/api/ms2rescore.feature_generators.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ ms2rescore.feature_generators.deeplc
3535

3636

3737

38+
ms2rescore.feature_generators.im2deep
39+
####################################
40+
41+
.. automodule:: ms2rescore.feature_generators.im2deep
42+
:members:
43+
44+
45+
3846
ms2rescore.feature_generators.ionmob
3947
####################################
4048

docs/source/config_schema.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,22 @@
6767
- **One of**
6868
- *string*
6969
- *null*
70-
- **`write_flashlfq`** *(boolean)*: Write results to a FlashLFQ-compatible file. Default: `false`.
71-
- **`write_report`** *(boolean)*: Write an HTML report with various QC metrics and charts. Default: `false`.
72-
- **`profile`** *(boolean)*: Write a txt report using cProfile for profiling. Default: `false`.
70+
- **`write_flashlfq`**: Write results to a FlashLFQ-compatible file. Default: `false`.
71+
- **One of**
72+
- *boolean*
73+
- *null*
74+
- **`write_report`**: Write an HTML report with various QC metrics and charts. Default: `true`.
75+
- **One of**
76+
- *boolean*
77+
- *null*
78+
- **`disable_update_check`**: Disable the automatic update check. Default: `false`.
79+
- **One of**
80+
- *boolean*
81+
- *null*
82+
- **`profile`**: Write a txt report using cProfile for profiling. Default: `false`.
83+
- **One of**
84+
- *boolean*
85+
- *null*
7386
## Definitions
7487

7588
- <a id="definitions/feature_generator"></a>**`feature_generator`** *(object)*: Feature generator configuration. Can contain additional properties.

ms2rescore/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"""Modular and user-friendly platform for AI-assisted rescoring of peptide identifications ."""
22

3-
__version__ = "3.2.0.dev2"
3+
# __version__ is provided by the small helper module _version which prefers
4+
# installed distribution metadata and falls back to reading pyproject.toml.
5+
# The single source of truth for the version is pyproject.toml.
6+
47
__all__ = [
58
"parse_configurations",
69
"rescore",
@@ -16,5 +19,8 @@
1619
module="psims.mzmlb",
1720
)
1821

22+
from ms2rescore._version import get_version # noqa: E402
1923
from ms2rescore.config_parser import parse_configurations # noqa: E402
2024
from ms2rescore.core import rescore # noqa: E402
25+
26+
__version__ = get_version()

ms2rescore/__main__.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from rich.text import Text
1515

1616
from ms2rescore import __version__, package_data
17+
from ms2rescore._version import check_for_update
1718
from ms2rescore.config_parser import parse_configurations
1819
from ms2rescore.core import rescore
1920
from ms2rescore.exceptions import MS2RescoreConfigurationError
@@ -148,18 +149,24 @@ def _argument_parser() -> argparse.ArgumentParser:
148149
)
149150
parser.add_argument(
150151
"--write-report",
151-
# metavar="BOOL",
152152
action="store_true",
153+
default=None,
153154
dest="write_report",
154-
help="boolean to enable profiling with cProfile",
155+
help="boolean whether to write an HTML report (default: True)",
156+
)
157+
parser.add_argument(
158+
"--disable-update-check",
159+
action="store_true",
160+
default=None,
161+
dest="disable_update_check",
162+
help="Disable automatic check for software updates (default: False)",
155163
)
156164
parser.add_argument(
157165
"--profile",
158-
# metavar="BOOL",
159166
action="store_true",
160-
# type=bool,
161-
# dest="profile",
162-
help="boolean to enable profiling with cProfile",
167+
default=None,
168+
dest="profile",
169+
help="Enable profiling with cProfile",
163170
)
164171

165172
return parser
@@ -228,6 +235,16 @@ def main(tims=False):
228235
config["ms2rescore"]["log_level"], config["ms2rescore"]["output_path"] + ".log.txt"
229236
)
230237

238+
# Check for updates
239+
if config["ms2rescore"]["disable_update_check"] is False:
240+
update_info = check_for_update()
241+
if update_info["update_available"]:
242+
LOGGER.info(
243+
f"New version of MS²Rescore available: {update_info['latest_version']} "
244+
f"(you are using {update_info['current_version']})"
245+
)
246+
LOGGER.info(f"Download the latest version at: {update_info['html_url']}")
247+
231248
# Run MS²Rescore
232249
try:
233250
if cli_args.profile:

0 commit comments

Comments
 (0)