Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
126 views
in Technique[技术] by (71.8m points)

python - Could a patch include an addition in SemVer?

I'm trying to adopt a version control system for a python package I'm working on (I'm very new to these systems), and I have been reading up on semantic versioning. I like the system a lot, but there are situations in which I have some second thoughts, particularly for something like this:

Suppose (silly example) our v0.1.0 package has a class Bob with several methods:

class Bob:
    def __init__(self, age, coolness):
        self.age = age
        self.coolness = coolness

    def says_hi(self):
        return "Hi!"

    def says_bye(self):
        return "Bye!" 

Say we add the following extremely simple method:

    def says_good_day(self):
        return "Good day!"

... and now an extremely complex method:

    def explains_the_meaning_of_life(self):
        ... # bob explains it here

By the semantic versioning rules, any backwards compatible addition should increment the minor version by 1. As such, if we implemented these two methods separately, we'd have incremented to v0.3.0 by now. But I find it unusual that we would assign the same "weight" to these two backwards compatible additions, despite the fact that one is extremely simple and one extremely complex. Could you justify assigning the first addition as a patch update and the second as a minor update? Am I misunderstanding the point of semantic versioning by even considering "complicated" versus "simple" additions, i.e. an addition is just an addition?

question from:https://stackoverflow.com/questions/65893311/could-a-patch-include-an-addition-in-semver

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Am I misunderstanding the point of semantic versioning by even considering "complicated" versus "simple" additions, i.e. an addition is just an addition?

Yes, I would say so. Semantic versioning is not concerned with complexity of a change, but rather the impact that change will have on existing clients who upgrade to the new version. In this case, the impact is the same: a new feature was added in a backwards-compatible way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...