question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deprecate missing module-level functions (like semver.compare, semver.match, ...)

See original GitHub issue

Situation

We deprecated most of our module-level functions, but it seems, I forgot semver.match.

Proposal

I assume, this function should also be added to the list of deprecated function. It also should be moved to the semver.VersionInfo class.

@python-semver/reviewers Any objections?


There are some other module-level functions:

  • semver.compare
  • semver.max_ver
  • semver.min_ver

@gsakkis: What should we do with these? Deprecate them too and move them to the semver.VersionInfo class?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
scls19frcommented, Apr 18, 2020

No objection. Python is not Julia. So let’s prefer methods instead over functions.

1reaction
Askaholiccommented, May 17, 2020

As someone who contributes to a project that uses this library I have to say that I disagree with these deprecations. Replacing semver.compare(version1, version2) with semver.VersionInfo.parse(version1).compare(version2) is just an ugly solution. The first one is clean, easy to read and easy to understand. The second one is ugly, and unnecessarily verbose.

I think your refactor to use VersionInfo under the hood is a great solution, but I don’t see why the compare convenience function needs to become deprecated in the process. I would guess that most use cases of this library are fairly simple, as is the case for my project, and for those use cases semver.compare is objectively better.

Let me counter @scls19fr 's comment with this:

Python is not Java. You do not need to make everything a class.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using semver — python-semver 2.13.0 documentation
Module level functions are marked as deprecated in version 2.10.0 now. ... fine-grained approach of comparing two versions, use the semver.match() function.
Read more >
python-semver Documentation - Read the Docs
module level functions are marked as deprecated since version 2. ... approach of comparing two versions, use the semver.match() function.
Read more >
Semantic Versioning 2.0.0 | Semantic Versioning
Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes; MINOR version when you add functionality in a ......
Read more >
Reference — python-semanticversion 2.1.0 documentation
Provides comparison methods with other Version objects. The rules are: For non-partial versions, compare using the SemVer scheme. If any compared object is ......
Read more >
draft-verdt-netmod-yang-semver-00 - IETF Datatracker
YANG Semantic Versioning for Modules (Internet-Draft, 2019) ... 'status' statement to allow additional documentation as to why a node is being deprecated, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found