Compatibility Policy

    Deprecation

    Before we remove a feature in a major release, PyMongo’s maintainers make an effort to release at least one minor version that deprecates it. We add “DEPRECATED” to the feature’s documentation, and update the code to raise a . You can ensure your code is future-proof by running your code with the latest PyMongo release and looking for DeprecationWarnings.

    Starting with Python 2.7, the interpreter silences DeprecationWarnings by default. For example, the following code uses the deprecated method but does not raise any warning:

    You can turn warnings into exceptions with “python -We”:

    If your own code’s test suite passes with “python -We” then it uses no deprecated PyMongo features.

    The Python documentation on the warnings module, and .

    Previous topic

    Frequently Asked Questions

    Next topic