Skip to content
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
16 changes: 0 additions & 16 deletions .github/workflows/greetings.yml

This file was deleted.

70 changes: 35 additions & 35 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python application

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

permissions:
contents: read
Expand All @@ -22,36 +22,36 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up build tools on Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
make
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: bash
- name: Lint with ruff
run: |
ruff check .
shell: bash
- name: Build C library
run: make CC=gcc -C include
shell: bash
- name: Test with pytest
env:
CC: gcc
run: |
pytest
shell: bash
- uses: actions/checkout@v4
- name: Set up build tools on Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
make
- name: Set up Python
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step name was changed from "Set up Python 3.10" to "Set up Python", but the comment is somewhat misleading since the version is parameterized through the matrix strategy rather than being hardcoded. While this change improves flexibility, consider whether the workflow matrix actually includes all the Python versions the package claims to support (3.7-3.12 based on the new constraints).

Copilot uses AI. Check for mistakes.
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: bash
- name: Lint with ruff
run: |
ruff check .
shell: bash
- name: Build C library
run: make CC=gcc -C include
shell: bash
- name: Test with pytest
env:
CC: gcc
run: |
pytest
shell: bash
31 changes: 0 additions & 31 deletions .github/workflows/python-package-conda.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/stale.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/summary.yml

This file was deleted.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ build-backend = "setuptools.build_meta"
[project]
dynamic = ["version"]
name = "keras2c"
requires-python = ">=3.7"
requires-python = ">=3.7, <=3.12"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis CI tests Python versions excluded by new constraints

The requires-python constraint was changed to >=3.7, <=3.12, but the existing .travis.yml configuration still tests Python 3.6 and Python 3.13. When Travis CI runs, pip installations will fail for these Python versions because the package explicitly declares it doesn't support them. This causes CI test failures for two matrix entries without any code change notification.

Fix in Cursor Fix in Web

Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upper bound constraint <=3.12 on Python version is overly restrictive and will prevent this package from being used with Python 3.13 and future versions. Unless there's a specific incompatibility, it's generally better practice to avoid upper bounds on Python versions to allow forward compatibility. If Python 3.13 support isn't ready yet, consider testing and supporting it rather than permanently blocking it.

Suggested change
requires-python = ">=3.7, <=3.12"
requires-python = ">=3.7"

Copilot uses AI. Check for mistakes.
dependencies = [
"tensorflow>=2.0",
"keras",
"numpy>=1.13.0",
"pydantic>=1.10,<2",
"numpy",
"pydantic",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pydantic v2 incompatibility due to removed version constraint

The pydantic version constraint >=1.10,<2 was removed from pyproject.toml, but the code in src/keras2c/types.py uses pydantic v1-specific APIs that don't exist in pydantic v2. Specifically, update_forward_refs() (replaced by model_rebuild() in v2) and nested class Config: (replaced by model_config = ConfigDict(...) in v2) will cause runtime errors when pydantic 2.x is installed. Meanwhile, requirements.txt and environment.yml still retain the <2 constraint, creating an inconsistency where pip installs may break while conda installs work.

Fix in Cursor Fix in Web

Comment on lines +12 to +13
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing version constraints from numpy and pydantic dependencies can lead to compatibility issues. The original constraints (numpy>=1.13.0 and pydantic>=1.10,<2) were likely in place for good reasons. Specifically, pydantic v2 introduced breaking changes from v1, so removing the upper bound could break existing code. Consider keeping at least the pydantic version constraint to avoid unexpected breaking changes.

Suggested change
"numpy",
"pydantic",
"numpy>=1.13.0",
"pydantic>=1.10,<2",

Copilot uses AI. Check for mistakes.
]
authors = [
{name = "Rory Conlin", email = "wconlin@princeton.edu"},
Expand All @@ -19,7 +19,8 @@ authors = [
{name = "Egemen Kolemen", email = "ekolemen@princeton.edu"},
]
maintainers = [
{name = "Peter Steiner", email = "peter.steiner@princeton.edu"}
{name = "Peter Steiner", email = "peter.steiner@princeton.edu"},
{name = "Nathaniel Chen", email = "nathaniel@princeton.edu"}
]
description = "A library for converting Keras neural networks to real-time compatible C."
readme = "README.rst"
Expand All @@ -46,7 +47,6 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.urls]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
numpy >= 1.13.0
tensorflow >= 2.0
pydantic >= 1.10, <2

