Skip to content

DEVPROD-15941: Upgrade to poetry 2.1.1 and allow Python >=3.11 #36

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

Merged
merged 3 commits into from
Mar 20, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
pip install poetry==1.3.2
pip install poetry==2.1.1
poetry install
- name: Test
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM quay.io/pypa/manylinux2014_x86_64

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN /opt/python/cp38-cp38/bin/pip install poetry==1.3.2
RUN /opt/python/cp311-cp311/bin/pip install poetry==2.1.1

ADD . signal_processing

Expand Down
798 changes: 426 additions & 372 deletions poetry.lock

Large diffs are not rendered by default.

39 changes: 25 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
[tool.poetry]
[project]
name = "signal-processing-algorithms"
version = "2.1.6"
description = "Signal Processing Algorithms from MongoDB"
authors = [
"Alexander Costas <alexander.costas@mongodb.com>",
"David Bradford <david.bradford@mongodb.com>",
"David Daly <david.daly@mongodb.com",
"Henrik Ingo <henrik.ingo@mongodb.com>",
"Jeff Zambory <jeff.zambory@mongodb.com>",
"Jim O'Leary <jim.oleary@mongodb.com>",
"Lydia Stepanek <lydia.stepanek@mongodb.com>"
{name = "Alexander Costas", email = "alexander.costas@mongodb.com"},
{name = "David Bradford", email = "david.bradford@mongodb.com"},
{name = "David Daly", email = "david.daly@mongodb.com"},
{name = "Henrik Ingo", email = "henrik.ingo@mongodb.com"},
{name = "Jeff Zambory", email = "jeff.zambory@mongodb.com"},
{name = "Jim O'Leary", email = "jim.oleary@mongodb.com"},
{name = "Lydia Stepanek", email = "lydia.stepanek@mongodb.com"},
]
license="Apache-2.0"
repository="https://github.com/mongodb/signal-processing-algorithms"
readme = "README.md"
build = "build.py"

dynamic = ["dependencies"]
requires-python=">=3.11,<4.0"

[project.urls]
Repository="https://github.com/mongodb/signal-processing-algorithms"


[build-system]
requires = ["setuptools"]

[tool.poetry.build]
script = "build.py"
generate-setup-file = true

[tool.poetry.dependencies]
python = "~3.11"
more-itertools = "^8.2.0"
setuptools = ">=65.5.1,<71.0.0"
scipy = "^1.8.1"
Expand All @@ -27,8 +38,8 @@ pyyaml="^6.0.0"
gevent="^24.10.1"
numpy = "^1.24.4"

[tool.poetry.dev-dependencies]
pytest = "^8.3.4"
[tool.poetry.group.dev.dependencies]
pytest = "^8.3.5"
pytest-black = "^0.3"
pytest-cov = "^2.8"
pytest-flake8 = "^1.3.0"
Expand All @@ -37,7 +48,7 @@ pytest-mypy = "^0.8"
pytest-pydocstyle = "^2.0.0"
hypothesis = "^5.19"
python-service-tools = "^0.4.4"
black = "^20.8b1"
black = "^25.1.0"

[tool.black]
line-length = 100
2 changes: 1 addition & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o pipefail
# is at the path below.
#
# For more information see: https://github.com/pypa/auditwheel
export PATH="$PATH:/opt/python/cp38-cp38/bin"
export PATH="$PATH:/opt/python/cp311-cp311/bin"

poetry build
find ./dist -name "*.whl" | xargs auditwheel repair
Expand Down
1 change: 1 addition & 0 deletions src/signal_processing_algorithms/determinism.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to help setup deterministic results when using random numbers."""

# E-Divisive's definition requires it to permute change-windows
# which leads to non-determinism: we need to always get the
# same change-point results when running on the same input.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""C Extension E-Divisive calculator."""

import os

from ctypes import c_bool, c_double, c_int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Energy statistics."""

from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -99,8 +100,8 @@ def _calculate_stats(x: float, y: float, xy: float, n: int, m: int) -> Tuple[flo
:return: The q value generated from the terms.
"""
xy_avg = xy / (n * m) if n > 0 and m > 0 else 0
x_avg = x / (n ** 2) if n > 0 else 0
y_avg = y / (m ** 2) if m > 0 else 0
x_avg = x / (n**2) if n > 0 else 0
y_avg = y / (m**2) if m > 0 else 0

# E-statistic
e = 2 * xy_avg - x_avg - y_avg
Expand Down
2 changes: 1 addition & 1 deletion src/signal_processing_algorithms/gesd.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def gesd(
value = (
(length - i - 1)
* percentage_point
/ np.sqrt((length - i - 2 + percentage_point ** 2) * (length - i))
/ np.sqrt((length - i - 2 + percentage_point**2) * (length - i))
)

# Update results.
Expand Down
1 change: 1 addition & 0 deletions tests/test_detection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Change points detection related tests.
"""

import numpy as np
import pytest

Expand Down