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

codecov to CI #1

Merged
merged 5 commits into from
Aug 19, 2024
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
52 changes: 45 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,41 @@ on:
branches: [main]

jobs:
deploy:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

build:
needs: [pre-commit]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11.8"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}

#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
Expand All @@ -34,16 +51,37 @@ jobs:
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install
run: poetry install --all-extras --no-interaction

#----------------------------------------------
# run test suite
# perform tasks
#----------------------------------------------
- name: Tests
run: poetry run pytest
run: poetry run pytest --cov

- name: Deploy doc
if: contains(github.ref, 'tags')
run: poetry run mkdocs gh-deploy --force

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

# publish:
# needs: [build]
# if: contains(github.ref, 'tags')
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build and publish to pypi
# uses: JRubics/[email protected]
# with:
# python_version: "3.10"
# pypi_token: ${{ secrets.PYPI_TOKEN }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
</p>
<!-- TODO: when it becomes public: https://raw.githubusercontent.com/MICS-Lab/novae/main/docs/assets/banner.png -->

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/novae.svg)](https://pypi.org/project/novae)
[![Downloads](https://static.pepy.tech/badge/novae)](https://pepy.tech/project/novae)
[![Docs](https://img.shields.io/badge/docs-mkdocs-blue)](https://mics-lab.github.io/novae)
Expand All @@ -11,6 +13,8 @@
[![License](https://img.shields.io/pypi/l/novae.svg)](https://github.com/MICS-Lab/novae/blob/main/LICENSE)
[![Imports: isort](https://img.shields.io/badge/imports-isort-blueviolet)](https://pycqa.github.io/isort/)

</div>

<p align="center"><b><i>
💫 Graph-based foundation model for spatial transcriptomics data
</b></i></p>
Expand Down
2 changes: 2 additions & 0 deletions novae/module/augment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import lightning as L
import torch
from torch.distributions import Exponential
Expand Down
6 changes: 4 additions & 2 deletions novae/monitor/log.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

import io

import matplotlib.pyplot as plt
from PIL import Image

import wandb
from PIL import Image


def log_plt_figure(name: str):

img_buf = io.BytesIO()
plt.savefig(img_buf, format="png", bbox_inches="tight")
wandb.log({name: wandb.Image(Image.open(img_buf))})
Expand Down
2 changes: 2 additions & 0 deletions novae/plot/_heatmap.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions novae/utils/_correct.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import numpy as np
import pandas as pd
from anndata import AnnData
Expand Down
2 changes: 2 additions & 0 deletions novae/utils/_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from pathlib import Path

Expand Down
2 changes: 2 additions & 0 deletions novae/utils/_docs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

_format_doc_dict = {
"adata": "An `AnnData` object, or a list of `AnnData` objects. Optional if the model was initialized with `adata`.",
"slide_key": "Optional key of `adata.obs` containing the ID of each slide. Not needed if each `adata` is a slide.",
Expand Down
3 changes: 3 additions & 0 deletions novae/utils/_mode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations


class Mode:
"""Novae mode class, used to store states variables related to training and inference."""

Expand Down
Loading
Loading