16 changes: 9 additions & 7 deletions src/keras2c.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metadata-Version: 2.4
Metadata-Version: 2.1
Name: keras2c
Version: 0.1
Summary: A library for converting Keras neural networks to real-time compatible C.
Author-email: Rory Conlin <wconlin@princeton.edu>, Keith Erickson <kerickso@pppl.gov>, Joseph Abbate <jabbate@princeton.edu>, Egemen Kolemen <ekolemen@princeton.edu>
Maintainer-email: Peter Steiner <peter.steiner@princeton.edu>
Maintainer-email: Peter Steiner <peter.steiner@princeton.edu>, Nathaniel Chen <nathaniel@princeton.edu>
License: LGPLv3 License
Project-URL: Documentation, https://f0uriest.github.io/keras2c/
Project-URL: Repository, https://github.com/f0uriest/keras2c/
Expand All @@ -19,15 +19,13 @@ Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.7
Requires-Python: <=3.12,>=3.7
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python version constraint change from ">=3.7" to "<=3.12,>=3.7" adds an upper bound that will prevent installation on Python 3.13 and later. This is generally not recommended unless there are known incompatibilities, as it prevents users from adopting newer Python versions. The lock file also shows this package had Python 3.13 support previously (line 22 in the diff shows "Programming Language :: Python :: 3.13" was removed), suggesting this is a regression in supported Python versions.

Suggested change
Requires-Python: <=3.12,>=3.7
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.7

Copilot uses AI. Check for mistakes.
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: tensorflow>=2.0
Requires-Dist: keras
Requires-Dist: numpy>=1.13.0
Requires-Dist: pydantic<2,>=1.10
Dynamic: license-file
Requires-Dist: numpy
Requires-Dist: pydantic

#######
keras2c
Expand All @@ -37,6 +35,10 @@ keras2c

|License| |DOI|

IMPORTANT: Keras2C has started updating to be compatible with newer versions of Python on July 9th, 2025. Changes may be breaking. To use the original/stable version, use the Release v1.0.2. https://github.com/PlasmaControl/keras2c/releases/tag/v1.0.2 with the command
.. code-block:: bash

git clone git@github.com:PlasmaControl/keras2c.git --branch v1.0.2

keras2c is a library for deploying keras neural networks in C99, using only standard libraries.
It is designed to be as simple as possible for real time applications.
Expand Down
4 changes: 2 additions & 2 deletions src/keras2c.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tensorflow>=2.0
keras
numpy>=1.13.0
pydantic<2,>=1.10
numpy
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the version constraint from numpy (was "numpy>=1.13.0") could lead to compatibility issues. While numpy 1.13.0 is quite old, having a minimum version ensures compatibility with the codebase. Consider keeping at least a minimum version constraint to avoid potential breaking changes from very old or very new numpy versions.

Suggested change
numpy
numpy>=1.13.0

Copilot uses AI. Check for mistakes.
pydantic
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the version constraint from pydantic (was "pydantic<2,>=1.10") is a critical issue. Pydantic v2 introduced significant breaking changes from v1, including changes to the API, validation behavior, and configuration. Without this constraint, users could inadvertently install pydantic v2 and encounter runtime errors or unexpected behavior. This constraint should be retained to prevent breaking changes.

Suggested change
pydantic
pydantic<2,>=1.10

Copilot uses AI. Check for mistakes.
Loading