diff --git a/.travis.yml b/.travis.yml index f767789..ee0233d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,67 +1,71 @@ -git blanguage: python -sudo: required -# if the https://travis-ci.org/ODM2/ODM2PythonAPI/requests ever says: missing config -# validate at: http://lint.travis-ci.org/ -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 +language: python + +sudo: false + services: - mysql - postgresql + 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 -# mariadb: '10.1' + +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: -# 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 - - 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 + - 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 -# don't forget to open up the azure mssql server to these addreses -# https://docs.travis-ci.com/user/ip-addresses/ +# Test source distribution. +install: + - python setup.py sdist && version=$(python setup.py --version) && pushd dist && pip install odm2api-${version}.tar.gz && popd -# command to run tests script: + - if [[ $TEST_TARGET == 'default' ]]; then + cp -r tests /tmp && cd /tmp ; + py.test -vv tests ; + fi - - py.test - + - if [[ $TEST_TARGET == 'coding_standards' ]]; then + find . -type f -name "*.py" ! -name 'conf.py' | xargs flake8 --max-line-length=100 ; + fi 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 diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..122ec9e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,11 @@ +flake8 +mock +psycopg2 +pymysql +pytest +pytest-cov +# 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 - - - diff --git a/setup.py b/setup.py index 0a35df5..6313168 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 Model 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(). - + keywords='Observations Data Model ODM2', 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(), )