Skip to content

Commit

Permalink
Merge pull request #8 from eduNEXT/eric/oep-18
Browse files Browse the repository at this point in the history
[BD-6] Compliance with OEP-18
  • Loading branch information
awais786 authored May 8, 2020
2 parents a1920a4 + dcd991c commit 96c67ed
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 38 deletions.
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
language: python
python:
- 3.6
- 3.5
- 3.4
- 2.7
matrix:
include:
- python: 2.7
env: TOXENV=quality
- 3.5
- 3.8
install:
- pip install -U tox-travis
- pip install -r requirements/travis.txt
script:
- tox
after_success:
Expand All @@ -22,4 +16,4 @@ deploy:
secure: jIYzuroblLNT6jdpfhL4+U01fKGTzuXmO68aNuCH+0+Ijyma/wndnk7k1vcD/5CpPua7xw2c5irRhqEVIIKthkot48Jfk25vKPp9Mn89GYGH2lfJnrGTxUnILRU0XgFPSNpNBGQ3EnuH7PfAzjxMTiwxOk+snaAVcz2nyxP3/rHR6wOx7bNqZh79ImzD4UT5TefeZzPdB92MFj1nXGR22F7qoYfKJJsa/2RjqY6XdL+mMrK4u4ZopeBm89SAB8PTDAd+BF52dp0ZufoNwOQGcfkXHPeEV0JWlSvBB/aiB4NijmGmTVniGxWwV4i5HC44O7jhYTvAtrMJE5jjdJYUzOUpwJ4+OXvuaALJGMLc1uMXNvs+4cDZXF2iTg2Cf73cm5zvDMVJn0J7BwUPxOmonMBidpTZaiC2pEokyXXEU+99fL/IvKPtB3FJZIWpOGngWMfPOBRHwxOdwjOrEawUQ8VYIFYFRtEK541q60JDJs7Qfle69b5UpzgtxDDbLVTKNedia9uQ0yxC1VKMQslEmQrp7chG0cLw1sxM45D63P9BePItosnT0dMxY2n3DGo7z68Y4T8gpt+8ZFzfxtwgD4AUyENjwkdr3g791tsE70HJAi7GyexwX2EtMAkxhc6QBtLZq0LVnTG7E110Pcsf8zvI+qaSzZOjamFL261Tvfs=
on:
tags: true
python: 3.6
python: 3.5
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

0.2 (2020-05-02)
------------------

* Drop support to python 2.7 and add support to python 3.8

0.1.5 (2018-08-08)
------------------

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
include requirements/base.in

recursive-include tests *
recursive-exclude * __pycache__
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,13 @@ dist: clean ## builds source and wheel package

install: clean ## install the package to the active Python's site-packages
python setup.py install

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -q -r requirements/pip_tools.txt
pip-compile --upgrade -o requirements/pip_tools.txt requirements/pip_tools.in
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/doc.txt requirements/doc.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
pip-compile --upgrade -o requirements/travis.txt requirements/travis.in
2 changes: 1 addition & 1 deletion openedx.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
oeps:
oep-7: true
oep-18: false
oep-18: true

tags:
- library
4 changes: 4 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Core requirements for using this package
-c constraints.txt

Click
7 changes: 7 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
click==7.1.2 # via -r requirements/base.in
17 changes: 17 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Version constraints for pip-installation.
#
# This file doesn't install any packages. It specifies version constraints
# that will be applied if a package is needed.
#
# When pinning something here, please provide an explanation of why. Ideally,
# link to other information that will help people in the future to remove the
# pin when possible. Writing an issue against the offending project and
# linking to it here is good.

# TODO: Many pinned dependencies should be unpinned and/or moved to this constraints file.

# Use latest Django LTS version
Django<2.3.0

# mock version 4.0.0 drops support for python 3.5
mock<4.0.0
5 changes: 5 additions & 0 deletions requirements/doc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dependencies for building documentation

-r base.in # Core dependencies

