From 3247f6fed483f7afa42197c3b8a4c65ab1bb90c6 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 28 Aug 2026 14:46:36 -0700 Subject: [PATCH 1/8] Test on newer Python versions --- .github/workflows/pythonpackage.yml | 17 +++++++---------- pyproject.toml | 6 +----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index db8baf1..4796f4b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,28 +11,25 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.13", "3.14", "3.15"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - activate-environment: npf-dev environment-file: environment.yml - auto-activate-base: false + channels: conda-forge + channel-priority: strict + activate-environment: npf-dev + python-version: ${{ matrix.python-version }} + miniforge-version: latest - name: Conda metadata run: | conda info conda list - name: Lint run: | - set -euo pipefail - # Tell us what version we are using - ruff version - # Check the source file, ignore type annotations (ANN) for now. - ruff check numpy_financial/ benchmarks/ --ignore F403 --select E,F,B,I + spin lint - name: Build project run: | spin build -v diff --git a/pyproject.toml b/pyproject.toml index af2eb18..84dad79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ requires = [ [project] name = "numpy-financial" version = "2.0.0" -requires-python = ">=3.10" +requires-python = ">=3.13" description = "Simple financial functions" license = "BSD-3-Clause" authors = [{name = "Travis E. Oliphant et al."}] @@ -24,10 +24,6 @@ classifiers = [ "Intended Audience :: Financial and Insurance Industry", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development", "Topic :: Office/Business :: Financial :: Accounting", "Topic :: Office/Business :: Financial :: Investment", From af3291bf11a76f5e6a1457b39caff6765fe3fd76 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 28 Aug 2026 15:11:51 -0700 Subject: [PATCH 2/8] 3.15 not yet available --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4796f4b..3548f60 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.13", "3.14", "3.15"] + python-version: ["3.13", "3.14"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From 45f9aa319ad356a139da63deacd1ee8e2a1a3864 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:04:47 -0700 Subject: [PATCH 3/8] Test on Python 3.15 --- .github/workflows/pythonpackage.yml | 31 +++++++++++++++++++++++++++-- pyproject.toml | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3548f60..c9947ec 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -12,10 +12,22 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.13", "3.14"] + installer: ["conda"] + + include: + - os: "ubuntu-latest" + python-version: "3.15" + installer: "python" + - os: "windows-latest" + python-version: "3.15" + installer: "python" + steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - uses: actions/checkout@v5 + + - name: Set up Conda Python ${{ matrix.python-version }} uses: conda-incubator/setup-miniconda@v3 + if: matrix.installer == 'conda' with: environment-file: environment.yml channels: conda-forge @@ -24,9 +36,24 @@ jobs: python-version: ${{ matrix.python-version }} miniforge-version: latest - name: Conda metadata + if: matrix.installer == 'conda' run: | conda info conda list + + - name: Set up Python.org Python ${{ matrix.python-version }} + uses: actions/setup-python@v7 + if: matrix.installer == 'python' + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + cache: pip + - name: Install dependencies + if: matrix.installer == 'python' + run: | + pip install --only-deps .[dev,test] + pip list + - name: Lint run: | spin lint diff --git a/pyproject.toml b/pyproject.toml index 7c24fa5..cc0a9a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ doc = [ "myst-parser>=2.0.0", ] dev = [ + "spin", "ruff>=0.11.5", "asv>=0.6.0", "mypy", From 969a7073f1a67cf83fe49b707d2ca8be90551618 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:04:57 -0700 Subject: [PATCH 4/8] Add test instructions --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index de91eed..ef6b0ce 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,11 @@ alias is `npf`. For example, >>> npf.irr([-250000, 100000, 150000, 200000, 250000, 300000]) 0.5672303344358536 ``` + +## Development + +Test the package: + +``` +spin test -- --doctest-modules +``` From 8ef5cfe3a3f4fe418d6e5fffb0d0d1c44192d02c Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:21:13 -0700 Subject: [PATCH 5/8] Add NumPy as runtime dependency --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index cc0a9a0..d854b4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,9 @@ classifiers = [ "Operating System :: MacOS", "Typing :: Typed", ] +dependencies = [ + "numpy>=1.23.5" +] [project.optional-dependencies] test = [ From b639c6f4d70e4f97161c48bc53ebedde8117405e Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:22:26 -0700 Subject: [PATCH 6/8] Type check on 3.14 --- .github/workflows/type_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/type_check.yml b/.github/workflows/type_check.yml index 29050d5..36f55d5 100644 --- a/.github/workflows/type_check.yml +++ b/.github/workflows/type_check.yml @@ -19,7 +19,7 @@ jobs: - uses: astral-sh/setup-uv@v6 with: - python-version: "3.11" + python-version: "3.14" activate-environment: true - name: env setup From 880f3abd3205bdcbcef1d9d26a6c3ca177565c36 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:23:39 -0700 Subject: [PATCH 7/8] Add linting requirements to environment.yml --- environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index 0c21dac..13d28c1 100644 --- a/environment.yml +++ b/environment.yml @@ -27,6 +27,8 @@ dependencies: - pydata-sphinx-theme>=0.15.0 # Lint - ruff>=0.11.5 + - mypy + - pyright # Benchmarks - asv>=0.6.0 # Misc tools From 828507f0a66ced8e9b3f7044c70ad0dfcf2e19bd Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 2 Sep 2026 16:44:43 -0700 Subject: [PATCH 8/8] Install build dependencies before building --- .github/workflows/pythonpackage.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c9947ec..a9b631b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -51,6 +51,10 @@ jobs: - name: Install dependencies if: matrix.installer == 'python' run: | + # Unfortunately, no pip install --only-build-deps command yet, + # so we have to jump through some hoops. + pip install $(python -c 'import tomllib; print(" ".join(tomllib.load(open("pyproject.toml", "rb"))["build-system"]["requires"]))') + pip install --only-deps .[dev,test] pip list