Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1710

Pollution of the 'bson' namespace upon install of mongo-python-driver

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.7.2
    • Component/s: None
    • None
    • Environment:
      All

      Upon installation of the package the 'bson' namespace is taken up.

       

      I see there is a small warning hidden in the README to cover this scenario:

       


      Do not install the "bson" package from pypi. PyMongo comes with its own bson package; doing "easy_install bson" installs a third-party package that is incompatible with PyMongo.


       

      However it's not sufficient protection as since both are popular packages the change of both being installed is very high. I myself wasted a few hours figuring out this issue was breaking several projects I'm working on.

      Possible solutions:

       

      1. Within the https://github.com/mongodb/mongo-python-driver/ repository. Rename the 'bson' package to 'pymongo_bson' or something else.
      2. Move the 'bson' package to within the 'pymongo' package and import bson components using absolute relative imports (e.g. 'from .bson import something')

       

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            richardarpanet Richard O'Dwyer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: