Skip to content

Commit

Permalink
removed versions to let pip handle it. removed 3.9 from support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blotz committed Nov 26, 2024
1 parent 0e2203d commit cae5a01
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import nox

@nox.session(python=['3.10', '3.11', '3.12', '3.13'])
def tests(session):
session.install('--ignore-requires-python','.[test]')
session.run('pytest', '.')
26 changes: 20 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ authors = [
]
description = "A Python CLI tool for sorting pixels in images."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
'numpy>=1.26.4,<2.2.0',
'scipy>=1.12.0',
'opencv-python>=4.8.1.78',
'filetype~=1.2.0'
'numpy',
'scipy',
'opencv-python',
'filetype'
]

[project.urls]
Expand All @@ -32,7 +37,7 @@ pixelsort = "pixelsort.__main__:main"

[project.optional-dependencies]
test = [
'pytest>=7.3.2,<8.4.0'
'pytest',
]

[tool.pytest.ini_options]
Expand All @@ -41,3 +46,12 @@ addopts = "-ra -q"
testpaths = [
"tests"
]

# [tool.tox]
# requires = ["tox>=4.19"]
# env_list = ["py313", "py312", "py311", "py310", "local"]

# [tool.tox.env_run_base]
# description = "Run test under {base_python}"
# commands = [["pytest"]]
# allowlist_externals = ["pytest"]
6 changes: 4 additions & 2 deletions src/pixelsort/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ def create_contrast_mask(image: np.ndarray, threshold: float) -> np.ndarray:
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
mean, std = cv2.meanStdDev(gray_image)
# Calculate the lower and upper threshold values
lower_thresh = int(mean - threshold * std)
upper_thresh = int(mean + threshold * std)
# Conversion of an array with ndim > 0 to a scalar is deprecated.
# Using .item() to extract to single value.
lower_thresh = int(mean.item() - threshold * std.item())
upper_thresh = int(mean.item() + threshold * std.item())
# generate mask
contrast: np.ndarray = cv2.inRange(gray_image, lower_thresh, upper_thresh)
return contrast
Expand Down

0 comments on commit cae5a01

Please sign in to comment.