Skip to content

Commit

Permalink
Dropped python2 support (#18)
Browse files Browse the repository at this point in the history
* dropped python2 support

* fixed minor python3 flake8 errors

* fixed minor python3 flake8 errors

* fixed minor python3 flake8 errors

* updated ckan db username

* dropped python2 support

* dropped python2 support
  • Loading branch information
msouff authored and swainn committed Mar 14, 2019
1 parent 17c56c3 commit d05e690
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 68 deletions.
11 changes: 3 additions & 8 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.7.0-{build}
version: 2.0.0-{build}

environment:
global:
Expand All @@ -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%

Expand All @@ -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%"
Expand All @@ -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
Expand Down
31 changes: 3 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -82,27 +71,13 @@ 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:
- . travis/setup_geoserver_e2e_tests.sh
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:
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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<version>.txt
pip install -r requirements.txt
conda install -c tethysplatform gsconfig
python setup.py install
```
Expand Down
10 changes: 0 additions & 10 deletions requirements-py2.txt

This file was deleted.

File renamed without changes.
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
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()

# 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,
Expand All @@ -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',
],
Expand Down
5 changes: 1 addition & 4 deletions tethys_dataset_services/engines/ckan_engine.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import (absolute_import, division,
print_function, unicode_literals)

import os
import json
import pprint
Expand Down Expand Up @@ -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 = './'
Expand Down
4 changes: 1 addition & 3 deletions tethys_dataset_services/engines/geoserver_engine.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F403, F401

import os
Expand Down
2 changes: 0 additions & 2 deletions tethys_dataset_services/tests/unit_tests/utilities_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F403, F401

import os
Expand Down
3 changes: 1 addition & 2 deletions tethys_dataset_services/utilities.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion travis/setup_ckan_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=\"[email protected]\" 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

0 comments on commit d05e690

Please sign in to comment.