ModbusSlaveContext is not importable from pymodbus.datastore anymore
from pymodbus.datastore import ModbusSlaveContext
works in v3.9.2, but not in v3.10.0
see https://github.com/pymodbus-dev/pymodbus/compare/v3.9.2...v3.10.0 -> context.py
since this is a minor release, it should not break existing imports, IMHO.
// EDIT: trying to upgrade to 3.10.0, I realized that this minor release changes a lot more and essentially breaks a lot more programming APIs than I expected.
// EDIT 2: seeing that this project changes API for most new minor releases, I would like to raise the question if that's the best way to go. In my opinion,
Major releases can do whatever, break APIs, etc Minor releases should add new features, but don't break existing ones, this includes API definitions. Patch releases should fix bugs or improve performance but neither change nor add new features.
I would really like to understand why pymodbus does it differently :-) - thanks
Did you read the release notes, or the API changes ????
Pymodbus does not do it "differently", if you look at the README our release structure is defined. I believe you talk about following https://semver.org standard, but may I politely remind you that we have nowhere documented to follow that standard so it is rather strange that you assume we do.
A lot of major open source projects do not follow the semver standard (among the better knowns: HomeAssistant, LibreOffice, OpenOffice), many of those follow the same definition as pymodbus. It is correct that many projects follow the standard, but it is not demanded anywhere.
The reason we do not follow the semver standard is twofold:
- We would be at something like 120.x.x following the standard
- Users would not know if the changes are simple editing (x.y release) or they need to rewrite their logic (x release).
You are of course free to have your opinion, but please allow the maintainers of this project, who are actually doing the work, to also have an opinion.
Thanks for the answer.
I have not read the README.md, where the first paragraph clearly explains how you do releases. I should have done that. I apologize.
You are of course free to have your opinion, but please allow the maintainers of this project, who are actually doing the work, to also have an opinion.
I never discredited the opinion or work of others working on this project, I only stated my opinion and asked why it's done differently to what I described. Different doesn't mean worse.
I can understand that you get a little upset, if someone opens an issue without reading the README - mea culpa.
Without wanting to start a big discussion in this thread - again all just my opinion based on my experience:
A lot of major open source projects do not follow the semver standard (among the better knowns: HomeAssistant, LibreOffice, OpenOffice)
Those are all products and for those semver isn't that relevant. pymodbus is a library, which other software depends on. That's why keeping APIs backwards compatible in minor releases makes sense, because you don't want the users of your library to update their code for every new release.
We would be at something like 120.x.x following the standard
Only when you make incompatible API changes. If you add functionality in a backward compatible manner, you can do minor releases.
You have another experience, than I, and that of course is totally valid !
All 3 have libraries, which in case of home assistant are used by the majority of the users !! But let me give you a couple of other examples:
- python itself (we ran into major issues when upgrading to python 3.13) follows the same release pattern as pymodbus
- Node.js
This article gives a pretty good explanation https://gist.github.com/jashkenas/cbd2b088e20279ae2c8e
In our experience it is very difficult to add most functionality in a backward manner, think of e.g. slave= renamed to device=, of course we could leave slave= but then we would need to add code to determine what happens if both slave= and device= are defined, which is extra maintenance.....and then sometime later when removing slave= the problem would be the same. In essence this would mean that there would never be a x.y release (to save maintenance) because making the x.y release only pospones the problem.
Functionality that are backward compatible is added as x.y.z (allowing you to plugin)
I would argue that python and node.js are not libraries but platforms. You rarely define python as a dependency in any project with packages managers like uv or poetry or node.js with yarn or npm.
I've read the github gist, and I get where you and they are coming from, but then x.y.z versioning scheme is maybe not the best choice, because there are certain expectation to that scheme because it looks like semver, but isn't in some/many? cases.
I like https://gist.github.com/jashkenas/cbd2b088e20279ae2c8e?permalink_comment_id=5144385#gistcomment-5144385 that will at least let everyone know that its either semver or "Human/romantic versioning"
In our experience it is very difficult to add most functionality in a backward manner, think of e.g. slave= renamed to device=, of course we could leave slave= but then we would need to add code to determine what happens if both slave= and device= are defined, which is extra maintenance.....and then sometime later when removing slave= the problem would be the same. In essence this would mean that there would never be a x.y release (to save maintenance) because making the x.y release only pospones the problem.
Agreed, maintaining backwards compatibility is not free and needs maintenance. There are multiple ways of doing that, for example you could keep both interface names and the implementation around until the next major release - there you remove all the deprecated stuff.
Sticking to semver also forces you to think a little more about how you structure your APIs, because changing/breaking them induces maintenance cost.
Of course I also understand, that this is an open source library, maintained by volunteers (much appreciated btw :-) ), who probably do not have the time and resources to maintain an API backwards compatible all too long.
In the end it would be nice to know what to expect when pulling pymodbus, and you put it on the very top of your README.md, so you did it perfectly in that regard.
I think there should be a better way, where it is immediately clear from the version number that this lib doesn't follow semver, and that minor releases may break API changes, but that's more of an industry issue and wouldn't really know how to solve this, except for inventing some new scheme, which would then confuse someone else.
I politely disagree with your argument about python, you will find python as a dependency in every serious library...maintainers do that to show which versions of python that works with the library...so it makes a lot of sense to do it.
Being open source we all fight to keep maintenance costs as low as possible (without sacrificing quality!), so slave= to device= would automatically be a major release, even though it is a simple edit. Looking at the pymodbus release schedule, you would have had a major release every second month, I am sure that it also something you would not like. The semver world do not force us to think more, just to make a lot more major releases, without a single hour of extra maintenance cost.
This discussion have been around since the 80ties, before internet, back when we had bulletin boards using modem pools, it started together with open source, the problem is fundamentally unsolvable, it is a builtin conflict between users and maintainers of a library. The base problem is that open source is not commercial software, meaning (nearly) nobody get paid, anybody who have a problem solves exactly that (many times even without tests), and we the maintainers merge all those fragments into a release, and honestly do not think a lot about backward compatibility etc, for one good reason, you being a library user are not forced to upgrade but decides when you want to upgrade.
I can already see the reply: some bugs was solved, which you need, you want the fixes without the rest.....but that is really independent of whether it is a major or minor release, both are allowed to include bug fixes in the semver world.
Please remember you could spent the time to prepare a PR with a x.y.z release or make PR´s with ensures backward compatibility instead of just asking others to do it, THAT is what open source is all about.
Whenever you pull a release, you should really read the release notes, that tells you what is changed, and you can see if it affects your program. Reading the release notes is the best guarantee around, independent of the version number scheme.
Even bug fixes can have effects on your program. v3.10 changes the returning bit order, due to a bug, so if your program checks on e.g. but 17 it might now be bit 3.....this was actually scheduled for v3.9.3, but even though being a bug fix, we moved it to a minor release, due to the severity.
I politely disagree with your argument about python, you will find python as a dependency in every serious library...maintainers do that to show which versions of python that works with the library...so it makes a lot of sense to do it.
To indicate what python versions work with a library is not the same as being a library. and thats also not what I meant when I made that statement.
Being open source we all fight to keep maintenance costs as low as possible (without sacrificing quality!), so slave= to device= would automatically be a major release, even though it is a simple edit.
I did not say that you should create a major release for every api change, I said you should keep api changes to a minimum.
Looking at the pymodbus release schedule, you would have had a major release every second month, I am sure that it also something you would not like.
Don't do slave= to device= in a minor release then. If you absolutely have to, wrap and deprecate the old feature. Lot's of libraries do that. Also I wouldn't mind a major version every second month. That way I would have at least the knowledge about breaking API changes.
The semver world do not force us to think more, just to make a lot more major releases, without a single hour of extra maintenance cost.
Yes it would, it you where forced to stick to it and if you wouldnt like many major releases, you would think twice about introducing api changes that often.
This discussion have been around since the 80ties, before internet, back when we had bulletin boards using modem pools, it started together with open source, the problem is fundamentally unsolvable, it is a builtin conflict between users and maintainers of a library.
I agree on that one. I maintain libraries at work internally. They have to be backwards compatible, because otherwise the lib users would be really upset and it would be a money drain. It's not black and white - there can be a middle ground :)
The base problem is that open source is not commercial software, meaning (nearly) nobody get paid, anybody who have a problem solves exactly that (many times even without tests), and we the maintainers merge all those fragments into a release, and honestly do not think a lot about backward compatibility etc, for one good reason, you being a library user are not forced to upgrade but decides when you want to upgrade.
I literally agreed with you on that in my last post.
I can already see the reply: some bugs was solved, which you need, you want the fixes without the rest.....but that is really independent of whether it is a major or minor release, both are allowed to include bug fixes in the semver world.
That was uncalled for: "you want the fixes without the rest" - I don't know where you get that from, but I never said that or indicated that. Very rude!
Please remember you could spent the time to prepare a PR with a x.y.z release or make PR´s with ensures backward compatibility instead of just asking others to do it, THAT is what open source is all about.
Again: uncalled for. I never asked others to do anything for me. I created the ticket, thinking that it was a bug. Then I read the API changes and asked why semver wasn't used.
Whenever you pull a release, you should really read the release notes, that tells you what is changed, and you can see if it affects your program. Reading the release notes is the best guarantee around, independent of the version number scheme.
Again - I apologized for not reading the README. The best guarantee however, is having automated tests, that catch these changes if a library is upgraded. It would be way to much effort to read the release notes of every library that I'm using.
Even bug fixes can have effects on your program. v3.10 changes the returning bit order, due to a bug, so if your program checks on e.g. but 17 it might now be bit 3.....this was actually scheduled for v3.9.3, but even though being a bug fix, we moved it to a minor release, due to the severity.
True that can happen, but bugs are not intentional. Hasn't really anything todo with semver or other versioning schemes.
Anyways, I would like to end the discussion here. Let's agree to disagree - at least on some things discussed here. Cheers
- That was uncalled for: "you want the fixes without the rest" - I don't know where you get that from, but I never said that or indicated that. Very rude!
You did not say that, but I get it very often (please make a release with these x bug fixes).
- Again: uncalled for. I never asked others to do anything for me. I created the ticket, thinking that it was a bug. Then I read the API changes and asked why semver wasn't used.
Well you recommended using semver.
But yah no reason to go more in depth.
Have a good day.
Fyi: If you want automated tests, feel free to copy, pymodbus have around 1.100 that runs on every commit.