Skip to content

Commit

Permalink
removed transonic
Browse files Browse the repository at this point in the history
  • Loading branch information
cudmore committed May 28, 2024
1 parent a3262b8 commit 143e83d
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 97 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/publish_from_sanpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- ["3.8", "cp38"]
- ["3.9", "cp39"]
- ["3.10", "cp310"]
- ["3.11", "cp311"]
Expand Down Expand Up @@ -55,7 +54,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version:
- ["3.9", "cp39"]
- ["3.10", "cp310"]
- ["3.11", "cp311"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -83,7 +85,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version:
- ["3.9", "cp39"]
- ["3.10", "cp310"]
- ["3.11", "cp311"]
steps:
- uses: actions/checkout@v3
- name: Set up Python cudmore ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include brightest_path_lib/cost/reciprocal_transonic.py
include brightest_path_lib/heuristic/euclidean_transonic.py
include brightest_path_lib/heuristic/euclidean_transonic.py
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ Contributions are very welcome. Tests can be run with `pytest`, please ensure th

To contribute to this package, first checkout the code. Then create a new virtual environment:

cd brightest-path-lib
python -m venv brightest-venv
source brightest-venv/bin/activate

- With venv
python -m venv brightest-env
source brightest-env/bin/activate
- With conda
conda create -y -n brightest-env python=3.9
conda activate brightest-env

Now install the package with the testing dependencies:

cd brightest-path-lib
pip install -e '.[test]'

To run the tests:
Expand Down
2 changes: 2 additions & 0 deletions brightest_path_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DO_TRANSONIC = False

# __version__ = "1.0.27"
# from ._version import __version__
from ._myVersion import __version__
7 changes: 6 additions & 1 deletion brightest_path_lib/cost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from .cost import Cost
from .reciprocal import Reciprocal
from .reciprocal_transonic import ReciprocalTransonic

DO_TRANSONIC = False
if DO_TRANSONIC:
from .reciprocal_transonic import ReciprocalTransonic
else:
from .reciprocal import Reciprocal as ReciprocalTransonic
12 changes: 11 additions & 1 deletion brightest_path_lib/heuristic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from .heuristic import Heuristic
from .euclidean import Euclidean
from .euclidean_transonic import EuclideanTransonic

# 20240527, making a version to not use transonic
# was this
# from .euclidean_transonic import EuclideanTransonic
from .euclidean import Euclidean as EuclideanTransonic

DO_TRANSONIC = False
if DO_TRANSONIC:
from .reciprocal_transonic import EuclideanTransonic
else:
from .euclidean import Euclidean as EuclideanTransonic
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ With its efficient implementation and intuitive API, this library is a valuable
- It supports both grayscale and color images and can handle images of arbitrary sizes.
- The library also provides support for users to know which points in the image are being considered for the brightest path in real-time so that they display them on the original image.

## Napi Plugin
## Napari Plugin

We have also created a [Napari Tracing Plugin](https://github.com/mapmanager/napari-tracing) to provide an intuititive graphical-user-interface that uses the `brightest-path-lib`` package. We are using this to trace neuronal dendrites and axons.

Expand Down
29 changes: 10 additions & 19 deletions docs/simple_notebook.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[build-system]
# as this 20240527, removing transonic
#requires = ["setuptools", "wheel", "numpy"]
requires = ["setuptools", "wheel", "numpy", "transonic"]
#requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel", "numpy", "transonic"]
build-backend = "setuptools.build_meta"
Expand Down
75 changes: 8 additions & 67 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,19 @@
import os
from pathlib import Path
from setuptools import setup, find_packages
import sys
from transonic.dist import ParallelBuildExt, make_backend_files, init_transonic_extensions

here = Path(__file__).parent.absolute()
sys.path.insert(0, ".")

__version__ = "1.0.55"
# from .brightest_path_lib._myVersion import __version__

TRANSONIC_BACKEND = "pythran"

build_dependencies_backends = {
"pythran": ["pythran"],
"cython": ["cython"],
"python": [],
"numba": ["numba"],
}

# setup_requires = ['setuptools_scm']
setup_requires = []
setup_requires.extend(build_dependencies_backends[TRANSONIC_BACKEND])

def transonize():
paths = [
"brightest_path_lib/cost/reciprocal_transonic.py",
"brightest_path_lib/heuristic/euclidean_transonic.py"
]
make_backend_files([here / path for path in paths], backend=TRANSONIC_BACKEND)

def create_pythran_extensions():
import numpy as np

extensions = init_transonic_extensions(
# "brightest-path-lib",
"brightest_path_lib",
backend=TRANSONIC_BACKEND,
include_dirs=np.get_include(),
compile_args=("-O3", f"-march=native", "-DUSE_XSIMD"),
# compile_args=("-O2", "-DUSE_XSIMD"),
)
return extensions
from setuptools import setup, find_packages

def create_extensions():
transonize()
return create_pythran_extensions()
VERSION = "1.0.56"

packages = find_packages(exclude=["tests"])
print(f"found packages: {packages}")

setup_requires = ['numpy']

# load the readme
_thisPath = os.path.abspath(os.path.dirname(__file__))
with open(os.path.abspath(_thisPath+"/README.md")) as f:
long_description = f.read()

# def myversion():
# from setuptools_scm.version import SEMVER_MINOR, guess_next_simple_semver, release_branch_semver_version

# def my_release_branch_semver_version(version):
# v = release_branch_semver_version(version)
# if v == version.format_next_version(guess_next_simple_semver, retain=SEMVER_MINOR):
# # return version.format_next_version(guess_next_simple_semver, fmt="{guessed}") # , retain=SEMVER_MINOR)
# return version.format_next_version(guess_next_simple_semver, fmt="{guessed}", retain=SEMVER_MINOR)
# return v

# return {
# 'version_scheme': my_release_branch_semver_version,
# 'local_scheme': 'no-local-version',
# }

setup(
name="brightest-path-lib",
description="A library of path-finding algorithms to find the brightest path between points in an image.",
Expand All @@ -83,16 +27,15 @@ def create_extensions():
"Changelog": "https://github.com/mapmanager/brightest-path-lib/releases",
},
license="GNU General Public License, Version 3",
# version=VERSION,
version=__version__,
version=VERSION,
#packages=["brightest_path_lib"],
#packages=find_packages(),
packages=packages,
# use_scm_version=myversion, #True,
setup_requires=setup_requires,
install_requires=["numpy", "transonic"],
extras_require={
'dev': [
'jupyter',
'mkdocs',
'mkdocs-material',
'mkdocs-jupyter',
Expand All @@ -106,7 +49,5 @@ def create_extensions():
"pooch"
]
},
python_requires=">=3.8", # transonic requires >= 3.9
cmdclass={"build_ext": ParallelBuildExt},
ext_modules=create_extensions(),
)
python_requires=">=3.9",
)

0 comments on commit 143e83d

Please sign in to comment.