Skip to content

Commit

Permalink
Merge cellfinder-core and cellfinder-napari into this package.
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Nov 27, 2023
2 parents e6a5521 + d086030 commit 7b29e91
Show file tree
Hide file tree
Showing 580 changed files with 11,065 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
comment: false


# Add a numba flag to any files that contain code jit compiled
# with numba. Tests are run without Numba compilation on the main
# branch to collect code coverage, and the carryforward flags are
# used to make sure coverage of these files does not decrease on
# pull requests.
flags:
numba:
paths:
- cellfinder/core/detect/filters/plane/tile_walker.py
- cellfinder/core/detect/filters/volume/ball_filter.py
- cellfinder/core/detect/filters/volume/structure_detection.py
carryforward: true
122 changes: 122 additions & 0 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: tests

on:
# Only run on pushes to main, or when version tags are pushed
push:
branches:
- "main"
tags:
- "v**"
# Run on all pull-requests
pull_request:
# Allow workflow dispatch from GitHub
workflow_dispatch:

concurrency:
# Cancel this workflow if it is running,
# and then changes are applied on top of the HEAD of the branch,
# triggering another run of the workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/lint@v2

manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/check_manifest@v2

test:
needs: [linting, manifest]
name: Run package tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Run all supported Python versions on linux
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
# Include one windows, one macos run
include:
- os: macos-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.10"

steps:
# Cache the tensorflow model so we don't have to remake it every time
- name: Cache tensorflow model
uses: actions/cache@v3
with:
path: "~/.cellfinder"
key: models-${{ hashFiles('~/.cellfinder/**') }}
# Setup pyqt libraries
- name: Setup qtpy libraries
uses: tlambert03/setup-qt-libs@v1
# Run all tests
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: ${{ matrix.python-version }}
use-xvfb: true

# Run cellfinder tests to make sure cellfinder is still compatible
# with cellfinder-core
test_cellfinder:
needs: [linting, manifest]
name: Run cellfinder tests
runs-on: ubuntu-latest
steps:
- name: Cache tensorflow model
uses: actions/cache@v3
with:
path: "~/.cellfinder"
key: models-${{ hashFiles('~/.cellfinder/**') }}

- name: Checkout cellfinder
uses: actions/checkout@v3
with:
repository: 'brainglobe/cellfinder'

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
# Install latest SHA on this cellfinder-core branch
python -m pip install git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA
# Install checked out copy of cellfinder
python -m pip install .[dev]
- name: Run cellfinder tests
run: |
python -m pytest --color=yes -v
build_sdist_wheel:
name: Build source distribution and wheel
needs: [test, test_cellfinder]
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/build_sdist_wheels@v2

upload_all:
name: Publish build distributions
needs: [build_sdist_wheel]
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TWINE_API_KEY }}
60 changes: 60 additions & 0 deletions .github/workflows/test_include_guard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Test Tensorflow include guards
# These tests check that the include guards checking for tensorflow's availability
# behave as expected on ubuntu and macOS.

on:
pull_request:
push:
branches:
- main

jobs:
tensorflow_guards:
name: Test include guards
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install via pip
run: python -m pip install -e .

- name: Test (working) import
uses: jannekem/run-python-script-action@v1
with:
fail-on-error: true
script: |
import cellfinder.core
import cellfinder.napari
- name: Uninstall tensorflow
run: python -m pip uninstall -y tensorflow

- name: Test (broken) import
id: broken_import
uses: jannekem/run-python-script-action@v1
with:
fail-on-error: false
script: |
import cellfinder.core
# exit 1 will force an actions exit with a failure reported
- name: Flag error thrown by broken import
if: steps.broken_import.outputs.error == 'false'
run: |
echo "Broken import test result was: ${{ steps.broken_import.outputs.error }}"
exit 1
# add an additional step to confirm an error occurred in the import
- name: Confirm error was thrown by broken import
if: steps.broken_import.outputs.error == 'true'
run: |
echo "Broken import test result was: ${{ steps.broken_import.outputs.error }}"
27 changes: 27 additions & 0 deletions .github/workflows/test_numba_off.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test with numba turned off
# These tests are relatively slow (~20 minutes), but are used
# to collect code coverage on areas of code that are otherwise
# optimised by numba.

on:
push:
branches: [ main ]


jobs:
test_numba_disabled:
name: Run tests
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: "1"

steps:
- name: Cache tensorflow model
uses: actions/cache@v3
with:
path: "~/.cellfinder"
key: models-${{ hashFiles('~/.cellfinder/**') }}
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: "3.10"
codecov-flags: "numba"
145 changes: 145 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Custom config files
*.conf.custom

# Byte-compiled / optimized / DLL files
**/__pycache__/
*.py[cod]
*$py.class

# Cython
*.c
*.cpp

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
.napari_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
doc/build/

# pydocmd
_build/
mkdocs.yml

# MkDocs documentation
/site/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.envrc

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea/

*.~lock.*

pip-wheel-metadata/

mprofile*.dat

*.DS_Store

# asv
.asv
benchmarks/results
benchmarks/html
benchmarks/env

# OS
.DS_Store

# written by setuptools_scm
*/_version.py

.idea/
14 changes: 14 additions & 0 deletions .napari/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Add labels from the EDAM Bioimaging ontology
labels:
ontology: EDAM-BIOIMAGING:alpha06
terms:
- Image feature detection
- 3D image
- Image registration
- Multi-photon microscopy
- Light-sheet microscopy
- Image segmentation
- Image thresholding
- Image annotation
- Object classification
- Object feature extraction
Loading

0 comments on commit 7b29e91

Please sign in to comment.