Skip to content

Commit fc51ac4

Browse files
authored
Merge pull request #401 from datacamp/feat/python_update
[LO-2520] Feat/python update
2 parents ed30ab3 + 82c27f2 commit fc51ac4

15 files changed

+323
-56
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
sudo: false
22
language: python
33
python:
4-
- '3.5'
4+
- '3.9'
55
before_install:
6-
- pip install -r requirements.txt
7-
- pip install -e .
6+
- pip3.9 install -r requirements.txt
7+
- pip3.9 install -e .
88
script: pytest -m "not compiled" --cov=pythonwhat
9-
after_success: codecov --token=$CODECOV_TOKEN
109
deploy:
1110
provider: pypi
1211
user: datacamp
1312
password:
14-
secure: oyhm/R427TtmjJFMlvxQAR3UK5CA3vRSQd7CTtGTkL3W2zoZsPI7p3XbJn4CwC1f1XPdAbfN/Km035Fn4NlVHwJT54NTGkcy8GPV8whxEvWptiA1XWO6uwIqHh7rF/cVhX21AYXWAYkFq0Y0w1+q3OK75czMBrclwn9t+m111uoEUdZyowI5EVXbTHfzpNrRY3wA+tVWdz3Yd4IIC5foFsMP28j/5JCuMWXT1Knf53ZaoTSpyoEllAe/8sP/3K6/adgiwz5vL6kTFtSeuX0EQ6uvlXWyP4x8APNcnfVKxEC16iwakOgVzhw4n3uMsQ6tgo11w+A2crJU1N8KxdZtG8gAw42jWSZMmB3SHHx0NQhi71SvrjYXwDwe8bOvRFDHiR+2WQzoYC4WJUyn4WYpScazkQpeqYdoOTBnAr1VNzZHOQNwejX5KpLP15oXj6ima/lqefQWnIRixeBkJibSTdRl2HlvdPzP75DSjg8eA0Xt8/ad2oWV4om9zIUwAkJrnzih3ZsnshSqVZcxpsRDZvV2LXz39JzlNECqxfLGF+Oy6M8QQXnALzYuHhs/BgzPlLdQw8QLwHPqvv38LNfrWo36jR3j9UYu1/45LZauIEJuLGCyPclT1PDnAtxH3SGCEi8aAODzAi2qptbBHxJHjsRcVeMx6Oiz4AmEuxT4QRU=
13+
secure: JrQnpSi03zbBXpRPYydm1K3539UYsn8tefJtWOm6mnoSl0/zeFU7s5vsVCu5LngmM3O1GzpfVQCh9BUC/1u+oDr7NpQ6zASBbNkwyb9sWj2eH/6fOBkLPhOIBspBTDr+LYOAvZC4+fr/7tb7OtiMzTKeAlRJRkj1LUmEbD8sbBdn5msDfY14AmhtTfA4MibsBlF3uzIDgpy4HaIJRw/YgZXcasB83Mxv5g242FHrCNUmbWJkaiSb+CRwcLqpCYg5B1hNLKA61IBi4Cpk6iM2XsP0LTk+TmS6hPZi3Qbdm6knkhhElbmKyXvANFrswrd4HbR8tRMBcOR/APlLqdVm6aKXF0E20rkcpVEdseSssJ/O+q0EiRe3033nupNseLNmQcQdGeOAoOIOkcKMySrM4eUK2XjZ4M+Uw9arZ+creMiIhzMYOoMnCrkXlyQkyz5X2qDW+HyTgl0aLUaOKGNaoJ7UJ78sGihx34tFaxI9sB6InZ3wF/lj1KbvQG66gMjIRVZ20AqLKWvUYCED6DzgPQ+T5IVG4GDezUSV8J/XZGDUnkN1z0zeQZo3UTinicriRzYgpzYhs4iZ1fXo4pw26xk69SQZauxr5jYrTWTygKvyPK6Qnpq7e4EXGYDQHNVevyYFic/kAvP+Aofly/38iK59AjBiKGeUr7SYTdag9N4=
1514
on:
1615
tags: true
1716
distributions: sdist bdist_wheel

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to the pythonwhat project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
44

5+
## 2.24.0
6+
7+
- Support Python version 3.9
8+
- Update dependencies to up-to-date versions
9+
510
## 2.23.2
611

712
- Update behaviour of has_expr() default feedback message. If the student's evaluation is too long, it is now shortened and an ellipsis is added.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# pythonwhat
22

