From da0b6bf9d49ae04e6d78bb0cce3b0d82fdbdf8c2 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:46:43 -0300 Subject: [PATCH 01/14] fix language setting --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f767789..ef70971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ -git blanguage: python +language: python + sudo: required # if the https://travis-ci.org/ODM2/ODM2PythonAPI/requests ever says: missing config # validate at: http://lint.travis-ci.org/ @@ -64,4 +65,3 @@ install: # now just our code script: - py.test - From c4ec98cf7a543ee14cfd512cd2462782649f51ec Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:47:25 -0300 Subject: [PATCH 02/14] with addons we don't need sudo --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef70971..8a14eb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: python -sudo: required -# if the https://travis-ci.org/ODM2/ODM2PythonAPI/requests ever says: missing config -# validate at: http://lint.travis-ci.org/ +sudo: false + python: # - "2.6" - "2.7" From bfd0b68af822e696f6bcc55c11aaf7b5a87e957d Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:50:59 -0300 Subject: [PATCH 03/14] clean unnecessary comments --- .travis.yml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a14eb2..e1b4a36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,22 +3,17 @@ language: python sudo: false python: -# - "2.6" - "2.7" -# - "3.2" -# - "3.3" -# - "3.4" -# - "3.5" -# - "3.5-dev" # 3.5 development branch -# - "nightly" # currently points to 3.6-dev -# command to install dependencies + cache: directories: - $HOME/.cache/pip/wheels - $HOME/virtualenv/python2.7.9 + services: - mysql - postgresql + addons: apt: packages: @@ -36,7 +31,7 @@ addons: - libproj-dev - libgeos-dev - libspatialite-dev -# mariadb: '10.1' + before_script: - ./ci-helpers/mysql_setup.sh - ./ci-helpers/postgres_setup.sh @@ -44,23 +39,15 @@ before_script: before_install: -# python -m pip makes the install go into the virtualenv - sudo pip install --upgrade pip - sudo python -m pip install pandas - export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;sudo python -m pip install pymssql -# - python -m pip install mysql-python -install: # now just our code + +install: - sudo pip install -e git+https://github.com/ODM2/geoalchemy.git@v0.7.4#egg=geoalchemy-0.7.4 - python -m pip install . - python -m pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc - # pysqlite -# - pip install pysqlite - pip list -# don't forget to open up the azure mssql server to these addreses -# https://docs.travis-ci.com/user/ip-addresses/ - -# command to run tests script: - - py.test From 6a2db1e7debc139fb68b0f74be6edacf614cc5e2 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:52:29 -0300 Subject: [PATCH 04/14] don't cache pip, I'll implement conda caching later --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1b4a36..8e5bdde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,6 @@ sudo: false python: - "2.7" -cache: - directories: - - $HOME/.cache/pip/wheels - - $HOME/virtualenv/python2.7.9 - services: - mysql - postgresql From 4c1947c62e421fd1083e2288ebae2269b0ba04c9 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:54:30 -0300 Subject: [PATCH 05/14] organize and comment on the addons --- .travis.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e5bdde..93b01f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,17 +12,20 @@ services: addons: apt: packages: - - cmake - - unixodbc - - unixodbc-dev + # FIXME: when activating the services above I don't think these are needed. - odbcinst1debian2 - odbcinst - - freetds-dev - - freetds-bin - tdsodbc - - libc6 - e2fsprogs + # FIXME: the dependencies below can probably be replaced by conda. + - libc6 + - freetds-dev + - freetds-bin + - unixodbc + - unixodbc-dev - mysql-client + # FIXME: I don't see the need for these anywhere. + - cmake - libproj-dev - libgeos-dev - libspatialite-dev From c02e32fdc004df8556cc014ea50ba37e3c8fb0af Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 10:59:15 -0300 Subject: [PATCH 06/14] install the env with conda --- .travis.yml | 10 +++++++--- requirements-dev.txt | 14 ++++++++++++++ requirements.txt | 2 -- requirements_tests.txt | 15 --------------- 4 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 requirements-dev.txt delete mode 100644 requirements_tests.txt diff --git a/.travis.yml b/.travis.yml index 93b01f1..53a678b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,13 @@ before_script: before_install: - - sudo pip install --upgrade pip - - sudo python -m pip install pandas - - export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1;sudo python -m pip install pymssql + - wget http://bit.ly/miniconda -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - conda update --yes --all + - conda config --add channels odm2 --force + - conda create --yes -n TEST python=$TRAVIS_PYTHON_VERSION --file requirements.txt --file requirements-dev.txt + - source activate TEST install: - sudo pip install -e git+https://github.com/ODM2/geoalchemy.git@v0.7.4#egg=geoalchemy-0.7.4 diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..442124e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,14 @@ +pytest +pytest-cov +mock +pymysql +pymssql +psycopg2 +pymssql +psycopg2 +flake8 +# FIXME: I am not sure these are needed. +# pysqlite +# sqlite +# pyspatialite +# mysql-python diff --git a/requirements.txt b/requirements.txt index 78f8f0c..7e74829 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ pyodbc -six sqlalchemy pandas -#psycopg2 # Commented out because I could not pip install it. diff --git a/requirements_tests.txt b/requirements_tests.txt deleted file mode 100644 index 2849288..0000000 --- a/requirements_tests.txt +++ /dev/null @@ -1,15 +0,0 @@ --r requirements.txt -pytest -pytest-cov -mock -#db support -pymysql -#pysqlite -#sqlite -pymssql -psycopg2 -#pyspatialite -#mysql-python - - - From ed75341a54e18d59bf0d8561e8d3951bd40e5ef9 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 11:00:58 -0300 Subject: [PATCH 07/14] fix indentation --- .travis.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53a678b..6bb0741 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,19 +37,17 @@ before_script: before_install: - - wget http://bit.ly/miniconda -O miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - conda update --yes --all - - conda config --add channels odm2 --force - - conda create --yes -n TEST python=$TRAVIS_PYTHON_VERSION --file requirements.txt --file requirements-dev.txt - - source activate TEST - -install: - - sudo pip install -e git+https://github.com/ODM2/geoalchemy.git@v0.7.4#egg=geoalchemy-0.7.4 - - python -m pip install . - - python -m pip install -r requirements_tests.txt --allow-external pyodbc --allow-unverified pyodbc - - pip list + - wget http://bit.ly/miniconda -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - conda update --yes --all + - conda config --add channels odm2 --force + - conda create --yes -n TEST python=$TRAVIS_PYTHON_VERSION --file requirements.txt --file requirements-dev.txt + - source activate TEST + +# Test source distribution. ++install: + - python setup.py sdist && version=$(python setup.py --version) && pushd dist && pip install odm2api-${version}.tar.gz && popd script: - py.test From 7f9b670755ce9d281e4701d4b28cd2a84f9e73fa Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 11:02:53 -0300 Subject: [PATCH 08/14] actually the the tests --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6bb0741..5b1eb8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,8 +46,14 @@ before_install: - source activate TEST # Test source distribution. -+install: +install: - python setup.py sdist && version=$(python setup.py --version) && pushd dist && pip install odm2api-${version}.tar.gz && popd script: - - py.test + - if [[ $TEST_TARGET == 'default' ]]; then + py.test -vv ; + fi + + - if [[ $TEST_TARGET == 'coding_standards' ]]; then + find . -type f -name "*.py" ! -name 'conf.py' | xargs flake8 --max-line-length=100 ; + fi From ee3ae1c897a6ab944d7e6f79d36ca92974b41e49 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 11:05:07 -0300 Subject: [PATCH 09/14] define a test matrix --- .travis.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b1eb8e..c8f23f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,6 @@ language: python sudo: false -python: - - "2.7" - services: - mysql - postgresql @@ -30,12 +27,26 @@ addons: - libgeos-dev - libspatialite-dev +matrix: + fast_finish: true + include: + - python: 2.7 + env: TEST_TARGET=default + - python: 3.6 + env: TEST_TARGET=default + - python: 2.7 + env: TEST_TARGET=coding_standards + allow_failures: + - python: 2.7 + env: TEST_TARGET=coding_standards + - python: 3.6 + env: TEST_TARGET=default + before_script: - ./ci-helpers/mysql_setup.sh - ./ci-helpers/postgres_setup.sh - ./ci-helpers/travis/freetds.sh - before_install: - wget http://bit.ly/miniconda -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda From 9e0a670d36a81b26a95f582a0cc16a01c94b853a Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 11:17:39 -0300 Subject: [PATCH 10/14] clean setup.py up --- setup.py | 112 ++++++++----------------------------------------------- 1 file changed, 15 insertions(+), 97 deletions(-) diff --git a/setup.py b/setup.py index 0a35df5..303990b 100644 --- a/setup.py +++ b/setup.py @@ -5,133 +5,51 @@ https://github.com/pypa/sampleproject """ -''' -to install in development mode, run the following code from command line -"python setup.py develop" -''' - -# Always prefer setuptools over distutils -from setuptools import setup, find_packages -# To use a consistent encoding +import os from codecs import open -from os import path + +from setuptools import find_packages, setup import versioneer -here = path.abspath(path.dirname(__file__)) +here = os.path.abspath(os.path.dirname(__file__)) + +# Dependencies. +with open('requirements.txt') as f: + requirements = f.readlines() +install_requires = [t.strip() for t in requirements] -from pip.req import parse_requirements -install_reqs = parse_requirements('requirements.txt', session=False) -reqs = [str(ir.req) for ir in install_reqs] +with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() -# Get the long description from the relevant file -with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = f.read() -#long_description = "" setup( name='odm2api', - - # Versions should comply with PEP440. For a discussion on single-sourcing - # the version across setup.py and the project code, see - # https://packaging.python.org/en/latest/single_source_version.html version=versioneer.get_version(), - - description='A Python-based application programmers interface for the Observations Data converter 2 (ODM2) ', + description='Python interface for the Observations Data converter 2 (ODM2)', long_description=long_description, - - # The project's main homepage. url='https://github.com/ODM2/ODM2PythonAPI', - - # Author details author='ODM2 team-Stephanie Reeder', author_email='stephanie.reeder@usu.edu', - - # note: maintainer gets listed as author in PKG-INFO, so leaving - # this commented out for now maintainer='David Valentine', maintainer_email='david.valentine@gmail.com', - - # Choose your license - license='BSD-3-Clause', - - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers + license='BSD', classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable 'Development Status :: 3 - Alpha', - - # Indicate who your project is intended for 'Intended Audience :: Developers', 'Topic :: Software Development :: Build Tools', - - # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 2.7', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Scientific/Engineering' ], - - # What does your project relate to? keywords='Observations Data converter ODM2', - - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - packages=find_packages(exclude=['samplefiles', 'setup', 'tests*', 'Forms']), - - # List run-time dependencies here. These will be installed by pip when - # your project is installed. For an analysis of "install_requires" vs pip's - # requirements files see: - # https://packaging.python.org/en/latest/requirements.html - - install_requires=install_reqs, - # install_requires=[ - # 'pyodbc', - # 'six', - # 'sqlalchemy', - # 'shapely', - # 'pandas', - # ], - - # List additional groups of dependencies here (e.g. development - # dependencies). You can install these using the following syntax, - # for example: - # $ pip install -e .[dev,test] + install_requires=install_requires, extras_require={ 'mysql': ['pymysql'], 'postgis': ['psycopg2'], - 'sqlite': ['pyspatialite >=3.0.0'], # need to look at: http://www.gaia-gis.it/spatialite-2.4.0-4/splite-python.html - 'test': ['coverage'], + 'sqlite': ['pyspatialite >=3.0.0'], }, - - # If there are data files included in your packages that need to be - # installed, specify them here. If using Python 2.6 or less, then these - # have to be included in MANIFEST.in as well. - # - # package_data={ - # 'sample': ['package_data.dat'], - # }, - - # Although 'package_data' is the preferred approach, in some case you may - # need to place data files outside of your packages. See: - # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa - # In this case, 'data_file' will be installed into '/my_data' - - # data_files=[('my_data', ['data/data_file'])], - - # To provide executable scripts, use entry points in preference to the - # "scripts" keyword. Entry points provide cross-platform support and allow - # pip to create the appropriate form of executable for the target platform. - - # entry_points={ - # 'console_scripts': [ - # 'sample=sample:main', - # ], - # }, cmdclass=versioneer.get_cmdclass(), ) From b4889138c602787e5174d2d9f37a4be20b4e84d6 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 11:52:21 -0300 Subject: [PATCH 11/14] run tests using the installed version --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c8f23f1..ee0233d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,8 @@ install: script: - if [[ $TEST_TARGET == 'default' ]]; then - py.test -vv ; + cp -r tests /tmp && cd /tmp ; + py.test -vv tests ; fi - if [[ $TEST_TARGET == 'coding_standards' ]]; then From 3fdc68aa3e8cac36abde0a51da1156cf332c5d7d Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 4 Jul 2017 12:52:39 -0300 Subject: [PATCH 12/14] I am not sure this file is necessary and it uses the old ioos channel --- condaenvironment_1.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 condaenvironment_1.yml diff --git a/condaenvironment_1.yml b/condaenvironment_1.yml deleted file mode 100644 index 69189a2..0000000 --- a/condaenvironment_1.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: odm2api_env1 -channels: - - ioos -dependencies: - - python=2.7 - - pip - - jupyter - - scipy - - pandas - - seaborn - - sqlalchemy - - psycopg2 - - pymysql - - pyodbc From 2834035bb6a77d92037b68638c15139a758ec19e Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Wed, 5 Jul 2017 14:30:23 -0300 Subject: [PATCH 13/14] converter -> model --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 303990b..6313168 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( name='odm2api', version=versioneer.get_version(), - description='Python interface for the Observations Data converter 2 (ODM2)', + description='Python interface for the Observations Data Model 2 (ODM2)', long_description=long_description, url='https://github.com/ODM2/ODM2PythonAPI', author='ODM2 team-Stephanie Reeder', @@ -43,7 +43,7 @@ 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Scientific/Engineering' ], - keywords='Observations Data converter ODM2', + keywords='Observations Data Model ODM2', packages=find_packages(exclude=['samplefiles', 'setup', 'tests*', 'Forms']), install_requires=install_requires, extras_require={ From 52145dfe260b62e4f42a22b63fe444ad52bfbb34 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 6 Jul 2017 10:27:21 -0300 Subject: [PATCH 14/14] remove dups --- requirements-dev.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 442124e..122ec9e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,12 +1,9 @@ -pytest -pytest-cov +flake8 mock -pymysql -pymssql -psycopg2 -pymssql psycopg2 -flake8 +pymysql +pytest +pytest-cov # FIXME: I am not sure these are needed. # pysqlite # sqlite