Skip to content

Commit

Permalink
Merge pull request #20 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 11, 2020
2 parents 66683fb + af1fae8 commit a3fe92c
Show file tree
Hide file tree
Showing 18 changed files with 172 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
build
.pytest_cache
.coverage
venv/
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
language: python
sudo: false
cache: pip
matrix:
include:
- python: 3.5
env: TOXENV=py3
- python: 3.5
env: TOXENV=quality
python:
- 3.5
- 3.8
env:
- TOXENV=py3
- TOXENV=quality
addons:
apt:
packages:
- libblas-dev
- liblapack-dev
- gfortran
install:
- pip install tox
- pip install coveralls
- pip install -r requirements/travis.txt
script:
- make test
after_success:
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include LICENSE
include README.rst
include requirements/base.in
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ clean: ## Remove all build artifacts

test: ## Run the library test suite
tox

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/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
Expand Up @@ -3,7 +3,7 @@
---
oeps:
oep-7: false
oep-18: false
oep-18: true

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

pyparsing
numpy
scipy
six
10 changes: 10 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
numpy==1.18.3 # via -r requirements/base.in, scipy
pyparsing==2.4.7 # via -r requirements/base.in
scipy==1.4.1 # via -r requirements/base.in
six==1.14.0 # via -r requirements/base.in
9 changes: 9 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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.
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.1 # 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
8 changes: 8 additions & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Requirements for test runs
-c constraints.txt

-r base.txt # Core dependencies for the cookiecutter

coverage
pycodestyle
pylint
20 changes: 20 additions & 0 deletions requirements/test.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
#
astroid==2.4.0 # via pylint
coverage==5.1 # via -r requirements/test.in
isort==4.3.21 # via pylint
lazy-object-proxy==1.4.3 # via astroid
mccabe==0.6.1 # via pylint
numpy==1.18.3 # via -r requirements/base.txt, scipy
pycodestyle==2.5.0 # via -r requirements/test.in
pylint==2.5.0 # via -r requirements/test.in
pyparsing==2.4.7 # via -r requirements/base.txt
scipy==1.4.1 # via -r requirements/base.txt
six==1.14.0 # via -r requirements/base.txt, astroid
toml==0.10.0 # via pylint
typed-ast==1.4.1 # via astroid
wrapt==1.12.1 # via astroid
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.14.6 # via -r requirements/tox.in
virtualenv==20.0.18 # 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

coveralls
28 changes: 28 additions & 0 deletions requirements/travis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
appdirs==1.4.3 # via -r requirements/tox.txt, virtualenv
certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
coverage==5.1 # via coveralls
coveralls==2.0.0 # via -r requirements/travis.in
distlib==0.3.0 # via -r requirements/tox.txt, virtualenv
docopt==0.6.2 # via coveralls
filelock==3.0.12 # via -r requirements/tox.txt, tox, virtualenv
idna==2.9 # via requests
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
requests==2.23.0 # via coveralls
six==1.14.0 # via -r requirements/tox.txt, packaging, tox, virtualenv
toml==0.10.0 # via -r requirements/tox.txt, tox
tox==3.14.6 # via -r requirements/tox.txt
urllib3==1.25.9 # via requests
virtualenv==20.0.18 # via -r requirements/tox.txt, tox
zipp==1.2.0 # via -r requirements/tox.txt, importlib-metadata, importlib-resources
30 changes: 22 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@

README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()

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(
name="openedx-calc",
Expand All @@ -19,12 +40,7 @@
'calc'
],
include_package_data=True,
install_requires=[
"pyparsing==2.2.0",
"numpy",
"scipy",
'six',
],
install_requires=load_requirements('requirements/base.in'),
python_requires=">=3.5",
license="AGPL 3.0",
test_suite='calc.tests',
Expand All @@ -40,8 +56,6 @@
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
whitelist_externals =
touch
deps =
coverage
-r requirements/test.txt
commands =
coverage run setup.py test
coverage report
Expand Down

0 comments on commit a3fe92c

Please sign in to comment.