33
[![Build Status](https://travis-ci.org/datacamp/pythonwhat.svg?branch=master)](https://travis-ci.org/datacamp/pythonwhat)
4-
[![codecov](https://codecov.io/gh/datacamp/pythonwhat/branch/master/graph/badge.svg)](https://codecov.io/gh/datacamp/pythonwhat)
54
[![PyPI version](https://badge.fury.io/py/pythonwhat.svg)](https://badge.fury.io/py/pythonwhat)
65
[![Documentation Status](https://readthedocs.org/projects/pythonwhat/badge/?version=stable)](http://pythonwhat.readthedocs.io/en/stable/?badge=stable)
76
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_shield)
@@ -54,9 +53,9 @@ To learn how to include an SCT in a DataCamp course, visit https://instructor-su
5453
## Run tests
5554

5655
```bash
57-
pyenv local 3.5.2
58-
pip install -r requirements.txt
59-
pip install -e .
56+
pyenv local 3.9.6
57+
pip3.9 install -r requirements.txt
58+
pip3.9 install -e .
6059
pytest
6160
```
6261

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[pytest]
22
testpaths = tests/
33
addopts =-m "not compiled"
4+
markers =
5+
slow
6+
compiled

pythonwhat/Test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re
22
import numpy as np
33
import pandas as pd
4+
from pandas.testing import assert_frame_equal, assert_series_equal
45
from pythonwhat.tasks import *
56
from protowhat.Test import Test
67

@@ -115,21 +116,19 @@ def is_equal(x, y):
115116
# Types of errors don't matter (this is debatable)
116117
return str(x) == str(y)
117118
if areinstance(x, y, (np.ndarray, dict, list, tuple)):
118-
if np.array_equal(x, y):
119-
return True
120119
np.testing.assert_equal(x, y)
121120
return True
122121
elif areinstance(x, y, (map, filter)):
123122
return np.array_equal(list(x), list(y))
124123
elif areinstance(x, y, (pd.DataFrame,)):
125124
if x.equals(y):
126125
return True
127-
pd.util.testing.assert_frame_equal(x, y)
126+
assert_frame_equal(x, y)
128127
return True
129128
elif areinstance(x, y, (pd.Series,)):
130129
if x.equals(y):
131130
return True
132-
pd.util.testing.assert_series_equal(x, y)
131+
assert_series_equal(x, y)
133132
return True
134133
else:
135134
return x == y
@@ -185,4 +184,4 @@ def test(self):
185184
if self.pattern:
186185
self.result = re.search(self.search_string, self.string) is not None
187186
else:
188-
self.result = self.string.find(self.search_string) is not -1
187+
self.result = self.string.find(self.search_string) != -1

pythonwhat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "2.23.1"
1+
__version__ = "2.24.0"
22

33
from .test_exercise import test_exercise, allow_errors

pythonwhat/converters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def get_manual_converters():
66

77
converters = {
88
"pandas.io.excel.ExcelFile": lambda x: x.io,
9+
"pandas.io.excel._base.ExcelFile": lambda x: x.io,
910
"builtins.dict_keys": lambda x: sorted(x),
1011
"builtins.dict_items": lambda x: sorted(x),
1112
"bs4.BeautifulSoup": lambda x: str(x),

pythonwhat/utils_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def wrap_in_module(node):
7-
new_node = ast.Module(node)
7+
new_node = ast.Module(node, [])
88
if isinstance(node, list):
99
if len(node) > 0:
1010
new_node.first_token = node[0].first_token

pythonwhat/utils_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def assign_from_ast(node, expr):
1010
"""
1111
if isinstance(expr, str):
1212
expr = ast.Name(id=expr, ctx=ast.Load())
13-
mod = ast.Module([ast.Assign(targets=[node], value=expr)])
13+
mod = ast.Module([ast.Assign(targets=[node], value=expr)], [])
1414
ast.fix_missing_locations(mod)
1515
return compile(mod, "<assignment_script>", "exec")
1616

requirements.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# pythonwhat deps
2-
protowhat~=2.0.1
3-
asttokens~=1.1.10
4-
dill~=0.2.7.1
5-
markdown2~=2.3.7
6-
jinja2~=2.10
2+
protowhat~=2.1.0
3+
asttokens~=2.0.5
4+
dill~=0.3.4
5+
markdown2~=2.3.10
6+
jinja2~=2.11.3
77

8-
numpy~=1.14.2
9-
pandas~=0.22.0
8+
numpy~=1.19.5
9+
pandas~=1.3.2
1010

1111
# test deps
12-
scipy~=1.0.1
12+
scipy~=1.7.1
1313
bs4~=0.0.1
14-
html5lib~=1.0.1
15-
h5py~=2.7.1
16-
requests~=2.20.0
17-
seaborn~=0.8.1
18-
sqlalchemy~=1.3.0
19-
xlrd~=1.1.0
14+
html5lib~=1.1
15+
h5py~=3.1.0
16+
requests~=2.26.0
17+
seaborn~=0.11.2
18+
sqlalchemy~=1.4.23
19+
xlrd~=2.0.1
20+
openpyxl~=3.0.7
2021

2122
# test-utils deps
22-
pytest~=5.3.2
23-
codecov~=2.0.15
24-
pytest-cov~=2.8.1
23+
pytest~=6.2.5
24+
pytest-cov~=2.12.1
2525

2626
# building documentation
27-
sphinx~=1.8.3
28-
sphinx_rtd_theme~=0.3.1
29-
sphinx-jinja~=1.1.0
27+
sphinx~=4.1.2
28+
sphinx_rtd_theme~=0.5.2
29+
sphinx-jinja~=1.1.1
3030
sphinxprettysearchresults~=0.3.5

0 commit comments

Comments
 (0)