Skip to content

Commit

Permalink
Add notes about dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
J. Cliff Dyer committed Sep 23, 2016
1 parent 6539c1c commit 2c667bb
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions oeps/oep-0007.rst
Expand Up @@ -6,15 +6,15 @@ OEP-0007: Migrating to Python 3
+---------------+-------------------------------------------+
| Title | Migrating to Python 3 |
+---------------+-------------------------------------------+
| Last-Modified | 2016-08-12 |
| Last-Modified | 2016-09-23 |
+---------------+-------------------------------------------+
| Author | Cliff Dyer <cdyer@edx.org |
| Author | Cliff Dyer <cdyer@edx.org> |
+---------------+-------------------------------------------+
| Arbiter | |
+---------------+-------------------------------------------+
| Status | Draft |
+---------------+-------------------------------------------+
| Type | |
| Type | Best Practices |
+---------------+-------------------------------------------+
| Created | 2016-08-12 |
+---------------+-------------------------------------------+
Expand All @@ -26,14 +26,13 @@ Abstract
========

With primary development of Python occurring on Python 3, and with Python 2
scheduled for end-of-life in 2020, edX needs to plan for a transition of our
code to Python 3. Open edX is a large project, spanning many applications over
even more github repos, with even more dependencies on third party libraries
that may or may not support python 3. This document outlines how we plan to
scope the problem, socialize understanding of the differences between versions
of python, migrate our code, and work with our Open edX community to ensure
that the process is as painless as possible, and meets the needs of our
stakeholders.
scheduled for end-of-life in 2020, edX needs to plan for a transition of all of
our code to Python 3. Open edX is a large project, spanning many applications
over even more github repos, with even more dependencies on third party
libraries. This document outlines how we plan to scope the problem, socialize
understanding of the differences between versions of python, migrate our code,
and work with our Open edX community to ensure that the process is as painless
as possible, and meets the needs of our stakeholders.


Rationale
Expand Down Expand Up @@ -78,8 +77,31 @@ look as much like native python 3 code as possible, with compatibility changes
made at the top of the file, in the import headers. This will make it easier
to strip out compatibility shims when we are ready to drop python 2 support.

We will follow the compatibility guidelines at
http://python-future.org/compatible_idioms.html.
Third-party dependencies
------------------------

Before converting a codebase to python 3, we need to make sure the code we
depend on will also support python 3. We can make a rough check for
third-party library support using the [Can I Use Python 3 website or
library](https://caniusepython3.com/). This will sometimes show inaccurate
results, as it depends upon self-reporting of library compatibility (via the
library's `setup.py` classifiers), but will help guide our investigations and
scope out the amount of work required. Results can be tracked in the
[Compatibility Audit wiki
page](https://openedx.atlassian.net/wiki/display/ENG/Compatibility+Audit).

If a required library does not support python 3, we have a few options:

1. We can contribute a patch to support python 3 to the library.
2. We can request python 3 support, and wait for the maintainers to implement it.
3. We can find an alternative library that does support python 3.

Which path is best may depend on the enthusiasm of the maintainers for
supporting python 3, the amount of resources we want to commit to the project,
and the availability and quality of alternatives.

__future__ imports
------------------

All files should have the main `__future__` imports at the top to regularize
some behaviors that differ by default between python 2 and 3. `from
Expand Down

0 comments on commit 2c667bb

Please sign in to comment.