Skip to content

Commit 895507c

Browse files
authored
DOCSP-37500 - Tools (#58)
1 parent 93a28d1 commit 895507c

File tree

1 file changed

+34
-41
lines changed

1 file changed

+34
-41
lines changed

source/tools.txt

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _pymongo-tools:
22

3-
=====
4-
Tools
5-
=====
3+
=================
4+
Third-Party Tools
5+
=================
66

77
.. contents:: On this page
88
:local:
@@ -15,40 +15,33 @@ Tools
1515
:values: reference
1616

1717
.. meta::
18-
:keywords: pypi, package, web, module, third party, pip
18+
:keywords: pypi, package, web, module, pip
1919

2020
Overview
2121
--------
2222

23-
Many developers have written tools for working with {+driver-short+}. If you know
24-
of a tool for working with MongoDB from Python, please list it here.
23+
This page describes some popular third-party libraries for working with {+driver-short+}.
24+
With the exception of Motor, all libraries on this page are maintained by the community.
25+
To keep this list current, projects that haven't been updated recently will
26+
occasionally be removed from the list or moved to the end.
2527

26-
.. note::
27-
28-
To keep this list current, projects that
29-
haven't been updated recently will
30-
occasionally be removed from the list or moved to the end.
28+
.. tip::
3129

32-
If we remove a project that is still being developed or is in active use,
33-
please let us know or add it back to the list.
30+
Although these libraries can be helpful, we recommend that new {+driver-short+} users
31+
begin by working directly with the driver. {+driver-short+} alone will meet most people's
32+
needs, and working with it is instructive in how MongoDB works.
3433

3534
ORM-like Layers
3635
---------------
3736

3837
ORM-like (object-relational-mapping-like) layers add features like models and validation to
3938
{+driver-short+}.
4039

41-
.. tip::
42-
43-
We recommend that new {+driver-short+} users begin by working directly with
44-
the driver. {+driver-short+} alone will meet most people's needs, and working with
45-
it is instructive in how MongoDB works.
46-
4740
- `MincePy <https://mincepy.readthedocs.io/en/latest/>`__ is an
4841
object-document mapper (ODM) designed to make any Python object storable
4942
and queryable in a MongoDB database. It was designed with machine learning
5043
and big-data computational and experimental science applications in mind.
51-
However, it is entirely general and can be useful to anyone looking to organize,
44+
However, it's entirely general and can be useful to anyone looking to organize,
5245
share, or process large amounts of data with as little change to their current
5346
workflow as possible.
5447

@@ -60,21 +53,20 @@ ORM-like (object-relational-mapping-like) layers add features like models and va
6053
<http://blog.pythonisito.com/2009/12/ming-01-released-python-library-for.html>`__
6154
for more details.
6255

63-
- `MongoEngine <http://mongoengine.org/>`__ lets you use syntax inspired by the
64-
Django ORM to define schemas for documents and query collections.
56+
- `MongoEngine <https://mongoengine-odm.readthedocs.io/>`__ lets you use syntax inspired
57+
by the Django ORM to define schemas for documents and query collections.
6558
The code is available on `GitHub
66-
<http://github.com/mongoengine/mongoengine>`__. For more information, see
67-
the `MongoEngine tutorial <https://docs.mongoengine.org/tutorial.html>`_.
59+
<http://github.com/mongoengine/mongoengine>`__.
6860

6961
- `MotorEngine <https://motorengine.readthedocs.io/>`__ is a port of
7062
MongoEngine to Motor, allowing asynchronous access with Tornado.
71-
It implements the same modeling APIs to be data-portable, meaning that a
63+
It implements the same modeling APIs in a data-portable way, meaning that a
7264
model defined in MongoEngine can be read in MotorEngine. The source is
7365
available on `GitHub <http://github.com/heynemann/motorengine>`__.
7466

75-
- `uMongo <https://umongo.readthedocs.io/>`__ is a Python MongoDB ODM.
76-
It was created to meet two needs: the lack of async ODM and the
77-
difficulty to do document serialization with existing ODMs.
67+
- `uMongo <https://umongo.readthedocs.io/>`__ is a Python MongoDB ODM that
68+
was created to meet two needs: the lack of an asynchronous ODM and the
69+
difficulty of serializing documents with other ODMs.
7870
uMongo works with multiple drivers: PyMongo, TxMongo, motor_asyncio, and
7971
mongomock. The source is available on `GitHub <https://github.com/Scille/umongo>`__.
8072

@@ -162,28 +154,29 @@ can do asynchronous I/O with non-blocking sockets and schedule operations
162154
on `greenlets <https://pypi.org/project/greenlet/>`__ instead of threads.
163155

164156
To use gevent with {+driver-short+}, call gevent's
165-
``monkey.patch_all()`` method before loading any other modules, as shown in the following
157+
``monkey.patch_all()`` method *before* loading any other modules, as shown in the following
166158
example:
167159

168160
.. code-block:: python
169161

170-
>>> # You must call patch_all() *before* importing any other modules
171-
>>> from gevent import monkey
172-
>>> _ = monkey.patch_all()
173-
>>> from pymongo import MongoClient
174-
>>> client = MongoClient()
162+
# You must call patch_all() *before* importing any other modules
163+
from gevent import monkey
164+
_ = monkey.patch_all()
165+
from pymongo import MongoClient
166+
client = MongoClient()
175167

176168
.. important:: Close MongoClient to Avoid Blocking
177169

178170
If you call ``monkey.patch_all()`` when your application launches, ``MongoClient``
179171
will use greenlets instead of threads to monitor the health of the server.
180-
When shutting down, if your application calls the ``~gevent.hub.Hub.join`` method
172+
When shutting down, if your application calls the ``~gevent.hub.Hub.join()`` method
181173
without first terminating these greenlets,
182-
the call to the ``~gevent.hub.Hub.join`` method blocks indefinitely.
174+
the call to the ``~gevent.hub.Hub.join()`` method blocks indefinitely.
183175

184-
To avoid this, close or dereference any active ``MongoClient`` before exiting your
185-
application. In some application frameworks, one solution is a signal handler
186-
to end background greenlets when your application receives ``SIGHUP``:
176+
To avoid this, close or dereference any active ``MongoClient`` objects before exiting
177+
your application. In some application frameworks, you can use a signal handler
178+
to end background greenlets when your application receives ``SIGHUP``, as shown
179+
in the following example:
187180

188181
.. code-block:: python
189182

@@ -198,7 +191,7 @@ example:
198191
This issue affects applications using uWSGI versions earlier than 1.9.16
199192
or newer uWSGI versions with the ``-gevent-wait-for-hub`` option.
200193
For more information, see
201-
`the uWSGI changelog <https://uwsgi-docs.readthedocs.io/en/latest/Changelog-1.9.16.html#important-change-in-the-gevent-plugin-shutdown-reload-procedure>`__.
194+
the `uWSGI changelog <https://uwsgi-docs.readthedocs.io/en/latest/Changelog-1.9.16.html#important-change-in-the-gevent-plugin-shutdown-reload-procedure>`__.
202195

203196
.. _pymongo-mod_wsgi:
204197

@@ -257,7 +250,7 @@ daemon in the global application group:
257250

258251
.. note::
259252

260-
Python C extensions in general have issues running in multiple
253+
Many Python C extensions have issues when running in multiple
261254
Python sub-interpreters. These difficulties are explained in the documentation for
262255
`Py_NewInterpreter <https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreter>`__
263256
and in the `Multiple Python Sub Interpreters <https://modwsgi.readthedocs.io/en/master/user-guides/application-issues.html#multiple-python-sub-interpreters>`__

0 commit comments

Comments
 (0)