Merge branch 'fix/add-dev-tools' of git://github.com/Pacu2/mongoengine into Pacu2-fix/add-dev-tools

This commit is contained in:
Bastien Gérard 2020-04-25 20:46:44 +02:00
commit 4085bc2152
16 changed files with 64 additions and 26 deletions

13
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,13 @@
repos:
- repo: https://github.com/ambv/black
rev: 19.3b0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: flake8

View File

@ -31,8 +31,28 @@ build. You should ensure that your code is properly converted by
Style Guide
-----------
MongoEngine uses `black <https://github.com/python/black>`_ for code
formatting.
MongoEngine uses various tools to maintain a common coding style.
To install all development tools, simply run the following commands:
.. code-block:: console
$ python -m pip install -r requirements-dev.txt
You can install `pre-commit <https://pre-commit.com/>`_ into your git hooks,
to automatically check and fix any formatting issue before creating a
git commit.
To enable ``pre-commit`` simply run:
.. code-block:: console
$ pre-commit install
See the ``.pre-commit-config.yaml`` configuration file for more information
on how it works.
Testing
-------

View File

@ -34,7 +34,7 @@ with MongoDB version > 4.0.
Installation
============
We recommend the use of `virtualenv <https://virtualenv.pypa.io/>`_ and of
`pip <https://pip.pypa.io/>`_. You can then use ``pip install -U mongoengine``.
`pip <https://pip.pypa.io/>`_. You can then use ``python -m pip install -U mongoengine``.
You may also have `setuptools <http://peak.telecommunity.com/DevCenter/setuptools>`_
and thus you can use ``easy_install -U mongoengine``. Another option is
`pipenv <https://docs.pipenv.org/>`_. You can then use ``pipenv install mongoengine``
@ -44,7 +44,7 @@ run ``python setup.py install``.
Dependencies
============
All of the dependencies can easily be installed via `pip <https://pip.pypa.io/>`_.
All of the dependencies can easily be installed via `python -m pip <https://pip.pypa.io/>`_.
At the very least, you'll need these two packages to use MongoEngine:
- pymongo>=3.4
@ -125,7 +125,7 @@ installed in your environment and then:
.. code-block:: shell
# Install tox
$ pip install tox
$ python -m pip install tox
# Run the test suites
$ tox

View File

@ -16,6 +16,8 @@ Development
- Queryset.slave_okay() was deprecated since pymongo3
- dropDups was dropped with MongoDB3
- ``Queryset._ensure_indexes`` and ``Queryset.ensure_indexes``, the right method to use is ``Document.ensure_indexes``
- Added pre-commit #2212
- Renamed requirements-lint.txt to requirements-dev.txt #2212
Changes in 0.19.1
=================

View File

@ -10,4 +10,3 @@ If this is a requirement for your project, check the alternative: `uMongo`_ and
.. _uMongo: https://umongo.readthedocs.io/
.. _MotorEngine: https://motorengine.readthedocs.io/

View File

@ -12,7 +12,7 @@ MongoEngine is available on PyPI, so you can use :program:`pip`:
.. code-block:: console
$ pip install mongoengine
$ python -m pip install mongoengine
Alternatively, if you don't have setuptools installed, `download it from PyPi
<http://pypi.python.org/pypi/mongoengine/>`_ and run

View File

@ -7,7 +7,7 @@ MongoDB. To install it, simply run
.. code-block:: console
$ pip install -U mongoengine
$ python -m pip install -U mongoengine
:doc:`tutorial`
A quick tutorial building a tumblelog to get you up and running with
@ -91,4 +91,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -18,7 +18,7 @@ location --- running it locally will be easier, but if that is not an option
then it may be run on a remote server. If you haven't installed MongoEngine,
simply use pip to install it like so::
$ pip install mongoengine
$ python -m pip install mongoengine
Before we can start using MongoEngine, we need to tell it how to connect to our
instance of :program:`mongod`. For this we use the :func:`~mongoengine.connect`

View File

@ -85,10 +85,10 @@ by default from now on.
The 0.8.7 package on pypi was corrupted. If upgrading from 0.8.7 to 0.9.0 please follow: ::
pip uninstall pymongo
pip uninstall mongoengine
pip install pymongo==2.8
pip install mongoengine
python -m pip uninstall pymongo
python -m pip uninstall mongoengine
python -m pip install pymongo==2.8
python -m pip install mongoengine
0.8.7
*****

8
requirements-dev.txt Normal file
View File

@ -0,0 +1,8 @@
black
flake8
flake8-import-order
pre-commit
pytest
ipdb
ipython
tox

View File

@ -1,3 +0,0 @@
black
flake8
flake8-import-order