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

Add support for python 3.12 -- numpy min version 1.26.0 #21

Merged
merged 59 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9bb69df
update fix
masadcv Oct 15, 2024
fde1a5c
update fix 2
masadcv Oct 15, 2024
e232ac3
update fix 2
masadcv Oct 15, 2024
5e1d404
update fix 3
masadcv Oct 15, 2024
162fd6b
update fix 4
masadcv Oct 15, 2024
45f0b55
update fix 5
masadcv Oct 15, 2024
0a23eb1
update fix 6
masadcv Oct 15, 2024
d0900dc
update fix 7
masadcv Oct 15, 2024
b04e6b5
update fix 8
masadcv Oct 15, 2024
c22753e
update fix 10
masadcv Oct 15, 2024
48a55d1
update fix 11
masadcv Oct 15, 2024
b3833ca
update fix 12
masadcv Oct 15, 2024
cb575e6
update fix 13
masadcv Oct 15, 2024
fe4fc35
update fix 14
masadcv Oct 15, 2024
a9703e6
update fix 15
masadcv Oct 15, 2024
4111eb0
update fix 16
masadcv Oct 15, 2024
2f1f61d
update fix 17
masadcv Oct 15, 2024
c63bed7
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
c4df884
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
81a7611
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
b04dc63
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
586d6e7
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
67d23a5
Update build-whl-cibuild.yml
masadcv Oct 16, 2024
11dfc20
Create build-whl-new.yml
masadcv Oct 16, 2024
779f707
Update build-whl-new.yml
masadcv Oct 16, 2024
4a19691
Update build-whl-new.yml
masadcv Oct 16, 2024
910bd3c
Update build-whl-new.yml
masadcv Oct 16, 2024
ca7a5e2
Update build-whl-new.yml
masadcv Oct 16, 2024
2d12506
Update build-whl-new.yml
masadcv Oct 16, 2024
abfd98e
Update build-whl-new.yml
masadcv Oct 16, 2024
8a77418
Update build-whl-new.yml
masadcv Oct 16, 2024
ed9a29e
Update build-whl-new.yml
masadcv Oct 16, 2024
d395a5b
Update requirements-dev.txt
masadcv Oct 16, 2024
9e6a76e
Update requirements.txt
masadcv Oct 16, 2024
69788bc
Update requirements-dev.txt
masadcv Oct 16, 2024
5242c76
Update setup.py
masadcv Oct 16, 2024
8cfb2dc
Update setup.py
masadcv Oct 16, 2024
d31f966
Update build-whl-new.yml
masadcv Oct 16, 2024
a6af31b
Update build-whl-new.yml
masadcv Oct 16, 2024
d15cf8e
Update requirements-dev.txt
masadcv Oct 16, 2024
04b43c3
Update requirements.txt
masadcv Oct 16, 2024
c950f87
Update build-whl-new.yml
masadcv Oct 30, 2024
4b0b88c
Update build-whl-new.yml
masadcv Oct 30, 2024
722e4ba
Update build-whl-new.yml
masadcv Oct 30, 2024
6509da0
Update build-whl-new.yml
masadcv Oct 30, 2024
d13cb6b
Update build-whl-new.yml
masadcv Oct 30, 2024
24ba576
Update build-whl-new.yml
masadcv Oct 30, 2024
c09a35b
Update setup.py
masadcv Oct 30, 2024
db344fc
fix error on interactive for some library config
masadcv Oct 30, 2024
a6249aa
Update pyproject.toml
masadcv Oct 30, 2024
223466c
Update requirements-dev.txt
masadcv Oct 30, 2024
a8b90fa
Update requirements.txt
masadcv Oct 30, 2024
28b362b
Update setup.py
masadcv Oct 30, 2024
19875e4
Update pyproject.toml
masadcv Oct 30, 2024
13f23df
Update requirements-dev.txt
masadcv Oct 30, 2024
6b935b8
Update requirements.txt
masadcv Oct 30, 2024
8e7953b
Update README.md
masadcv Oct 30, 2024
06fc608
Update setup.py
masadcv Oct 30, 2024
073a176
Merge branch 'main' into revert-to-v3-artifacts
masadcv Oct 30, 2024
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
53 changes: 20 additions & 33 deletions .github/workflows/build-whl-cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,45 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macOS-12]
os: [ubuntu-22.04, windows-2022]

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

# Used to host cibuildwheel
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"

# macOS workaround to not use Accelerate:
# https://github.com/numpy/numpy/issues/15947
- name: Setup Openblas on macOS
if: matrix.os == 'macOS-12'
run: brew install openblas
if: matrix.os == 'macOS-14'
run: |
brew install openblas
brew install python-setuptools

- name: Install dependencies and cibuildwheel
run: |
python -m pip install cibuildwheel==2.16.0
python -m pip install setuptools wheel
python -m pip install cibuildwheel==2.21.0
python -m pip install -r requirements-dev.txt

- name: Build wheels MACOS
if: matrix.os == 'macOS-12'
run: OPENBLAS="$(brew --prefix openblas)" python -m cibuildwheel --output-dir dist
env:
# Disable building PyPy wheels on all platforms: "pp*
# Disable 32-bit compilation: *-win32
# Disable musllinux: *-musllinux*
# Disable cp312 for now: cp312-*"
# Windows workaround to avoid setuptools error:
# https://github.com/duckdb/duckdb/pull/3376
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux* cp36-* cp37-* cp312-*"
if: matrix.os == 'windows-2019'
SETUPTOOLS_USE_DISTUTILS: 'stdlib'

