Skip to content

Commit

Permalink
Merge pull request #78 from compomics/project
Browse files Browse the repository at this point in the history
Project and CI changes
  • Loading branch information
RalfG authored Apr 12, 2024
2 parents 0fbbe36 + 1517d36 commit 3b52831
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 43 deletions.
42 changes: 19 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,42 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test-with-codecov:
linting-and-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flit flake8
pip install ruff
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check with Ruff
run: ruff check --output-format=github .

- name: Install with Flit
run: flit install --deps all
- name: Install package and its dependencies
run: pip install --editable .[dev]

- name: Test with pytest and codecov
run: |
pytest --cov=psm_utils tests
pytest --cov=psm_utils --cov-report=xml tests/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

test-platforms:
runs-on: ubuntu-latest
Expand All @@ -48,24 +51,17 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install package and its dependencies
run: |
python -m pip install --upgrade pip
pip install flit flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install .[dev]
- name: Install with Flit
run: flit install --deps all
- name: Test imports
run: python -c "import psm_utils"

- name: Test with pytest
run: |
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
"[python]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [99]
},
"python.testing.pytestArgs": ["tests"],
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@


def setup(app):
config = {
config = { # noqa: F841
# "auto_toc_tree_section": "Contents",
"enable_eval_rst": True,
}
1 change: 0 additions & 1 deletion online/Home.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""psm_utils Streamlit-based web server."""

import streamlit as st
from _base import StreamlitPage


Expand Down
2 changes: 1 addition & 1 deletion online/pages/2_PSM_file_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _convert(self):

# Open converted file in memory for download button
with open("output_filename", "rb") as file:
is_downloaded = st.download_button(
_ = st.download_button(
"Download",
data=file,
file_name=output_filename,
Expand Down
14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["black", "isort>5", "pytest", "pytest-cov"]
dev = ["ruff", "isort>5", "pytest", "pytest-cov"]
docs = [
"sphinx",
"numpydoc>=1,<2",
Expand All @@ -56,11 +56,15 @@ CompOmics = "https://www.compomics.com"
psm_utils = "psm_utils.__main__:main"

[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.flit.module]
name = "psm_utils"
[tool.setuptools.packages.find]
include = ["psm_utils*"]


[tool.setuptools.dynamic]
version = { attr = "psm_utils.__version__" }

[tool.isort]
profile = "black"
Expand Down
Empty file removed tests/__init__.py
Empty file.
10 changes: 2 additions & 8 deletions tests/test_io/test__base_classes.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
"""Tests for psm_utils.io._base_classes."""

import pytest

from psm_utils.io._base_classes import ReaderBase
from psm_utils.io.exceptions import (
InvalidModificationDefinitionError,
InvalidModificationError,
UnresolvableModificationError,
)
from psm_utils.io._base_classes import ReaderBase # noqa: F401


class TestBaseReader:
# TODO
pass
1 change: 0 additions & 1 deletion tests/test_io/test_maxquant.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest

import psm_utils.io.maxquant as maxquant
from psm_utils import peptidoform, psm, psm_list

TEST_COL = [
"Raw file",
Expand Down
1 change: 0 additions & 1 deletion tests/test_io/test_mzid.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import xml.etree.ElementTree as ET

import psm_utils.io.mzid as mzid
from psm_utils import peptidoform, psm, psm_list

PEAKS_TEST_FILE = "./tests/test_data/test_peaks.mzid"
MSGF_TEST_FILE = "./tests/test_data/test_msgf.mzid"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_io/test_tsv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for psm_utils.io.tsv."""

from psm_utils.io.tsv import TSVReader, TSVWriter
from psm_utils.io.tsv import TSVReader, TSVWriter # noqa: F401

test_cases = [
(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_psm_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class TestPSMList:
def test___init__(self):
psm_list = PSMList(psm_list=sample_psm_list)
_ = PSMList(psm_list=sample_psm_list)

def test___iter__(self):
for psm in PSMList(psm_list=sample_psm_list):
Expand Down

0 comments on commit 3b52831

Please sign in to comment.