METADATA 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. Metadata-Version: 2.1
  2. Name: mongoengine
  3. Version: 0.16.0
  4. Summary: MongoEngine is a Python Object-Document Mapper for working with MongoDB.
  5. Home-page: http://mongoengine.org/
  6. Author: Harry Marr
  7. Author-email: harry.marr@gmail.com
  8. Maintainer: Stefan Wojcik
  9. Maintainer-email: wojcikstefan@gmail.com
  10. License: MIT
  11. Download-URL: https://github.com/MongoEngine/mongoengine/tarball/master
  12. Platform: any
  13. Classifier: Development Status :: 4 - Beta
  14. Classifier: Intended Audience :: Developers
  15. Classifier: License :: OSI Approved :: MIT License
  16. Classifier: Operating System :: OS Independent
  17. Classifier: Programming Language :: Python
  18. Classifier: Programming Language :: Python :: 2
  19. Classifier: Programming Language :: Python :: 2.7
  20. Classifier: Programming Language :: Python :: 3
  21. Classifier: Programming Language :: Python :: 3.5
  22. Classifier: Programming Language :: Python :: 3.6
  23. Classifier: Programming Language :: Python :: Implementation :: CPython
  24. Classifier: Programming Language :: Python :: Implementation :: PyPy
  25. Classifier: Topic :: Database
  26. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  27. Requires-Dist: pymongo (>=2.7.1)
  28. Requires-Dist: six
  29. ===========
  30. MongoEngine
  31. ===========
  32. :Info: MongoEngine is an ORM-like layer on top of PyMongo.
  33. :Repository: https://github.com/MongoEngine/mongoengine
  34. :Author: Harry Marr (http://github.com/hmarr)
  35. :Maintainer: Stefan Wójcik (http://github.com/wojcikstefan)
  36. .. image:: https://travis-ci.org/MongoEngine/mongoengine.svg?branch=master
  37. :target: https://travis-ci.org/MongoEngine/mongoengine
  38. .. image:: https://coveralls.io/repos/github/MongoEngine/mongoengine/badge.svg?branch=master
  39. :target: https://coveralls.io/github/MongoEngine/mongoengine?branch=master
  40. .. image:: https://landscape.io/github/MongoEngine/mongoengine/master/landscape.svg?style=flat
  41. :target: https://landscape.io/github/MongoEngine/mongoengine/master
  42. :alt: Code Health
  43. About
  44. =====
  45. MongoEngine is a Python Object-Document Mapper for working with MongoDB.
  46. Documentation is available at https://mongoengine-odm.readthedocs.io - there
  47. is currently a `tutorial <https://mongoengine-odm.readthedocs.io/tutorial.html>`_,
  48. a `user guide <https://mongoengine-odm.readthedocs.io/guide/index.html>`_, and
  49. an `API reference <https://mongoengine-odm.readthedocs.io/apireference.html>`_.
  50. Supported MongoDB Versions
  51. ==========================
  52. MongoEngine is currently tested against MongoDB v2.6, v3.0 and v3.2. Future
  53. versions should be supported as well, but aren't actively tested at the moment.
  54. Make sure to open an issue or submit a pull request if you experience any
  55. problems with MongoDB v3.4+.
  56. Installation
  57. ============
  58. We recommend the use of `virtualenv <https://virtualenv.pypa.io/>`_ and of
  59. `pip <https://pip.pypa.io/>`_. You can then use ``pip install -U mongoengine``.
  60. You may also have `setuptools <http://peak.telecommunity.com/DevCenter/setuptools>`_
  61. and thus you can use ``easy_install -U mongoengine``. Another option is
  62. `pipenv <https://docs.pipenv.org/>`_. You can then use ``pipenv install mongoengine``
  63. to both create the virtual environment and install the package. Otherwise, you can
  64. download the source from `GitHub <http://github.com/MongoEngine/mongoengine>`_ and
  65. run ``python setup.py install``.
  66. Dependencies
  67. ============
  68. All of the dependencies can easily be installed via `pip <https://pip.pypa.io/>`_.
  69. At the very least, you'll need these two packages to use MongoEngine:
  70. - pymongo>=2.7.1
  71. - six>=1.10.0
  72. If you utilize a ``DateTimeField``, you might also use a more flexible date parser:
  73. - dateutil>=2.1.0
  74. If you need to use an ``ImageField`` or ``ImageGridFsProxy``:
  75. - Pillow>=2.0.0
  76. Examples
  77. ========
  78. Some simple examples of what MongoEngine code looks like:
  79. .. code :: python
  80. from mongoengine import *
  81. connect('mydb')
  82. class BlogPost(Document):
  83. title = StringField(required=True, max_length=200)
  84. posted = DateTimeField(default=datetime.datetime.utcnow)
  85. tags = ListField(StringField(max_length=50))
  86. meta = {'allow_inheritance': True}
  87. class TextPost(BlogPost):
  88. content = StringField(required=True)
  89. class LinkPost(BlogPost):
  90. url = StringField(required=True)
  91. # Create a text-based post
  92. >>> post1 = TextPost(title='Using MongoEngine', content='See the tutorial')
  93. >>> post1.tags = ['mongodb', 'mongoengine']
  94. >>> post1.save()
  95. # Create a link-based post
  96. >>> post2 = LinkPost(title='MongoEngine Docs', url='hmarr.com/mongoengine')
  97. >>> post2.tags = ['mongoengine', 'documentation']
  98. >>> post2.save()
  99. # Iterate over all posts using the BlogPost superclass
  100. >>> for post in BlogPost.objects:
  101. ... print '===', post.title, '==='
  102. ... if isinstance(post, TextPost):
  103. ... print post.content
  104. ... elif isinstance(post, LinkPost):
  105. ... print 'Link:', post.url
  106. ... print
  107. ...
  108. # Count all blog posts and its subtypes
  109. >>> BlogPost.objects.count()
  110. 2
  111. >>> TextPost.objects.count()
  112. 1
  113. >>> LinkPost.objects.count()
  114. 1
  115. # Count tagged posts
  116. >>> BlogPost.objects(tags='mongoengine').count()
  117. 2
  118. >>> BlogPost.objects(tags='mongodb').count()
  119. 1
  120. Tests
  121. =====
  122. To run the test suite, ensure you are running a local instance of MongoDB on
  123. the standard port and have ``nose`` installed. Then, run ``python setup.py nosetests``.
  124. To run the test suite on every supported Python and PyMongo version, you can
  125. use ``tox``. You'll need to make sure you have each supported Python version
  126. installed in your environment and then:
  127. .. code-block:: shell
  128. # Install tox
  129. $ pip install tox
  130. # Run the test suites
  131. $ tox
  132. If you wish to run a subset of tests, use the nosetests convention:
  133. .. code-block:: shell
  134. # Run all the tests in a particular test file
  135. $ python setup.py nosetests --tests tests/fields/fields.py
  136. # Run only particular test class in that file
  137. $ python setup.py nosetests --tests tests/fields/fields.py:FieldTest
  138. # Use the -s option if you want to print some debug statements or use pdb
  139. $ python setup.py nosetests --tests tests/fields/fields.py:FieldTest -s
  140. Community
  141. =========
  142. - `MongoEngine Users mailing list
  143. <http://groups.google.com/group/mongoengine-users>`_
  144. - `MongoEngine Developers mailing list
  145. <http://groups.google.com/group/mongoengine-dev>`_
  146. Contributing
  147. ============
  148. We welcome contributions! See the `Contribution guidelines <https://github.com/MongoEngine/mongoengine/blob/master/CONTRIBUTING.rst>`_