diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e58692c --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index 376b77a..6d8860c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include *.txt *.md +include requirements/base.in diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..5cb7ab3 --- /dev/null +++ b/Makefile @@ -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 diff --git a/openedx.yaml b/openedx.yaml index 3d68afe..7e5a2b9 100644 --- a/openedx.yaml +++ b/openedx.yaml @@ -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 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..eb76e0d --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +python_files = tests.py diff --git a/requirements/base.in b/requirements/base.in new file mode 100644 index 0000000..2f3959e --- /dev/null +++ b/requirements/base.in @@ -0,0 +1,4 @@ +# Core requirements for using this package +-c constraints.txt + +pymongo diff --git a/requirements/base.txt b/requirements/base.txt new file mode 100644 index 0000000..4c0864e --- /dev/null +++ b/requirements/base.txt @@ -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 diff --git a/requirements/constraints.txt b/requirements/constraints.txt new file mode 100644 index 0000000..94595ab --- /dev/null +++ b/requirements/constraints.txt @@ -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. diff --git a/requirements/pip_tools.in b/requirements/pip_tools.in new file mode 100644 index 0000000..caf45a9 --- /dev/null +++ b/requirements/pip_tools.in @@ -0,0 +1,4 @@ + # Dependencies to run compile tools +-c constraints.txt + +pip-tools # Contains pip-compile, used to generate pip requirements files diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt new file mode 100644 index 0000000..279019f --- /dev/null +++ b/requirements/pip_tools.txt @@ -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 diff --git a/requirements/test.in b/requirements/test.in new file mode 100644 index 0000000..cd32eba --- /dev/null +++ b/requirements/test.in @@ -0,0 +1,6 @@ +# Requirements for test runs\ +-c constraints.txt + +-r base.txt + +pytest diff --git a/requirements/test.txt b/requirements/test.txt new file mode 100644 index 0000000..3c805db --- /dev/null +++ b/requirements/test.txt @@ -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 diff --git a/requirements/tox.in b/requirements/tox.in new file mode 100644 index 0000000..9a28694 --- /dev/null +++ b/requirements/tox.in @@ -0,0 +1,4 @@ +# Used for tests +-c constraints.txt + +tox diff --git a/requirements/tox.txt b/requirements/tox.txt new file mode 100644 index 0000000..97c707e --- /dev/null +++ b/requirements/tox.txt @@ -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 diff --git a/requirements/travis.in b/requirements/travis.in new file mode 100644 index 0000000..3dbd7b0 --- /dev/null +++ b/requirements/travis.in @@ -0,0 +1,4 @@ +# Requirements for running tests in Travis +-c constraints.txt + +-r tox.txt diff --git a/requirements/travis.txt b/requirements/travis.txt new file mode 100644 index 0000000..ea4a348 --- /dev/null +++ b/requirements/travis.txt @@ -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 diff --git a/setup.py b/setup.py index 014d2d2..1773b83 100644 --- a/setup.py +++ b/setup.py @@ -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'], @@ -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" ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..167d23e --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = testenv + +[testenv] +deps = + -rrequirements/test.txt +commands = + pytest