In requirements.txt, what does tilde equals (~=) mean?

In the requirements.txt for a Python library I am using, one of the requirements is specified like:

    mock-django~=0.6.10

What does ~= mean?

It means it will select the latest version of the package, greater or equal to 0.6.10, but still in the 0.6.* version, so it won't download 0.7.0 for example. It ensures you will get security fixes but keep backward-compatibility, if the package maintainer respects the semantic versioning (which states that breaking changes should occur only in major versions).

Or, as said by PEP 440:

For a given release identifier V.N , the compatible release clause is approximately equivalent to the pair of comparison clauses:

>= V.N, == V.*

From: stackoverflow.com/q/39590187