Skip to content

Commit

Permalink
Improve setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hermansje committed Mar 25, 2019
1 parent 303a8e3 commit 2e5040b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE
include requirements.txt
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ bs4==0.0.1
html5lib==1.0.1
h5py==2.7.1
requests==2.20.0
sas7bdat==2.0.7
seaborn==0.8.1
sqlalchemy==1.2.6
tweepy==3.6.0
xlrd==1.1.0

# test-utils deps
Expand Down
54 changes: 36 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,43 @@
from os import path
from setuptools import setup

_version_re = re.compile(r'__version__\s+=\s+(.*)')
PACKAGE_NAME = "pythonwhat"
REQUIREMENT_NAMES = ["markdown2", "jinja2", "asttokens", "dill", "numpy", "pandas"]

PACKAGE_NAME = 'pythonwhat'
HERE = path.abspath(path.dirname(__file__))
with open(path.join(HERE, 'README.md'), encoding='utf-8') as fp:
VERSION_FILE = path.join(HERE, PACKAGE_NAME, "__init__.py")
REQUIREMENTS_FILE = path.join(HERE, "requirements.txt")
README_FILE = path.join(HERE, "README.md")

with open(VERSION_FILE, encoding="utf-8") as fp:
_version_re = re.compile(r"__version__\s+=\s+(.*)")
VERSION = str(ast.literal_eval(_version_re.search(fp.read()).group(1)))
with open(REQUIREMENTS_FILE, encoding="utf-8") as fp:
req_txt = fp.read()
_requirements_re_template = r"^({}(?:\s*[<>=]+\s*\S*)?)\s*(?:#.*)?$"
REQUIREMENTS = [
re.search(_requirements_re_template.format(requirement), req_txt, re.M).group(0)
for requirement in REQUIREMENT_NAMES
]
with open(README_FILE, encoding="utf-8") as fp:
README = fp.read()
with open(path.join(HERE, PACKAGE_NAME, '__init__.py'), 'rb') as fp:
VERSION = str(ast.literal_eval(_version_re.search(
fp.read().decode('utf-8')).group(1)))

setup(name=PACKAGE_NAME,
version=VERSION,
packages=[PACKAGE_NAME, 'pythonwhat.test_funcs'],
install_requires=["dill", "numpy", "pandas", "markdown2", "jinja2", "asttokens>=1.1.10"],
long_description=README,
long_description_content_type='text/markdown',
license='GNU version 3',
author='DataCamp',
author_email='content-engineering@datacamp.com',
maintainer='Filip Schouwenaars',
maintainer_email='filip@datacamp.com',
url='https://github.com/datacamp/pythonwhat')
setup(
name=PACKAGE_NAME,
version=VERSION,
packages=[PACKAGE_NAME, "pythonwhat.test_funcs"],
install_requires=REQUIREMENTS,
description="Submission correctness tests for Python",
long_description=README,
long_description_content_type="text/markdown",
author="Filip Schouwenaars",
author_email="filip@datacamp.com",
maintainer="Jeroen Hermans",
maintainer_email="content-engineering@datacamp.com",
url="https://github.com/datacamp/pythonwhat",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
],
)
5 changes: 3 additions & 2 deletions tests/test_check_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_check_keys_exotic(sct):
assert output['correct']

def test_non_dillable():
# xlrd needed for Excel support
code = "xl = pd.ExcelFile('battledeath.xlsx')"
res = helper.run({
'DC_PEC': "import pandas as pd; from urllib.request import urlretrieve; urlretrieve('https://s3.amazonaws.com/assets.datacamp.com/production/course_998/datasets/battledeath.xlsx', 'battledeath.xlsx')",
Expand Down Expand Up @@ -194,7 +195,7 @@ def test_equality_challenge_2():
"DC_SCT": "Ex().check_object('mat').has_equal_value()"
})
assert res['correct']

@pytest.mark.parametrize('name, ls, le, cs, ce', [
('a', 3, 3, 5, 9),
("c", 8, 8, 5, 9),
Expand Down Expand Up @@ -303,7 +304,7 @@ def diff_assign_data():
df2.columns = ["c", "d"]
'''
}

def test_several_assignments(diff_assign_data):
res = helper.run({
**diff_assign_data,
Expand Down

0 comments on commit 2e5040b

Please sign in to comment.