remove references to '2to3' in doc, travis, etc

This commit is contained in:
Bastien Gérard 2019-06-15 14:37:47 +02:00
parent 009f9a2b14
commit a3e432eb68
5 changed files with 24 additions and 18 deletions

View File

@ -5,17 +5,12 @@ pylint:
options:
additional-builtins:
# add xrange and long as valid built-ins. In Python 3, xrange is
# translated into range and long is translated into int via 2to3 (see
# "use_2to3" in setup.py). This should be removed when we drop Python
# 2 support (which probably won't happen any time soon).
- xrange
# add long as valid built-ins.
- long
pyflakes:
disable:
# undefined variables are already covered by pylint (and exclude
# xrange & long)
# undefined variables are already covered by pylint (and exclude long)
- F821
ignore-paths:

View File

@ -73,7 +73,7 @@ install:
before_script:
- mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
- ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then flake8 .; else echo "flake8 only runs on py27"; fi # Run flake8 for Python 2.7 only
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then flake8 .; else echo "flake8 only runs on py37"; fi # Run flake8 for Python 3.7 only
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then black --check .; else echo "black only runs on py37"; fi # Run black for Python 3.7 only
- mongo --eval 'db.version();' # Make sure mongo is awake
@ -84,7 +84,7 @@ script:
# 0% coverage. That's caused by 'use_2to3', which builds the py3-compatible
# code in a separate dir and runs tests on that.
after_success:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coveralls --verbose; else echo "coveralls only sent for py27"; fi
- coveralls --verbose
notifications:
irc: irc.freenode.org#mongoengine

View File

@ -22,11 +22,19 @@ Supported Interpreters
MongoEngine supports CPython 2.7 and newer. Language
features not supported by all interpreters can not be used.
The codebase is written in python 2 so you must be using python 2
when developing new features. Compatibility of the library with Python 3
relies on the 2to3 package that gets executed as part of the installation
build. You should ensure that your code is properly converted by
`2to3 <http://docs.python.org/library/2to3.html>`_.
The codebase is written in a compatible manner for python 2 & 3 so it
is important that this is taken into account when it comes to discrepencies
between the 2 versions (check this https://python-future.org/compatible_idioms.html).
Travis runs run the tests against the different versions as a safety net.
Python 2/3 compatibility
----------------------
The codebase is written in a compatible manner for python 2 & 3 so it
is important that this is taken into account when it comes to discrepencies
between the 2 versions (check this https://python-future.org/compatible_idioms.html).
Travis runs run the tests against the different versions as a safety net.
Style Guide
-----------

View File

@ -3,13 +3,17 @@ import timeit
def main():
setup = """
from builtins import range
from pymongo import MongoClient
connection = MongoClient()
connection.drop_database('mongoengine_benchmark_test')
"""
stmt = """
from pymongo import MongoClient
connection = MongoClient()
db = connection.mongoengine_benchmark_test
@ -55,7 +59,10 @@ myNoddys = noddy.find()
print("{}s".format(t.timeit(1)))
setup = """
from builtins import range
from pymongo import MongoClient
connection = MongoClient()
connection.drop_database('mongoengine_benchmark_test')
connection.close()

View File

@ -71,7 +71,6 @@ class EmbeddedDocument(six.with_metaclass(DocumentMetaclass, BaseDocument)):
__slots__ = ("_instance",)
# The __metaclass__ attribute is removed by 2to3 when running with Python3
# my_metaclass is defined so that metaclass can be queried in Python 2 & 3
my_metaclass = DocumentMetaclass
@ -156,7 +155,6 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
in the :attr:`meta` dictionary.
"""
# The __metaclass__ attribute is removed by 2to3 when running with Python3
# my_metaclass is defined so that metaclass can be queried in Python 2 & 3
my_metaclass = TopLevelDocumentMetaclass
@ -1045,7 +1043,6 @@ class DynamicDocument(six.with_metaclass(TopLevelDocumentMetaclass, Document)):
There is one caveat on Dynamic Documents: undeclared fields cannot start with `_`
"""
# The __metaclass__ attribute is removed by 2to3 when running with Python3
# my_metaclass is defined so that metaclass can be queried in Python 2 & 3
my_metaclass = TopLevelDocumentMetaclass
@ -1069,7 +1066,6 @@ class DynamicEmbeddedDocument(six.with_metaclass(DocumentMetaclass, EmbeddedDocu
information about dynamic documents.
"""
# The __metaclass__ attribute is removed by 2to3 when running with Python3
# my_metaclass is defined so that metaclass can be queried in Python 2 & 3
my_metaclass = DocumentMetaclass