- name: Build wheels Non-MACOS
if: matrix.os != 'macOS-12'
if: matrix.os != 'macOS-14'
run: python -m cibuildwheel --output-dir dist
env:
# Disable building PyPy wheels on all platforms: "pp*
# Disable 32-bit compilation: *-win32
# Disable musllinux: *-musllinux*
# Disable cp312 for now: cp312-*"
# Windows workaround to avoid setuptools error:
# https://github.com/duckdb/duckdb/pull/3376
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux* cp36-* cp37-* cp312-*"
if: matrix.os == 'windows-2019'
SETUPTOOLS_USE_DISTUTILS: 'stdlib'
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux* cp36-* cp37-*"
CIBW_BEFORE_BUILD: "python3 -m pip install --upgrade pip setuptools wheel"

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist/*.whl
Expand All @@ -88,13 +75,13 @@ jobs:
run: python -c "import numpymaxflow"

build_sdist:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand All @@ -105,20 +92,20 @@ jobs:
run: python setup.py sdist

- name: Upload Python Dist
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error

publish_pypi:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- build
- build_sdist
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
Expand Down
47 changes: 32 additions & 15 deletions .github/workflows/build-whl-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,37 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
os: [ubuntu-22.04, windows-2022, macOS-14]

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

- name: Build wheels
uses: pypa/cibuildhwheel@2.21.3
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux* cp36-* cp37-*"

- uses: actions/upload-artifact@v3
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux* cp36-* cp37-* cp313-*"
with:
package-dir: .
# output-dir: dist

- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*.whl
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
if-no-files-found: error


- name: LS dist folder
run: |
ls -l .
pwd

- name: Install software
if: ${{ github.event.inputs.test_package == 'true' }}
run: pip install --find-links=${{github.workspace}}/dist/ numpymaxflow
run: |
pip install -r requirements.txt
pip install --no-index --find-links=${{github.workspace}}/dist/ numpymaxflow

- name: Test import
if: ${{ github.event.inputs.test_package == 'true' }}
Expand All @@ -65,11 +75,16 @@ jobs:
- name: Build source dist
run: python setup.py sdist

- name: LS dist folder
run: |
ls -l .
pwd

- name: Upload Python Dist
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
name: cibw-sdist
path: dist/*.tar.gz
if-no-files-found: error

publish_pypi:
Expand All @@ -79,10 +94,12 @@ jobs:
- build_sdist
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish distribution to Test PyPI
if: ${{ github.event.inputs.test_py == 'true' }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-whl-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# CIBW_SOME_OPTION: value

- name: Upload Python Dist
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand All @@ -99,7 +99,7 @@ jobs:
run: python setup.py sdist

- name: Upload Python Dist
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -112,7 +112,7 @@ jobs:
- build_sdist
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Upload Python Dist
if: ${{ github.event.inputs.save_artifacts == 'true' }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -67,10 +67,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand All @@ -96,7 +96,7 @@ jobs:

- name: Upload Python Dist
if: ${{ github.event.inputs.save_artifacts == 'true' }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<img src="https://img.shields.io/pypi/dm/numpymaxflow.svg?label=PyPI%20downloads&logo=python&logoColor=green"/>
[![CI Build](https://github.com/masadcv/numpymaxflow/actions/workflows/build.yml/badge.svg)](https://github.com/masadcv/numpymaxflow/actions/workflows/build.yml)
[![PyPI version](https://badge.fury.io/py/numpymaxflow.svg)](https://badge.fury.io/py/numpymaxflow)
<img src="https://img.shields.io/badge/Python-%203.8%20|%203.9%20|%203.10%20|%203.11-3776ab.svg"/>
<img src="https://img.shields.io/badge/numpy-%3E%3D%201.22.0-brightgreen.svg"/>
<img src="https://img.shields.io/badge/Python-%203.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-3776ab.svg"/>
<img src="https://img.shields.io/badge/numpy-%3E%3D%201.26.0-brightgreen.svg"/>

Numpy-based implementation of Max-flow/Min-cut based on the following paper:

Expand Down
4 changes: 2 additions & 2 deletions demo_maxflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def demo_interactive_maxflow():
bP = 1.0 - fP
Prob = np.asarray([bP, fP])

S = np.asarray(Image.open('data/brain_scrb.png').convert('L'))
S = np.copy(np.asarray(Image.open('data/brain_scrb.png').convert('L')))
Seed = np.asarray([S == 255, S == 170], np.float32)

lamda = 30.0
Expand Down Expand Up @@ -145,4 +145,4 @@ def test_interactive_max_flow3d():
elif(method == '3'):
test_interactive_max_flow3d()
else:
print("invalid number : {0:}".format(method))
print("invalid number : {0:}".format(method))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires=[
"setuptools",
"numpy==1.22.0",
"numpy==1.26.0",
"wheel"
]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
numpy==1.22.0
numpy==1.26.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
numpy>=1.22.0
numpy>=1.26.0,<2.0.0
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def get_extensions():

with open("requirements.txt", "r") as fp:
install_requires = fp.read().splitlines()
print(install_requires)

setup(
name="numpymaxflow",
version="0.0.6",
version="0.0.7",
description="numpymaxflow: Max-flow/Min-cut in Numpy for 2D images and 3D volumes",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -81,5 +82,5 @@ def get_extensions():
cmdclass={"build_ext": build_ext}, # .with_options(no_python_abi_suffix=True)},
packages=find_packages(exclude=("data", "docs", "examples", "scripts", "tests")),
ext_modules=get_extensions(),
python_requires=">=3.6",
python_requires=">=3.9",
)
Loading