Skip to content

Commit

Permalink
PYTHON-2133 Drop install support for Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
behackett committed Jan 14, 2021
1 parent fb4c20a commit dea4b90
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 739 deletions.
19 changes: 0 additions & 19 deletions .evergreen/config.yml
Expand Up @@ -349,16 +349,6 @@ functions:
${PREPARE_SHELL}
PYTHON_BINARY=${PYTHON_BINARY} PROJECT_DIRECTORY=${PROJECT_DIRECTORY} sh ${PROJECT_DIRECTORY}/.evergreen/run-mockupdb-tests.sh
"run cdecimal tests":
- command: shell.exec
type: test
params:
working_dir: "src"
script: |
set -o xtrace
${PREPARE_SHELL}
PYTHON_BINARY=${PYTHON_BINARY} sh ${PROJECT_DIRECTORY}/.evergreen/run-cdecimal-tests.sh
"run doctests":
- command: shell.exec
type: test
Expand Down Expand Up @@ -1179,15 +1169,6 @@ tasks:
TOPOLOGY: "replica_set"
- func: "run mod_wsgi tests"

- name: "cdecimal"
tags: ["cdecimal"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "latest"
TOPOLOGY: "server"
- func: "run cdecimal tests"

- name: "no-server"
tags: ["no-server"]
commands:
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
@@ -1,13 +1,11 @@
language: python

python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
- pypy
- pypy3.5

services:
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
@@ -1,7 +1,6 @@
include README.rst
include LICENSE
include THIRD-PARTY-NOTICES
include ez_setup.py
recursive-include doc *.rst
recursive-include doc *.py
recursive-include doc *.conf
Expand Down
15 changes: 1 addition & 14 deletions README.rst
Expand Up @@ -89,7 +89,7 @@ is incompatible with PyMongo.
Dependencies
============

PyMongo supports CPython 2.7, 3.4+, PyPy, and PyPy3.5+.
PyMongo supports CPython 3.4+ and PyPy3.5+.

Optional dependencies:

Expand Down Expand Up @@ -119,9 +119,6 @@ PyMongo::

$ python -m pip install pymongo[tls]

.. note:: Users of Python versions older than 2.7.9 will also
receive the dependencies for OCSP when using the tls extra.

OCSP (Online Certificate Status Protocol) requires `PyOpenSSL
<https://pypi.org/project/pyOpenSSL/>`_, `requests
<https://pypi.org/project/requests/>`_ and `service_identity
Expand Down Expand Up @@ -149,16 +146,6 @@ command::

$ python -m pip install pymongo[gssapi,aws,ocsp,snappy,srv,tls,zstd,encryption]

Other optional packages:

- `backports.pbkdf2 <https://pypi.python.org/pypi/backports.pbkdf2/>`_,
improves authentication performance with SCRAM-SHA-1 and SCRAM-SHA-256.
It especially improves performance on Python versions older than 2.7.8.
- `monotonic <https://pypi.python.org/pypi/monotonic>`_ adds support for
a monotonic clock, which improves reliability in environments
where clock adjustments are frequent. Not needed in Python 3.


Additional dependencies are:

- (to generate documentation) sphinx_
Expand Down
16 changes: 5 additions & 11 deletions RELEASE.rst
Expand Up @@ -33,10 +33,10 @@ Doing a Release

1. PyMongo is tested on Evergreen. Ensure the latest commit are passing CI
as expected: https://evergreen.mongodb.com/waterfall/mongo-python-driver.
To test locally, ``python setup.py test`` will build the C extensions and
test. ``python tools/clean.py`` will remove the extensions,
and then ``python setup.py --no_ext test`` will run the tests without
them. You can also run the doctests: ``python setup.py doc -t``.
To test locally, ``python3 setup.py test`` will build the C extensions and
test. ``python3 tools/clean.py`` will remove the extensions,
and then ``python3 setup.py --no_ext test`` will run the tests without
them. You can also run the doctests: ``python3 setup.py doc -t``.

2. Check Jira to ensure all the tickets in this version have been completed.

Expand All @@ -63,17 +63,11 @@ Doing a Release
the next steps let's assume we unpacked these files into the following paths::

$ ls path/to/manylinux
pymongo-<version>-cp27-cp27m-manylinux1_i686.whl
...
pymongo-<version>-cp38-cp38-manylinux2014_x86_64.whl
$ ls path/to/mac/
pymongo-<version>-cp27-cp27m-macosx_10_14_intel.whl
...
pymongo-<version>-py2.7-macosx-10.14-intel.egg
$ ls path/to/windows/
pymongo-<version>-cp27-cp27m-win32.whl
...
pymongo-<version>-cp38-cp38-win_amd64.whl
...

10. Build the source distribution::

Expand Down
66 changes: 0 additions & 66 deletions cdecimal_test.py

This file was deleted.

27 changes: 1 addition & 26 deletions doc/atlas.rst
Expand Up @@ -7,32 +7,7 @@ Atlas to :class:`~pymongo.mongo_client.MongoClient`::

client = pymongo.MongoClient(<Atlas connection string>)

Connections to Atlas require TLS/SSL. For connections using TLS/SSL, PyMongo
may require third party dependencies as determined by your version of Python.
With PyMongo 3.3+, you can install PyMongo 3.3+ and any TLS/SSL-related
dependencies using the following pip command::

$ python -m pip install pymongo[tls]

Starting with PyMongo 3.11 this installs `PyOpenSSL
<https://pypi.org/project/pyOpenSSL/>`_, `requests`_
and `service_identity
<https://pypi.org/project/service_identity/>`_
for users of Python versions older than 2.7.9. PyOpenSSL supports SNI for these
old Python versions, allowing applictions to connect to Altas free and shared
tier instances.

Earlier versions of PyMongo require you to manually install the dependencies.
For a list of TLS/SSL-related dependencies, see :doc:`examples/tls`.

.. note:: Connecting to Atlas "Free Tier" or "Shared Cluster" instances
requires Server Name Indication (SNI) support. SNI support requires CPython
2.7.9 / PyPy 2.5.1 or newer or PyMongo 3.11+ with PyOpenSSL.
To check if your version of Python supports SNI run the following command::

$ python -c "import ssl; print(getattr(ssl, 'HAS_SNI', False))"

You should see "True".
Connections to Atlas require TLS/SSL.

.. warning:: Industry best practices recommend, and some regulations require,
the use of TLS 1.1 or newer. Though no application changes are required for
Expand Down
16 changes: 8 additions & 8 deletions doc/compatibility-policy.rst
Expand Up @@ -18,9 +18,9 @@ effort to release at least one minor version that *deprecates* it. We add
`DeprecationWarning`_. You can ensure your code is future-proof by running
your code with the latest PyMongo release and looking for DeprecationWarnings.

Starting with Python 2.7, the interpreter silences DeprecationWarnings by
default. For example, the following code uses the deprecated ``insert``
method but does not raise any warning:
The interpreter silences DeprecationWarnings by default. For example, the
following code uses the deprecated ``insert`` method but does not raise any
warning:

.. code-block:: python
Expand All @@ -32,13 +32,13 @@ method but does not raise any warning:
To print deprecation warnings to stderr, run python with "-Wd"::

$ python -Wd insert.py
$ python3 -Wd insert.py
insert.py:4: DeprecationWarning: insert is deprecated. Use insert_one or insert_many instead.
client.test.test.insert({})

You can turn warnings into exceptions with "python -We"::

$ python -We insert.py
$ python3 -We insert.py
Traceback (most recent call last):
File "insert.py", line 4, in <module>
client.test.test.insert({})
Expand All @@ -55,8 +55,8 @@ deprecated PyMongo features.
.. _semantic versioning: http://semver.org/

.. _DeprecationWarning:
https://docs.python.org/2/library/exceptions.html#exceptions.DeprecationWarning
https://docs.python.org/3/library/exceptions.html#DeprecationWarning

.. _the warnings module: https://docs.python.org/2/library/warnings.html
.. _the warnings module: https://docs.python.org/3/library/warnings.html

.. _the -W command line option: https://docs.python.org/2/using/cmdline.html#cmdoption-W
.. _the -W command line option: https://docs.python.org/3/using/cmdline.html#cmdoption-w

0 comments on commit dea4b90

Please sign in to comment.