packaging
packaging copied to clipboard
Allow modifying versions
Fixes #659
Let me know if something like this seems acceptable to you and I'll add tests and documentation.
Some notes:
- My use case was adding a local version to an existing version
- I don't think it would make sense to allow replacing parts of the release, e.g. "major", since I don't really see a use case. Things like
v.replace(major=v.major+1)
are probably just mistakes since other parts don't get reset. - This is why I don't allow replacing
epoch
. One could make an argument that we shouldn't allow replacingrelease
either, thoughts? (E.g. when would it make sense to replace therelease
but keep thepre
?) -
Version.__new__(Version)
is a little gross, as is the munging. The munging is designed to line up with the corresponding properties, sov.replace(xyz=v.xyz)
always works.
The general approach looks okay to me (with Tzu-ping's comments). @pradyunsg ?
FYI I converted this to a draft until there are tests and documentation.
@pradyunsg ?
Same. I'm on board for this approach, assuming tests + docs + existing review comments are addressed. :)
Hello. If it is not intentional to keep props readonly why not just add setters for smooth increment? e.g.
a = Version('1.2.3')
a.minor += 1
If it is not intentional to keep props readonly
Where do you get this impression?