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

cibuildwheels - Phase 1 #230

Closed
wants to merge 10 commits into from
Closed
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
35 changes: 35 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Wheels

on:
push:
branches:
- main
pull_request:
paths-ignore:
- "**.md"

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/[email protected]
# env:
# CIBW_SOME_OPTION: value
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
btrack/include/eigen
btrack/__pycache__
btrack/optimise/__pycache__
__pycache__
btrack/agents.py
btrack/render_movie.py
models/MDCK_*
examples/napari.png
examples/.ipynb_checkpoints
*.ipynb_checkpoints
models/test_config.json
notebooks
deprecated
Expand All @@ -25,3 +24,7 @@ docs/api/*
coverage.xml
.envrc
.hypothesis
*.so
*.dylib
*.DLL
wheelhouse
64 changes: 0 additions & 64 deletions Makefile

This file was deleted.

9 changes: 9 additions & 0 deletions btrack/include/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef VERSION_MAJOR
#define VERSION_MAJOR 0
#endif
#ifndef VERSION_MINOR
#define VERSION_MINOR 0
#endif
#ifndef VERSION_BUILD
#define VERSION_BUILD 0
#endif

// store some information about the compilation
static unsigned int v_major = VERSION_MAJOR;
Expand Down
2 changes: 1 addition & 1 deletion btrack/include/hypothesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "pdf.h"
#include "updates.h"
#include "bayes.h"

#include <cassert>


// Store a hypothesis to return to Python
Expand Down
1 change: 1 addition & 0 deletions btrack/include/tracklet.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "motion.h"
#include "inference.h"
#include "defs.h"
#include <cassert>

// #define MAX_LOST 5

Expand Down
1 change: 1 addition & 0 deletions btrack/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <iostream>
#include <limits>
#include "defs.h"
#include <cassert>



Expand Down
Binary file removed btrack/libs/libtracker.DLL
Binary file not shown.
Binary file removed btrack/libs/libtracker.dylib
Binary file not shown.
Binary file removed btrack/libs/libtracker.so
Binary file not shown.
7 changes: 5 additions & 2 deletions btrack/src/tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
--------------------------------------------------------------------------------
*/

#ifndef DEBUG
#define DEBUG 0
#endif

#include "tracker.h"

Expand Down Expand Up @@ -519,7 +522,7 @@ void BayesianTracker::cost_EXACT(

// set up some variables for Bayesian updates
double uniform_prior = 1. / (n_objects+1);
double prior_assign, PrDP, posterior, update, safe_update;
double prior_assign, posterior, safe_update;

// start by intializing the belief matrix with a uniform prior
if (use_uniform_prior) {
Expand Down Expand Up @@ -586,7 +589,7 @@ void BayesianTracker::cost_APPROXIMATE(
std::clock_t t_update_start = std::clock();

// set up some variables for Bayesian updates
double prior_assign, PrDP, posterior, safe_update;
double prior_assign, posterior, safe_update;

// Posterior is a misnoma here because it is initially the prior, but
// becomes the posterior
Expand Down
9 changes: 0 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@ if [ ! -e ./btrack/include/eigen/signature_of_eigen3_matrix_library ]
then
git clone https://gitlab.com/libeigen/eigen.git ./btrack/include/eigen
fi

# build the tracker
echo "Compiling btrack from source..."
make clean
make

# run the installation
echo "Installing btrack python package..."
pip install -e .
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ exclude = '''
line-length = 79
target-version = ["py38", "py39", "py310"]

[tool.cibuildwheel]
before-all = [
"bash build.sh",
]
test-command = "pytest {project}"
test-extras = [
"napari",
]
test-requires = [
"dask",
"pytest",
]
linux.before-all = [
"yum install -y fontconfig",
"bash build.sh",
]

[tool.coverage]
report = {skip_covered = true, sort = "cover"}
run = {branch = true, parallel = true, source = ["btrack"]}
Expand Down
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from setuptools import Extension, setup

setup(
ext_modules=[
Extension(
"libtracker",
["btrack/src/tracker.cc"],
include_dirs=["btrack/include"],
extra_compile_args=["-c", "-std=c++17", "-m64", "-fPIC"],
),
],
)