Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
whitews committed Oct 5, 2023
2 parents 3a9079f + d2f388c commit 869cb2e
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 136 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-test-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build & test

on:
workflow_call:

jobs:
test:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.platform}}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install packages
run: |
pip install --upgrade pip setuptools wheel
pip install coverage
pip install .
- name: Run tests with coverage
run: |
coverage run --source flowutils run_tests.py
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml
fail_ci_if_error: true
verbose: true
36 changes: 1 addition & 35 deletions .github/workflows/tests_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,4 @@ on:

jobs:
test:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.platform}}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'develop'

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

- run: pip install --upgrade pip setuptools wheel
- run: pip install coverage
- run: pip install numpy>=1.20
- run: python setup.py build_ext --inplace

- name: Run tests with coverage
run: |
coverage run --source flowutils --omit="flowutils/tests/*" run_tests.py
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml
fail_ci_if_error: true
verbose: true

uses: whitews/flowutils/.github/workflows/build-test-base.yml@develop
38 changes: 2 additions & 36 deletions .github/workflows/tests_master.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & test
name: Build & test (master)

on:
push:
Expand All @@ -7,38 +7,4 @@ on:

jobs:
test:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.platform}}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'

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

- run: pip install --upgrade pip setuptools wheel
- run: pip install coverage
- run: pip install numpy>=1.20
- run: python setup.py build_ext --inplace

- name: Run tests with coverage
run: |
coverage run --source flowutils --omit="flowutils/tests/*" run_tests.py
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml
fail_ci_if_error: true
verbose: true

uses: whitews/flowutils/.github/workflows/build-test-base.yml@master
68 changes: 31 additions & 37 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-10.15]
os: [ubuntu-22.04, windows-2022, macos-12]

steps:
- name: Checkout
Expand All @@ -18,30 +18,28 @@ jobs:

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

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: |
pip install numpy==1.21.6
pip freeze
CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 *-win32 # skip PyPy, musllinux, 32-bit Linux & win32 builds
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-*
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*

- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: wheelhouse/*.whl

build_wheels_apple_silicon:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
package_source:
name: Package source distribution
runs-on: ubuntu-22.04

steps:
- name: Checkout
Expand All @@ -51,40 +49,36 @@ jobs:

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

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0
- name: Install build
run: python -m pip install build

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: pip install numpy==1.21.6
CIBW_SKIP: pp* # skip PyPy
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* # Only Python 3.8 - 3.11
CIBW_ARCHS_MACOS: arm64 # Only arm64 for Apple Silicon builds
- name: Run sdist
run: python -m build --sdist

- name: Store artifacts
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

package_source:
name: Package source
name: python-package-distributions
path: ./dist/*.tar.gz

retrieve_build_files:
name: Retrieve build files
needs:
- build_wheels
- package_source
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download build files
uses: actions/download-artifact@v3
with:
ref: 'master'

- name: Setup Python
uses: actions/setup-python@v4

- name: Run sdist
run: python setup.py sdist
name: python-package-distributions
path: dist/

- name: Store artifacts
uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz
- name: List files
run: |
pwd
ls -hog dist
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- docs

sphinx:
configuration: docs/conf.py
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
include LICENSE
recursive-include flowutils *.h
prune flowutils/tests/
recursive-include src/flowutils *.h
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __getattr__(cls, name):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

html_theme_options = {
# 'logo': 'flowutils.png',
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx==6.2.1
sphinx_rtd_theme==1.2.1
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ['setuptools>=61.0', 'oldest-supported-numpy']
build-backend = 'setuptools.build_meta'
2 changes: 1 addition & 1 deletion run_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import unittest


unittest.main('flowutils.tests')
unittest.main('tests')
30 changes: 13 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
"""
Setup script for the FlowUtils package
"""
from setuptools import setup, Extension, dist
from setuptools import setup, Extension
import numpy as np # NumPy is needed to build C extensions

# read in version string
VERSION_FILE = 'flowutils/_version.py'
VERSION_FILE = 'src/flowutils/_version.py'
__version__ = None # to avoid inspection warning and check if __version__ was loaded
exec(open(VERSION_FILE).read())

if __version__ is None:
raise RuntimeError("__version__ string not found in file %s" % VERSION_FILE)

# NumPy is needed to build
# This retrieves a version at build time compatible with run time version
dist.Distribution().fetch_build_eggs(['numpy>=1.19'])

# override inspection for import not at top of file
# this has to be imported here, after fetching the NumPy egg
import numpy as np # noqa: E402

with open("README.md", "r") as fh:
long_description = fh.read()

logicle_extension = Extension(
'flowutils.logicle_c',
sources=[
'flowutils/logicle_c_ext/_logicle.c',
'flowutils/logicle_c_ext/logicle.c'
'src/flowutils/logicle_c_ext/_logicle.c',
'src/flowutils/logicle_c_ext/logicle.c'
],
include_dirs=[np.get_include(), 'flowutils/logicle_c_ext'],
include_dirs=[np.get_include(), 'src/flowutils/logicle_c_ext'],
extra_compile_args=['-std=c99']
)

gating_extension = Extension(
'flowutils.gating_c',
sources=[
'flowutils/gating_c_ext/_gate_helpers.c',
'flowutils/gating_c_ext/gate_helpers.c'
'src/flowutils/gating_c_ext/_gate_helpers.c',
'src/flowutils/gating_c_ext/gate_helpers.c'
],
include_dirs=[np.get_include(), 'flowutils/gating_c_ext'],
include_dirs=[np.get_include(), 'src/flowutils/gating_c_ext'],
extra_compile_args=['-std=c99']
)

setup(
name='FlowUtils',
version=__version__,
version=__version__, # noqa PyTypeChecker
packages=['flowutils'],
package_dir={'': "src"},
package_data={'': []},
description='Flow Cytometry Standard Utilities',
long_description=long_description,
Expand All @@ -57,6 +51,8 @@
ext_modules=[logicle_extension, gating_extension],
install_requires=['numpy>=1.20'],
classifiers=[
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.8',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
'G560-A'
]

test_data_npy_path = "flowutils/tests/test_data/test_comp_event_data.npy"
test_comp_csv_path = "flowutils/tests/test_data/test_comp_matrix.csv"
test_data_npy_path = "tests/test_data/test_comp_event_data.npy"
test_comp_csv_path = "tests/test_data/test_comp_matrix.csv"
test_data_channels = [
'FSC-A', 'FSC-W', 'SSC-A',
'Ax488-A', 'PE-A', 'PE-TR-A',
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_parse_compensation_matrix_from_path(self):
self.assertIsInstance(matrix_array, np.ndarray)

def test_parse_compensation_matrix_missing_row(self):
comp_path = pathlib.Path("flowutils/tests/test_data/test_comp_matrix_missing_row.csv")
comp_path = pathlib.Path("tests/test_data/test_comp_matrix_missing_row.csv")

self.assertRaises(
ValueError,
Expand Down
Loading

0 comments on commit 869cb2e

Please sign in to comment.