Skip to content

Commit

Permalink
Lightning backend (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeschamps authored Apr 30, 2024
2 parents e7fc8fc + 381bce8 commit 5ffdd5f
Show file tree
Hide file tree
Showing 213 changed files with 17,883 additions and 8,032 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Version [e.g. 22]
- microscopy-portfolio version [e.g. 0.0.5]

**Environment:**
Please add here the content of your conda environment with versions.
Expand Down
File renamed without changes.
12 changes: 0 additions & 12 deletions .github/TEST_FAIL_TEMPLATE.md

This file was deleted.

11 changes: 0 additions & 11 deletions .github/dependabot.yml

This file was deleted.

196 changes: 95 additions & 101 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,103 @@
---
name: CI

on:
push:
branches:
- main
tags:
- v*.*.*
pull_request:
workflow_dispatch:
schedule:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
schedule:
# run every week (for --pre release tests)
- cron: 0 0 * * 0
- cron: "0 0 * * 0"

jobs:
check-manifest:
check-manifest:
# check-manifest is a tool that checks that all files in version control are
# included in the sdist (unless explicitly excluded)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run check-manifest

test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
platform: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v4

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache-dependency-path: pyproject.toml
cache: pip

- name: Install Dependencies
run: |
python -m pip install -U pip
# if running a cron job, we add the --pre flag to test against pre-releases
python -m pip install .[test] ${{ github.event_name == 'schedule' && '--pre' || '' }}
- name: 🧪 Run Tests
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing -m "not gpu"

# If something goes wrong with --pre tests, we can open an issue in the repo
- name: 📝 Report --pre Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.platform }}
PYTHON: ${{ matrix.python-version }}
RUN_ID: ${{ github.run_id }}
TITLE: '[test-bot] pip install --pre is failing'
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true

- name: Coverage
uses: codecov/codecov-action@v4

deploy:
name: Deploy
needs: test
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
runs-on: ubuntu-latest

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing on PyPi
# see https://docs.pypi.org/trusted-publishers/
id-token: write
# This permission allows writing releases
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: 👷 Build
run: |
python -m pip install build
python -m build
- name: 🚢 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: ./dist/*
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx run check-manifest

test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
platform: [ubuntu-latest, macos-13, windows-latest]

steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache-dependency-path: "pyproject.toml"
cache: "pip"

- name: Install Dependencies
run: |
python -m pip install -U pip
# if running a cron job, we add the --pre flag to test against pre-releases
python -m pip install .[dev] ${{ github.event_name == 'schedule' && '--pre' || '' }}
- name: 🧪 Run Tests
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing -m "not gpu"

# If something goes wrong with --pre tests, we can open an issue in the repo
- name: 📝 Report --pre Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.platform }}
PYTHON: ${{ matrix.python-version }}
RUN_ID: ${{ github.run_id }}
TITLE: "[test-bot] pip install --pre is failing"
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true

- name: Coverage
uses: codecov/codecov-action@v3

deploy:
name: Deploy
needs: test
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: 👷 Build
run: |
python -m pip install build
python -m build
- name: 🚢 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TWINE_API_KEY }}

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.pytest*
*.DS_Store*
**/.ipynb_checkpoints
.coverage
coverage.xml
lightning_logs
92 changes: 43 additions & 49 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,56 @@
---
# enable pre-commit.ci at https://pre-commit.ci/
# it adds:
# 1. auto fixing pull requests
# 2. auto updating the pre-commit configuration
ci:
autoupdate_schedule: monthly
autofix_commit_msg: 'style(pre-commit.ci): auto fixes [...]'
autoupdate_commit_msg: 'ci(pre-commit.ci): autoupdate'
autoupdate_schedule: monthly
autofix_commit_msg: "style(pre-commit.ci): auto fixes [...]"
autoupdate_commit_msg: "ci(pre-commit.ci): autoupdate"

repos:
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
hooks:
- id: validate-pyproject

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --target-version, py38]

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
files: ^src/
additional_dependencies:
- numpy
- types-PyYAML
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.14
hooks:
- id: validate-pyproject

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff
args: [--fix, --target-version, py38]

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
files: "^src/"
additional_dependencies:
- numpy
- types-PyYAML
- types-setuptools

# check docstrings
- repo: https://github.com/numpy/numpydoc
rev: v1.6.0
hooks:
- id: numpydoc-validation
- repo: https://github.com/numpy/numpydoc
rev: v1.6.0
hooks:
- id: numpydoc-validation

# jupyter linting and formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-ruff
args: [--fix]
- id: nbqa-black
#- id: nbqa-mypy
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
args: [--fix]
- id: nbqa-black
#- id: nbqa-mypy

# strip out jupyter notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout

# yaml formatter
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
Loading

0 comments on commit 5ffdd5f

Please sign in to comment.