diff --git a/.appveyor.yml b/.appveyor.yml index 1879d11..5590b90 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -version: 1.7.0-{build} +version: 2.0.0-{build} environment: global: @@ -12,10 +12,6 @@ environment: PYTHON_VERSION: "3.6" PYTHON_ARCH: "64" - - PYTHON: "C:\\Miniconda-x64" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "64" - init: - ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %HOME% @@ -31,7 +27,7 @@ install: throw "There are newer queued builds for this pull request, failing early." } # these correspond to folder naming of miniconda installs on appveyor. See # https://www.appveyor.com/docs/installed-software#python - - if "%PYTHON_VERSION%" == "3.6" set "BASE_PYTHON_VERSION=36" + - set "BASE_PYTHON_VERSION=36" - if "%PYTHON_ARCH%" == "64" set "ARCH_LABEL=-x64" # These are already installed on appveyor. Update them. - set "CONDA_ROOT=C:\Miniconda%BASE_PYTHON_VERSION%%ARCH_LABEL%" @@ -49,8 +45,7 @@ install: # this is to ensure dependencies - python --version - python -c "import struct; print(struct.calcsize('P') * 8)" - - if "%PYTHON_VERSION%" == "3.6" pip install -r requirements-py3.txt - - if "%PYTHON_VERSION%" == "2.7" pip install -r requirements-py2.txt + - pip install -r requirements.txt # Install Tethys Dataset Services - pip install --no-deps . - set PATH diff --git a/.travis.yml b/.travis.yml index d712046..3da6491 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,14 +22,11 @@ env: python: # We don't actually use the Travis Python, but this keeps it organized. - - "2.7" - "3.6" stages: - lint - test - - ckan_e2e_tests_py2 - - geoserver_e2e_tests_py2 - ckan_e2e_tests_py3 - geoserver_e2e_tests_py3 - name: deploy-pip @@ -41,11 +38,7 @@ install: - sudo apt-get update # We do this conditionally because it saves us some downloading if the # version is the same. - - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; - else - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - fi + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r @@ -56,14 +49,10 @@ install: # Create environment - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION - source activate test-environment - # Install Python 2 and 3 compatible version of gsconfig + # Install Python 3 compatible version of gsconfig - conda install -c tethysplatform gsconfig # Install dependencies - - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - pip install -r requirements-py2.txt; - else - pip install -r requirements-py3.txt; - fi + - pip install -r requirements.txt; - pip install python-coveralls - python setup.py develop @@ -82,13 +71,6 @@ jobs: script: - flake8 - - stage: geoserver_e2e_tests_py2 - python: "2.7" - before_install: - - . travis/setup_geoserver_e2e_tests.sh - script: - - . travis/run_geoserver_e2e_tests.sh - - stage: geoserver_e2e_tests_py3 python: "3.6" before_install: @@ -96,13 +78,6 @@ jobs: script: - . travis/run_geoserver_e2e_tests.sh - - stage: ckan_e2e_tests_py2 - python: "2.7" - before_install: - - . travis/setup_ckan_e2e_tests.sh - script: - - . travis/run_ckan_e2e_tests.sh - - stage: ckan_e2e_tests_py3 python: "3.6" before_install: diff --git a/README.md b/README.md index 6513446..238cef3 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ Tethys datasets provides Python programming interface for dataset services such as CKAN and HydroShare. +--- +**NOTE** + +Tethys Dataset Services versions 2.0.0 and up will only support Python 3. For Python 2 support see version 1.7.0. + +--- + ## Installation Tethys Datasets Services can be installed via conda or downloading the source. To install via pip:: @@ -19,7 +26,7 @@ To install via download:: ``` git clone https://github.com/CI-WATER/django-tethys_dataset_services.git cd tethys_dataset_services -pip install -r requirements-py.txt +pip install -r requirements.txt conda install -c tethysplatform gsconfig python setup.py install ``` diff --git a/requirements-py2.txt b/requirements-py2.txt deleted file mode 100644 index f5b7688..0000000 --- a/requirements-py2.txt +++ /dev/null @@ -1,10 +0,0 @@ -django < 2 -future -owslib -requests -requests_toolbelt -mock -coverage -sqlalchemy -psycopg2-binary -flake8 \ No newline at end of file diff --git a/requirements-py3.txt b/requirements.txt similarity index 100% rename from requirements-py3.txt rename to requirements.txt diff --git a/setup.py b/setup.py index 899a94b..bb8868f 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ import os from setuptools import setup, find_packages -import sys with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() @@ -8,12 +7,12 @@ # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) -requirements_file = 'requirements-py2.txt' if sys.version_info.major == 2 else 'requirements-py3.txt' +requirements_file = 'requirements.txt' with open(requirements_file, 'r') as r: requires = r.read() -version = '1.7.0' +version = '2.0.0' setup( name='tethys_dataset_services', version=version, @@ -31,8 +30,8 @@ 'License :: OSI Approved :: BSD License', # example license 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], diff --git a/tethys_dataset_services/engines/ckan_engine.py b/tethys_dataset_services/engines/ckan_engine.py index ed06b3b..e5a5c52 100644 --- a/tethys_dataset_services/engines/ckan_engine.py +++ b/tethys_dataset_services/engines/ckan_engine.py @@ -1,6 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) - import os import json import pprint @@ -588,7 +585,7 @@ def _download_resource(self, resource, location=None, local_file_name=None): if location: try: os.makedirs(location) - except OSError as e: + except OSError: pass else: location = './' diff --git a/tethys_dataset_services/engines/geoserver_engine.py b/tethys_dataset_services/engines/geoserver_engine.py index 0a14758..5de78e0 100644 --- a/tethys_dataset_services/engines/geoserver_engine.py +++ b/tethys_dataset_services/engines/geoserver_engine.py @@ -1,5 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) from past.types import basestring from builtins import * # noqa: F403, F401 @@ -1259,7 +1257,7 @@ def create_sql_view(self, feature_type_name, postgis_store_id, sql, geometry_col geometry_srid (string, optional): EPSG spatial reference id of the geometry column. Defaults to 4326. default_style (string, optional): Identifier of a style to assign as the default style. Can be a style name or a workspace-name combination (e.g.: "name" or "workspace:name"). # noqa: E501 key_column (string, optional): The name of the key column. - parameters (iterable, optional): A list/tuple of tuple-triplets representing parameters in the form (name, default, regex_validation), (e.g.: (('variable', 'pressure', '^[\w]+$'), ('simtime', '0:00:00', '^[\w\:]+$')) # noqa: E501 + parameters (iterable, optional): A list/tuple of tuple-triplets representing parameters in the form (name, default, regex_validation), (e.g.: (('variable', 'pressure', '^[\w]+$'), ('simtime', '0:00:00', '^[\w\:]+$')) # noqa: E501,W605 debug (bool, optional): Pretty print the response dictionary to the console for debugging. Defaults to False. Returns: diff --git a/tethys_dataset_services/tests/e2e_tests/geoserver_engine_e2e_tests.py b/tethys_dataset_services/tests/e2e_tests/geoserver_engine_e2e_tests.py index bd01341..b71218a 100644 --- a/tethys_dataset_services/tests/e2e_tests/geoserver_engine_e2e_tests.py +++ b/tethys_dataset_services/tests/e2e_tests/geoserver_engine_e2e_tests.py @@ -6,8 +6,7 @@ * Copyright: (c) Aquaveo 2018 ******************************************************************************** """ -from __future__ import (absolute_import, division, - print_function, unicode_literals) + from builtins import * # noqa: F403, F401 import random diff --git a/tethys_dataset_services/tests/unit_tests/geoserver_engine_tests.py b/tethys_dataset_services/tests/unit_tests/geoserver_engine_tests.py index 8563aa2..a77b1ae 100644 --- a/tethys_dataset_services/tests/unit_tests/geoserver_engine_tests.py +++ b/tethys_dataset_services/tests/unit_tests/geoserver_engine_tests.py @@ -1,5 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) from builtins import * # noqa: F403, F401 import os diff --git a/tethys_dataset_services/tests/unit_tests/utilities_test.py b/tethys_dataset_services/tests/unit_tests/utilities_test.py index 454c17d..39ac6f2 100644 --- a/tethys_dataset_services/tests/unit_tests/utilities_test.py +++ b/tethys_dataset_services/tests/unit_tests/utilities_test.py @@ -1,5 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) from builtins import * # noqa: F403, F401 import os diff --git a/tethys_dataset_services/utilities.py b/tethys_dataset_services/utilities.py index 3d013e2..4bbafe4 100644 --- a/tethys_dataset_services/utilities.py +++ b/tethys_dataset_services/utilities.py @@ -1,6 +1,5 @@ # Credits: http://code.activestate.com/recipes/573463-converting-xml-to-dictionary-and-back/ -from __future__ import (absolute_import, division, - print_function, unicode_literals) + from past.builtins import basestring from builtins import * # noqa: F403, F401 diff --git a/travis/setup_ckan_e2e_tests.sh b/travis/setup_ckan_e2e_tests.sh index a85d22f..96d89ad 100644 --- a/travis/setup_ckan_e2e_tests.sh +++ b/travis/setup_ckan_e2e_tests.sh @@ -19,7 +19,7 @@ docker logs ckan echo "CREATING ADMIN USER..." docker exec -it ckan /bin/bash -c "echo \"y\" | /usr/local/bin/ckan-paster --plugin=ckan sysadmin -c /etc/ckan/production.ini add ${CKAN_USERNAME} email=\"foo@tethysplatform.org\" password=\"${CKAN_PASSWORD}\" apikey=\"11111111-1111-1111-1111-111111111111\"" echo "GETTING API KEY..." -export CKAN_APIKEY=$(sudo docker exec -it db /bin/bash -c "psql -U postgres -c \"SELECT apikey FROM ckan.public.user WHERE name = '${CKAN_USERNAME}'\" ckan" | sed -n 3p | tr -d '[:space:]') +export CKAN_APIKEY=$(sudo docker exec -it db /bin/bash -c "psql -U ckan -c \"SELECT apikey FROM ckan.public.user WHERE name = '${CKAN_USERNAME}'\" ckan" | sed -n 3p | tr -d '[:space:]') echo "$CKAN_APIKEY" popd popd \ No newline at end of file