Skip to content
Closed
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
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 3.10
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 "Set up Python 3.10" is misleading since the actual Python version being set up is dynamic based on the matrix variable. The name should be updated to reflect this, for example: "Set up Python ${{ matrix.python-version }}" or simply "Set up Python".

Suggested change
- name: Set up Python 3.10
- name: Set up Python ${{ matrix.python-version }}

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
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

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 has been changed to include an upper bound of 3.12, effectively dropping support for Python 3.13. However, this appears inconsistent with the removal of the Python 3.13 classifier (line 50 in the diff). While this change may be intentional to match current compatibility, it would be helpful to ensure this aligns with the project's support policy and that users are properly informed through release notes or documentation.

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 dependency constraint was changed from pydantic>=1.10,<2 to just pydantic, removing the upper bound that prevented Pydantic v2 installation. The codebase in types.py uses Pydantic v1-specific APIs including the class Config: inner class pattern and update_forward_refs() method, both of which are incompatible with Pydantic v2. This will cause runtime errors when users install the package with Pydantic v2. Additionally, requirements.txt still has the old constraint pydantic >= 1.10, <2, creating an inconsistency between installation methods.

Additional Locations (1)

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.

The dependency version constraints are inconsistent between pyproject.toml and requirements.txt. In pyproject.toml, numpy and pydantic have no version constraints, but requirements.txt still specifies numpy >= 1.13.0 and pydantic >= 1.10, <2. These files should be kept in sync to avoid confusion and potential installation issues.

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

Copilot uses AI. Check for mistakes.
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 all version constraints from numpy and pydantic dependencies could lead to compatibility issues. While pydantic was previously constrained to <2, removing this constraint entirely may allow pydantic v2 to be installed, which has breaking changes from v1. Consider maintaining at least an upper bound constraint or testing compatibility with the latest versions before removing constraints entirely.

Suggested change
"numpy",
"pydantic",
"numpy<2.0",
"pydantic<2.0",

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

13 changes: 8 additions & 5 deletions src/keras2c.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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,14 +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
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
Requires-Dist: numpy
Requires-Dist: pydantic
Dynamic: license-file

#######
Expand All @@ -37,6 +36,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
pydantic
Loading
Loading