Sphinx
34 changes: 34 additions & 0 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
alabaster==0.7.12 # via sphinx
babel==2.8.0 # via sphinx
certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
click==7.1.2 # via -r requirements/base.in
docutils==0.16 # via sphinx
idna==2.9 # via requests
imagesize==1.2.0 # via sphinx
jinja2==2.11.2 # via sphinx
markupsafe==1.1.1 # via jinja2
packaging==20.3 # via sphinx
pygments==2.6.1 # via sphinx
pyparsing==2.4.7 # via packaging
pytz==2020.1 # via babel
requests==2.23.0 # via sphinx
six==1.14.0 # via packaging
snowballstemmer==2.0.0 # via sphinx
sphinx==3.0.3 # via -r requirements/doc.in
sphinxcontrib-applehelp==1.0.2 # via sphinx
sphinxcontrib-devhelp==1.0.2 # via sphinx
sphinxcontrib-htmlhelp==1.0.3 # via sphinx
sphinxcontrib-jsmath==1.0.1 # via sphinx
sphinxcontrib-qthelp==1.0.3 # via sphinx
sphinxcontrib-serializinghtml==1.1.4 # via sphinx
urllib3==1.25.9 # via requests

# The following packages are considered to be unsafe in a requirements file:
# setuptools
4 changes: 4 additions & 0 deletions requirements/pip_tools.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Dependencies to run compile tools
-c constraints.txt

pip-tools # Contains pip-compile, used to generate pip requirements files
12 changes: 12 additions & 0 deletions requirements/pip_tools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
click==7.1.2 # via pip-tools
pip-tools==5.1.2 # via -r requirements/pip_tools.in
six==1.14.0 # via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
14 changes: 14 additions & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Requirements for test runs
-c constraints.txt

-r base.txt # Core dependencies for the cookiecutter

bumpversion
wheel
watchdog
flake8
coverage
twine

pytest
pytest-runner
47 changes: 47 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
attrs==19.3.0 # via pytest
bleach==3.1.5 # via readme-renderer
bumpversion==0.5.3 # via -r requirements/test.in
certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
click==7.1.2 # via -r requirements/base.txt
coverage==5.1 # via -r requirements/test.in
docutils==0.16 # via readme-renderer
entrypoints==0.3 # via flake8
flake8==3.7.9 # via -r requirements/test.in
idna==2.9 # via requests
importlib-metadata==1.6.0 # via pluggy, pytest
mccabe==0.6.1 # via flake8
more-itertools==8.2.0 # via pytest
packaging==20.3 # via bleach, pytest
pathlib2==2.3.5 # via pytest
pathtools==0.1.2 # via watchdog
pkginfo==1.5.0.1 # via twine
pluggy==0.13.1 # via pytest
py==1.8.1 # via pytest
pycodestyle==2.5.0 # via flake8
pyflakes==2.1.1 # via flake8
pygments==2.6.1 # via readme-renderer
pyparsing==2.4.7 # via packaging
pytest-runner==5.2 # via -r requirements/test.in
pytest==5.4.1 # via -r requirements/test.in
readme-renderer==26.0 # via twine
requests-toolbelt==0.9.1 # via twine
requests==2.23.0 # via requests-toolbelt, twine
six==1.14.0 # via bleach, packaging, pathlib2, readme-renderer
tqdm==4.46.0 # via twine
twine==1.15.0 # via -r requirements/test.in
urllib3==1.25.9 # via requests
watchdog==0.10.2 # via -r requirements/test.in
wcwidth==0.1.9 # via pytest
webencodings==0.5.1 # via bleach
wheel==0.34.2 # via -r requirements/test.in
zipp==1.2.0 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
4 changes: 4 additions & 0 deletions requirements/tox.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used for tests
-c constraints.txt

tox
20 changes: 20 additions & 0 deletions requirements/tox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
appdirs==1.4.3 # via virtualenv
distlib==0.3.0 # via virtualenv
filelock==3.0.12 # via tox, virtualenv
importlib-metadata==1.6.0 # via importlib-resources, pluggy, tox, virtualenv
importlib-resources==1.5.0 # via virtualenv
packaging==20.3 # via tox
pluggy==0.13.1 # via tox
py==1.8.1 # via tox
pyparsing==2.4.7 # via packaging
six==1.14.0 # via packaging, tox, virtualenv
toml==0.10.0 # via tox
tox==3.15.0 # via -r requirements/tox.in
virtualenv==20.0.20 # via tox
zipp==1.2.0 # via importlib-metadata, importlib-resources
6 changes: 6 additions & 0 deletions requirements/travis.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Requirements for running tests in Travis
-c constraints.txt

