Skip to content

Commit 0496f69

Browse files
author
Cliff Dyer
authored
Merge pull request #349 from edx/cdyer/python3
Introduce python 3 compatibility.
2 parents 161b300 + 4700c7c commit 0496f69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+681
-384
lines changed

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ branches:
44
only:
55
- master
66
python:
7-
- "2.7"
7+
- "3.5"
88
cache: pip
99
install:
10-
- pip install -r requirements.txt
11-
- pip install -r django_requirements.txt
10+
- pip install tox
1211
- pip install codecov
12+
env:
13+
- TOX_ENV=py27
14+
- TOX_ENV=py35
15+
- TOX_ENV=docs
1316
script:
14-
- make test doc quality
17+
- tox -e $TOX_ENV
1518
after_success:
1619
- codecov

CHANGELOG.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ Change history for XBlock
44

55
These are notable changes in XBlock.
66

7-
0.4 - In Progress
8-
-----------------
7+
1.0 - Python 3
8+
--------------
9+
10+
* Introduce Python 3 compatibility to the xblock code base.
11+
This does not enable Python 2 codebases (like edx-platform) to load xblocks
12+
written in Python 3, but it lays the groundwork for future migrations.
13+
14+
0.5 - ???
15+
---------
16+
17+
No notes provided.
18+
19+
0.4
20+
---
921

1022
* Separate Fragment class out into new web-fragments package
1123

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
test:
2-
coverage run -m nose
3-
4-
docs:
5-
cd doc && make html
6-
71
quality:
82
pep8
93
script/max_pylint_violations
4+
pylint --py3k xblock
105

116
package:
12-
python setup.py register sdist upload
7+
python setup.py register sdist upload
8+
9+
test:
10+
tox -e py27,py35
11+
12+
docs:
13+
tox -e docs

django_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Install Django requirements, if we're using the optional Django-integrated
22
# parts of XBlock
33
Django >= 1.8, < 1.9
4-
django-pyfs
4+
django-pyfs >= 1.0.5

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import sys
1515
import os
16-
from path import path
16+
from path import Path as path
1717
import sys
1818
import mock
1919

@@ -223,4 +223,4 @@
223223
# How to display URL addresses: 'footnote', 'no', or 'inline'.
224224
#texinfo_show_urls = 'footnote'
225225

226-
exclude_patterns = ['api/*', 'links.rst']
226+
exclude_patterns = ['api/*', 'links.rst']

doc/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
lazy
55
sphinx
66
sphinxcontrib-napoleon==0.2.6
7+
sphinx_rtd_theme==0.1.9
78
path.py

pylintrc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ persistent=yes
1919

2020
# List of plugins (as comma separated values of python modules names) to load,
2121
# usually to register additional checkers.
22-
load-plugins=
22+
load-plugins=caniusepython3.pylint_checker
2323

2424

2525
[MESSAGES CONTROL]
@@ -46,8 +46,11 @@ disable=
4646
star-args,
4747
abstract-class-not-used,
4848
abstract-class-little-used,
49+
abstract-class-instantiated,
4950
no-init,
5051
too-many-lines,
52+
no-else-return,
53+
arguments-differ,
5154
no-self-use,
5255
too-many-ancestors,
5356
too-many-instance-attributes,
@@ -56,7 +59,9 @@ disable=
5659
too-many-return-statements,
5760
too-many-branches,
5861
too-many-arguments,
59-
too-many-locals
62+
too-many-locals,
63+
duplicate-code,
64+
len-as-condition,
6065

6166

6267
[REPORTS]
@@ -93,9 +98,6 @@ comment=no
9398

9499
[BASIC]
95100

96-
# Required attributes for module, separated by a comma
97-
required-attributes=
98-
99101
# List of builtins function names that should not be used, separated by a comma
100102
bad-functions=map,filter,apply,input
101103

@@ -147,6 +149,7 @@ no-docstring-rgx=__.*__|test_.+|setUp|tearDown
147149
# ones are exempt.
148150
docstring-min-length=-1
149151

152+
extension-pkg-whitelist=lxml
150153

151154
[FORMAT]
152155

@@ -228,10 +231,6 @@ additional-builtins=
228231

229232
[CLASSES]
230233

231-
# List of interface methods to ignore, separated by a comma. This is used for
232-
# instance to not check methods defines in Zope's Interface base class.
233-
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
234-
235234
# List of method names used to declare (i.e. assign) instance attributes.
236235
defining-attr-methods=__init__,__new__,setUp
237236

requirements.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ markupsafe
1212
mock
1313
nose
1414
coverage
15-
# pinning astroid b/c it's throwing errors on 2.7.8 altho doc says it shouldn't
16-
astroid == 1.2.1
17-
pylint == 1.3.1
15+
astroid
16+
pylint
1817
rednose
1918
pep8
19+
caniusepython3
2020
diff-cover >= 0.2.1
2121
ddt==0.8.0
22+
tox
2223

2324
# For docs
2425
-r doc/requirements.txt
@@ -28,6 +29,7 @@ cookiecutter
2829

2930
# For web fragments
3031
web-fragments
32+
#git+https://github.com/edx/web-fragments.git@0.1.1#egg=web_fragments==0.1.1
3133

3234
# Our own XBlocks
3335
-e .

script/max_pylint_violations

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
DEFAULT_MAX=7
2+
DEFAULT_MAX=6
33

44
pylint xblock | tee /tmp/pylint-xblock.log
55
ERR=`grep -E "^[C|R|W|E]:" /tmp/pylint-xblock.log | wc -l`

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ rednose=1
88

99
[pep8]
1010
ignore=E501,E402
11-
exclude=doc/*
11+
exclude=doc/*,.tox/

0 commit comments

Comments
 (0)