Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BD-6] OEP-18 Compliance and tests with Python 3.8 #6

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- 3.5
- 3.6
- 3.8
env:
- TOXENV=testenv
install:
- pip install -r requirements/travis.txt
script:
- tox
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include *.txt *.md
include requirements/base.in
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
4 changes: 2 additions & 2 deletions openedx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ owner: bderusha
supporting_team: devops

oeps:
oep-2: false
oep-2: true
oep-7: true
oep-18: false
oep-18: true

tags:
- library
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
python_files = tests.py
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

pymongo
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
#
pymongo==3.10.1 # 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.2.1 # via -r requirements/pip_tools.in
six==1.15.0 # via pip-tools

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

-r base.txt

pytest
19 changes: 19 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# make upgrade
#
attrs==19.3.0 # via pytest
importlib-metadata==1.6.1 # via pluggy, pytest
more-itertools==8.3.0 # via pytest
packaging==20.4 # via pytest
pathlib2==2.3.5 # via pytest
pluggy==0.13.1 # via pytest
py==1.8.1 # via pytest
pymongo==3.10.1 # via -r requirements/base.txt
pyparsing==2.4.7 # via packaging
pytest==5.4.3 # via -r requirements/test.in
six==1.15.0 # via packaging, pathlib2
wcwidth==0.2.4 # via pytest
zipp==1.2.0 # via importlib-metadata
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.4 # via virtualenv
distlib==0.3.0 # via virtualenv
filelock==3.0.12 # via tox, virtualenv
importlib-metadata==1.6.1 # via importlib-resources, pluggy, tox, virtualenv
importlib-resources==2.0.0 # via virtualenv
packaging==20.4 # via tox
pluggy==0.13.1 # via tox
py==1.8.1 # via tox
pyparsing==2.4.7 # via packaging
six==1.15.0 # via packaging, tox, virtualenv
toml==0.10.1 # via tox
tox==3.15.2 # via -r requirements/tox.in
virtualenv==20.0.23 # via tox
zipp==1.2.0 # via importlib-metadata, importlib-resources
4 changes: 4 additions & 0 deletions requirements/travis.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Requirements for running tests in Travis
-c constraints.txt

-r tox.txt
20 changes: 20 additions & 0 deletions requirements/travis.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.4 # 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.1 # via -r requirements/tox.txt, importlib-resources, pluggy, tox, virtualenv
importlib-resources==2.0.0 # via -r requirements/tox.txt, virtualenv
packaging==20.4 # 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.15.0 # via -r requirements/tox.txt, packaging, tox, virtualenv
toml==0.10.1 # via -r requirements/tox.txt, tox
tox==3.15.2 # via -r requirements/tox.txt
virtualenv==20.0.23 # via -r requirements/tox.txt, tox
zipp==1.2.0 # via -r requirements/tox.txt, importlib-metadata, importlib-resources
25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@
# just use the regular README.
LONG_DESCRIPTION = README_MARKDOWN

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='MongoDBProxy',
py_modules=['mongodb_proxy'],
Expand All @@ -50,8 +72,9 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
],
setup_requires=['pyandoc'],
install_requires=['pymongo'],
install_requires=load_requirements('requirements/base.in'),
url="https://github.com/arngarden/MongoDBProxy"
)
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tox]
envlist = testenv

[testenv]
deps =
-rrequirements/test.txt
commands =
pytest