Skip to content

Conversation

@Grufoony
Copy link
Collaborator

@Grufoony Grufoony commented Jun 3, 2025

No description provided.

@Grufoony Grufoony linked an issue Jun 3, 2025 that may be closed by this pull request
setup.py Outdated
import os
import sys
import platform
import subprocess

Check notice

Code scanning / Bandit (reported by Codacy)

Consider possible security implications associated with subprocess module. Note

Consider possible security implications associated with subprocess module.
class CMakeBuild(build_ext):
def run(self):
try:
subprocess.check_output(["cmake", "--version"])

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note

subprocess call - check for execution of untrusted input.
class CMakeBuild(build_ext):
def run(self):
try:
subprocess.check_output(["cmake", "--version"])

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note

Starting a process with a partial executable path
# Use Ninja if available in the current environment, otherwise use Unix Makefiles
use_ninja = False
try:
subprocess.check_output(["ninja", "--version"])

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note

Starting a process with a partial executable path
# Use Ninja if available in the current environment, otherwise use Unix Makefiles
use_ninja = False
try:
subprocess.check_output(["ninja", "--version"])

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note

subprocess call - check for execution of untrusted input.
else:
cmake_args += ["-G", "Unix Makefiles"]

subprocess.check_call(["cmake", ext.sourcedir] + cmake_args, cwd=build_temp)

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note

subprocess call - check for execution of untrusted input.
cmake_args += ["-G", "Unix Makefiles"]

subprocess.check_call(["cmake", ext.sourcedir] + cmake_args, cwd=build_temp)
subprocess.check_call(

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note

subprocess call - check for execution of untrusted input.
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@Grufoony Grufoony requested a review from Copilot June 3, 2025 08:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR renames the framework from dsm to dsf and adds support for Python bindings.

  • Renames all dsm references to dsf across source, examples, benchmarks, and documentation.
  • Updates build scripts and CMake files to reflect the new naming and include Python bindings support.

Reviewed Changes

Copilot reviewed 85 out of 85 changed files in this pull request and generated 1 comment.

File Description
examples/stalingrado.cpp, slow_charge_tl.cpp, etc. Updates include renaming of headers, namespace, and logging calls from dsm to dsf.
examples/README.md Documentation updated to reflect new dsf naming and build instructions.
CMakeLists.txt (project root) Project configuration and library setup updated with dynamic version extraction and Python bindings option.
Benchmark and workflow files All benchmark and CI configuration files updated to include dsf rather than dsm.

Comment on lines +5 to +11
string(REGEX MATCH "DSF_VERSION_MAJOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_MAJOR ${CMAKE_MATCH_1})
string(REGEX MATCH "DSF_VERSION_MINOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_MINOR ${CMAKE_MATCH_1})
string(REGEX MATCH "DSF_VERSION_PATCH = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_PATCH ${CMAKE_MATCH_1})

Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

Consider adding a fallback or error-handling mechanism if the version extraction from dsf.hpp fails, to ensure that an appropriate version is always set during the build.

Suggested change
string(REGEX MATCH "DSF_VERSION_MAJOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_MAJOR ${CMAKE_MATCH_1})
string(REGEX MATCH "DSF_VERSION_MINOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_MINOR ${CMAKE_MATCH_1})
string(REGEX MATCH "DSF_VERSION_PATCH = ([0-9]+)" _ ${DSF_HPP_CONTENT})
set(DSF_VERSION_PATCH ${CMAKE_MATCH_1})
if(NOT DEFINED DSF_HPP_CONTENT OR DSF_HPP_CONTENT STREQUAL "")
message(WARNING "Failed to read dsf.hpp. Using default version 0.0.0.")
set(DSF_VERSION_MAJOR 0)
set(DSF_VERSION_MINOR 0)
set(DSF_VERSION_PATCH 0)
else()
string(REGEX MATCH "DSF_VERSION_MAJOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
if(NOT DEFINED CMAKE_MATCH_1)
message(WARNING "Failed to extract DSF_VERSION_MAJOR. Using default value 0.")
set(DSF_VERSION_MAJOR 0)
else()
set(DSF_VERSION_MAJOR ${CMAKE_MATCH_1})
endif()
string(REGEX MATCH "DSF_VERSION_MINOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
if(NOT DEFINED CMAKE_MATCH_1)
message(WARNING "Failed to extract DSF_VERSION_MINOR. Using default value 0.")
set(DSF_VERSION_MINOR 0)
else()
set(DSF_VERSION_MINOR ${CMAKE_MATCH_1})
endif()
string(REGEX MATCH "DSF_VERSION_PATCH = ([0-9]+)" _ ${DSF_HPP_CONTENT})
if(NOT DEFINED CMAKE_MATCH_1)
message(WARNING "Failed to extract DSF_VERSION_PATCH. Using default value 0.")
set(DSF_VERSION_PATCH 0)
else()
set(DSF_VERSION_PATCH ${CMAKE_MATCH_1})
endif()
endif()

Copilot uses AI. Check for mistakes.
return "unknown"


class CMakeExtension(Extension): # pylint: disable=too-few-public-methods

Check warning

Code scanning / Prospector (reported by Codacy)

Locally disabling too-few-public-methods (R0903) (locally-disabled) Warning

Locally disabling too-few-public-methods (R0903) (locally-disabled)
@codecov
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 83.83838% with 48 lines in your changes missing coverage. Please review.

Project coverage is 84.48%. Comparing base (4fab95e) to head (daadd60).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/dsf/headers/RoadDynamics.hpp 52.12% 45 Missing ⚠️
src/dsf/sources/RoadNetwork.cpp 75.00% 2 Missing ⚠️
src/dsf/sources/Street.cpp 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
- Coverage   84.78%   84.48%   -0.30%     
==========================================
  Files          38       38              
  Lines        5574     5673      +99     
  Branches      572      578       +6     
==========================================
+ Hits         4726     4793      +67     
- Misses        848      880      +32     
Flag Coverage Δ
unittests 84.48% <83.83%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Grufoony Grufoony merged commit c265991 into main Jun 16, 2025
17 checks passed
@Grufoony Grufoony deleted the pybind branch June 16, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Python binding for FirstOrderDynamics class

2 participants