Skip to content
Merged
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
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ on:
push:
branches:
- master
- dev
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
name: Python ${{ matrix.python-version }} sample
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
name: Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v4
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install dependencies
run: |
python -m pip install pipenv --upgrade-strategy=only-if-needed
pipenv install --dev --skip-lock
- name: Test with pytest
run: pipenv run pytest --cov
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
- name: Run tests
run: |
source .venv/bin/activate
pytest --cov
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Makefile for managing the Python project environment, dependencies, and common tasks.
#
# This Makefile provides a set of commands to help developers set up the project,
# run tests, lint the code, and clean up temporary files. It uses Python's built-in
# `venv` module to create a virtual environment and `pip` to manage dependencies.
#
# Usage:
# make install - Set up the virtual environment and install all dependencies (including dev dependencies).
# make test - Run the test suite using pytest and generate a coverage report.
# make lint - Run code linting and style checks using flake8.
# make clean - Remove the virtual environment and temporary files.
#
# Note: Ensure you have Python 3 installed on your system before using this Makefile.
.PHONY: install test lint clean
install:
python3 -m venv .venv
. .venv/bin/activate && pip install -r requirements-dev.txt
test:
. .venv/bin/activate && pytest --cov
lint:
. .venv/bin/activate && flake8
clean:
rm -rf .venv
find . -type d -name "__pycache__" -exec rm -r {} +
27 changes: 0 additions & 27 deletions Pipfile

This file was deleted.

705 changes: 0 additions & 705 deletions Pipfile.lock

This file was deleted.

10 changes: 10 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-r requirements.txt
black
coverage
flake8
ipython>=7.31.1
pdbpp
pylint
pyscaffold
pytest
pytest-cov
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docopt
pandas
scipy
-e .
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ package_dir =
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
# python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
install_requires =
importlib-metadata; python_version<"3.8"
pandas
scipy
docopt
openpyxl
python_requires = >=3.6
python_requires = >=3.9

[options.packages.find]
where = src
Expand Down
6 changes: 3 additions & 3 deletions src/picor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import logging
from pathlib import Path
import sys
import pkg_resources
from importlib.metadata import version

from docopt import docopt
import pandas as pd
Expand Down Expand Up @@ -96,8 +96,8 @@ def cli(arguments):

def main():
"""Serve as entry point for CLI."""
version = pkg_resources.get_distribution("picor").version
arguments = docopt(__doc__, version=version)
package_version = version("picor")
arguments = docopt(__doc__, version=package_version)
_logger.info("arguments = {arguments}")
sys.exit(cli(arguments))

Expand Down
5 changes: 4 additions & 1 deletion src/picor/isotope_probabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ def get_shift(isotopes_file):
index_col="isotope",
)
iso_data = iso_data.groupby("element", group_keys=False).apply(
lambda gdf: gdf.assign(shift=lambda df: round(df["mass"] - min(df["mass"])))
lambda gdf: gdf.assign(
shift=lambda df: round(df["mass"] - min(df["mass"]))
),
include_groups=False,
)
return iso_data["shift"].astype("int64")

Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tox]
envlist = py310, py311, py312, py313
[testenv]
deps =
-rrequirements-dev.txt
commands =
pytest --cov