-r tox.txt

tox-travis
21 changes: 21 additions & 0 deletions requirements/travis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
appdirs==1.4.3 # via -r requirements/tox.txt, virtualenv
distlib==0.3.0 # via -r requirements/tox.txt, virtualenv
filelock==3.0.12 # via -r requirements/tox.txt, tox, virtualenv
importlib-metadata==1.6.0 # via -r requirements/tox.txt, importlib-resources, pluggy, tox, virtualenv
importlib-resources==1.5.0 # via -r requirements/tox.txt, virtualenv
packaging==20.3 # via -r requirements/tox.txt, tox
pluggy==0.13.1 # via -r requirements/tox.txt, tox
py==1.8.1 # via -r requirements/tox.txt, tox
pyparsing==2.4.7 # via -r requirements/tox.txt, packaging
six==1.14.0 # via -r requirements/tox.txt, packaging, tox, virtualenv
toml==0.10.0 # via -r requirements/tox.txt, tox
tox-travis==0.12 # via -r requirements/travis.in
tox==3.15.0 # via -r requirements/tox.txt, tox-travis
virtualenv==20.0.20 # via -r requirements/tox.txt, tox
zipp==1.2.0 # via -r requirements/tox.txt, importlib-metadata, importlib-resources
12 changes: 0 additions & 12 deletions requirements_dev.txt

This file was deleted.

31 changes: 25 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@

test_requirements = ['pytest', ]

def load_requirements(*requirements_paths):
"""
Load all requirements from the specified requirements files.
Returns a list of requirement strings.
"""
requirements = set()
for path in requirements_paths:
with open(path) as reqs:
requirements.update(
line.split('#')[0].strip() for line in reqs
if is_requirement(line.strip())
)
return list(requirements)


def is_requirement(line):
"""
Return True if the requirement line is a package requirement;
that is, it is not blank, a comment, a URL, or an included file.
"""
return line and not line.startswith(('-r', '#', '-e', 'git+', '-c'))

setup(
author="edX",
author_email='[email protected]',
Expand All @@ -25,20 +47,17 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
],
description="User utilities for the Open edX platform",
entry_points={
'console_scripts': [
'user_util=user_util.cli:retire_user',
],
},
install_requires=requirements,
install_requires=load_requirements('requirements/base.in'),
license="GNU General Public License v3",
long_description=readme + '\n\n' + history,
include_package_data=True,
Expand All @@ -49,6 +68,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/edx/user-util',
version='0.1.5',
version='0.2',
zip_safe=False,
)
4 changes: 2 additions & 2 deletions tests/test_user_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
def test_cli_with_no_options():
runner = CliRunner()
result_w_no_options = runner.invoke(cli.retire_user)
assert result_w_no_options.exit_code == -1
assert result_w_no_options.exit_code != 0


def test_cli_help():
Expand All @@ -70,7 +70,7 @@ def test_cli_email():
def test_cli_bad_salt():
runner = CliRunner()
cmd_result = runner.invoke(cli.retire_user, ['-u', 'a_learner', '-e', '[email protected]', '-s', '[]'])
assert cmd_result.exit_code == -1
assert cmd_result.exit_code != 0

#
# Username retirement tests
Expand Down
10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[tox]
envlist = py27, py34, py35, py36, flake8
envlist = py{35}-django{22},py{38}-django{22,30},quality

[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27
3.8: py38
quality: flake8

[testenv:quality]
Expand All @@ -18,10 +16,8 @@ commands = flake8 user_util
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
-r requirements/test.txt
commands =
pip install -U pip
python setup.py develop
py.test --basetemp={envtmpdir}


0 comments on commit 96c67ed

Please sign in to comment.