Skip to content

Reduces complexity of simulator datatypes, add new datatypes. - #3004

Merged
janiversen merged 1 commit into
pymodbus-dev:devfrom
pkubanek:fix/int64_simulator
Aug 25, 2026
Merged

Reduces complexity of simulator datatypes, add new datatypes.#3004
janiversen merged 1 commit into
pymodbus-dev:devfrom
pkubanek:fix/int64_simulator

Conversation

@pkubanek

Copy link
Copy Markdown
Contributor

No description provided.

@pkubanek
pkubanek marked this pull request as draft August 24, 2026 22:12
@pkubanek
pkubanek force-pushed the fix/int64_simulator branch 3 times, most recently from 84c58ef to f45b7ea Compare August 24, 2026 22:43
@pkubanek
pkubanek marked this pull request as ready for review August 24, 2026 22:43
@pkubanek

Copy link
Copy Markdown
Contributor Author

I suppose some testing for all types and also for missing sections shall be added. We test now not all types are needed, but we shall also test when types are needed.

@pkubanek
pkubanek marked this pull request as draft August 24, 2026 22:45
- Uses enum features to replace ad-hoc helper objects.
- Introduce defaults for simulator config - .json parsing doesn't fail
  if some values or sections are missing (e.g. not all project need
  int64).
@pkubanek
pkubanek force-pushed the fix/int64_simulator branch from f45b7ea to c232891 Compare August 24, 2026 22:53
@pkubanek
pkubanek marked this pull request as ready for review August 24, 2026 22:55
@pkubanek

Copy link
Copy Markdown
Contributor Author

Also note that while zuban check in examples directory pass on Ubuntu, it fails for me on Windows - with same zuban version:

(venv) PS C:....\pymodbus> zuban check .\pymodbus\ .\examples\ .\test
examples\contrib\drainage_sim.py:35: error: "ModbusSequentialDataBlock" has no attribute "getValues" [attr-defined]
examples\contrib\drainage_sim.py:36: error: "ModbusSequentialDataBlock" has no attribute "getValues" [attr-defined]
examples\contrib\drainage_sim.py:41: error: "ModbusSequentialDataBlock" has no attribute "setValues" [attr-defined]
examples\contrib\drainage_sim.py:47: error: "ModbusSequentialDataBlock" has no attribute "getValues" [attr-defined]
examples\contrib\drainage_sim.py:48: error: "ModbusSequentialDataBlock" has no attribute "getValues" [attr-defined]
examples\contrib\drainage_sim.py:53: error: Unexpected keyword argument "device_ids" for "ModbusServerContext" [call-arg]
examples\contrib\drainage_sim.py:57: error: Unexpected keyword argument "device_ids" for "ModbusServerContext" [call-arg]
examples\contrib\solar.py:104: error: Unsupported operand types for * ("str" and "float") [operator]
examples\contrib\solar.py:104: error: Unsupported operand types for * ("list[bool]" and "float") [operator]
examples\contrib\solar.py:104: error: Unsupported operand types for * ("list[int]" and "float") [operator]
examples\contrib\solar.py:104: error: Unsupported operand types for * ("list[float]" and "float") [operator]
examples\contrib\solar.py:104: note: Both left and right operands are unions
examples\contrib\solar.py:104: error: Argument 2 to "convert_from_registers" of "ModbusClientMixin" has incompatible type "Enum"; expected "DATATYPE" [arg-type]
examples\contrib\solar.py:106: error: Argument 1 to "round" has incompatible type "int | float | str | Any | list[bool] | list[int] | list[float]"; expected "_SupportsRound2[int | float]" [arg-type]
examples\contrib\solar.py:110: error: Incompatible return value type (implicitly returns "None", expected "Enum") [return-value]
Found 14 errors in 2 files (checked 127 source files)
(venv) PS C:...\pymodbus> zuban --version
zuban 0.9.1

@janiversen

Copy link
Copy Markdown
Collaborator

That is because you run zuban on the contributed examples (test/contrib)

user supplied examples are not mantained by us and therefore not included in the test. See check_ci.sh

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks.

@janiversen
janiversen merged commit 1471443 into pymodbus-dev:dev Aug 25, 2026
33 of 34 checks passed
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.

2 participants