Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/dep update 2411 #28

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
groups:
pip-dependencies:
applies-to: version-updates
patterns:
- "*"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
Expand Down
38 changes: 16 additions & 22 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@

name: CI Testing

on:
push:
branches: [ main, devel, release ]
branches: [main, devel, release]
pull_request:
branches: [ main, devel, release ]
schedule:
- cron: "4 5 4 1/1 *" # Run monthly.
branches: [main, devel, release]

jobs:
cheap_checks:
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3

# Python setup
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.10"

- name: Debug Info
run: echo ${{ github.ref }} ${{ github.event_name }} ${{ endsWith(github.ref, 'heads/release') && (github.event_name == 'push') }}
Expand All @@ -31,7 +28,7 @@ jobs:
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: '1.2.2'
poetry-version: "1.7.1"

- name: View poetry --version
run: poetry --version
Expand All @@ -49,9 +46,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.9']
poetry-version: ['1.2.2',]
os: ['ubuntu-latest',]
python-version: ["3.10", "3.9"]
poetry-version: ["1.7.1"]
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
# Initial Setup
Expand All @@ -61,8 +58,7 @@ jobs:
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run:
quarto --version
run: quarto --version

# Python setup
- uses: actions/setup-python@v4
Expand All @@ -81,7 +77,7 @@ jobs:

# Package Setup
- name: Install deps
run: poetry install -n -v --with=plotting,dev,docs
run: poetry install -n -v --with=plotting,dev,docs

# CI checks
- name: Pytest
Expand All @@ -90,10 +86,9 @@ jobs:
- name: mkdocs
run: poetry run python -m mkdocs build --strict


release:
# Run when there is a new push on the release branch
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
needs: ci
if: endsWith(github.ref, 'heads/release') && (github.event_name == 'push')
steps:
Expand All @@ -106,21 +101,20 @@ jobs:
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run:
quarto --version
run: quarto --version

# Python setup
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.10"
- name: View Python --version
run: python --version

# Poetry Setup
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: '1.2.2'
poetry-version: "1.7.1"
- name: View poetry --version
run: poetry --version

Expand All @@ -147,13 +141,13 @@ jobs:
- name: Build Docker image
id: dockerbuild
run: |
docker build -t ghcr.io/jspaezp/elfragmentador:v$(poetry version -s) .
docker build -t ghcr.io/jspaezp/elfragmentador:v$(poetry version -s) .

# Publish Docker
- name: Push the Docker image to the GHCR
id: ghcr_push
run: |
docker push ghcr.io/jspaezp/elfragmentador:v$(poetry version -s)
docker push ghcr.io/jspaezp/elfragmentador:v$(poetry version -s)

# Publishing Docs
- name: Deploy Docs
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
exclude: "mkdocs.yml"
Expand All @@ -12,22 +12,22 @@ repos:
- id: end-of-file-fixer
- id: detect-private-key
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.146
rev: v0.7.4
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/python-poetry/poetry
rev: 1.3.2 # add version here
rev: 1.8.0 # add version here
hooks:
- id: poetry-check
- id: poetry-lock
Expand Down
11 changes: 7 additions & 4 deletions elfragmentador/data/torch_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@

class TupleTensorDataset(TensorDataset):
def __init__(self, tensor_tuple):
super().__init__(*tensor_tuple)
tmp = list(tensor_tuple)
tmp[-1] = tmp[-1].float()
super().__init__(*tmp)
self.builder = type(tensor_tuple)

def __getitem__(self, index):
out = self.builder(*super().__getitem__(index))
tmp = super().__getitem__(index)
out = self.builder(*tmp)
return out

def as_dataloader(self, batch_size, shuffle, num_workers=0, *args, **kwargs):
Expand Down Expand Up @@ -179,7 +182,7 @@ def fast_split(x):

class PeptideDataset(TupleTensorDataset):
def __init__(self, peptide_list: Iterable[Peptide], nce=None, charge=None):
converter = Tensorizer(nce=nce)
tmp = [converter(x) for x in peptide_list]
converter = Tensorizer()
tmp = [converter(x, nce=nce) for x in peptide_list]
tensor_tuple = concat_batches(tmp)
super().__init__(tensor_tuple)
4 changes: 2 additions & 2 deletions elfragmentador/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def validation_step(

return step_out["l"]

def validation_epoch_end(self, outputs: list[Tensor]) -> list[Tensor]:
def on_validation_epoch_end(self) -> list[Tensor]:
"""See pytorch lightning documentation."""
log_dict = {
"val_irt_l": self.irt_metric.compute(),
Expand All @@ -648,7 +648,7 @@ def validation_epoch_end(self, outputs: list[Tensor]) -> list[Tensor]:
self.spectra_metric.reset()
self.spectra_metric2.reset()

return super().validation_epoch_end(outputs)
return super().on_validation_epoch_end()

def _evaluation_step(
self,
Expand Down
Loading
Loading