Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semver-object #40

Closed
Thor77 opened this issue Nov 28, 2016 · 5 comments
Closed

semver-object #40

Thor77 opened this issue Nov 28, 2016 · 5 comments

Comments

@Thor77
Copy link

Thor77 commented Nov 28, 2016

In my opinion your approach to parsing is quite "unpythonic", I would prefer smth like this:

info = semver('1.0.0')

that would allow easy comparison with

>> semver('1.0.0') > semver('2.0.0')
>> False

(yes I know there's semver.compare for that)
Python is a object-orientated language after all ;)

@k-bx
Copy link
Contributor

k-bx commented Nov 28, 2016

@Thor77 you can already do that:

In [3]: info1 = semver.parse_version_info('1.0.0')

In [4]: info2 = semver.parse_version_info('2.0.0')

In [5]: info1 > info2
Out[5]: False

@Thor77
Copy link
Author

Thor77 commented Nov 29, 2016

I know there are already ways to accomplish this in your library, but they're verbose and not object-orientated.
For example

ver = semver.parse_version_info('1.0.0')
ver.bump_{major,minor,patch}()

does not work.
But maybe this usecase is not even the usecase of this library, so feel free to just close this :)

@k-bx
Copy link
Contributor

k-bx commented Nov 29, 2016

@Thor77 ah, I see what you mean. So, if you want to make a nice PR implementing a Semver class with all the object-oriented functionality, I wouldn't mind accepting it :)

@scls19fr
Copy link
Member

scls19fr commented May 15, 2018

Although I'm not a big fan of an "all object" approach (or too much objects), I think a static method named parse for VersionInfo could be an interesting idea.

from semver import VersionInfo
VersionInfo.parse("1.2.3")

@scls19fr
Copy link
Member

scls19fr commented Oct 1, 2019

@Thor77 I think after PR #88 and #141 we can close this (quite old) issue!
Please feel to reopen if you think that's necessary.

@scls19fr scls19fr closed this as completed Oct 1, 2019
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

No branches or pull requests

3 participants