Skip to content

Commit

Permalink
Merge 1f07623 into 1d9cf21
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Apr 9, 2019
2 parents 1d9cf21 + 1f07623 commit e6af663
Show file tree
Hide file tree
Showing 27 changed files with 371 additions and 155 deletions.
57 changes: 42 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@ os:
- osx
env:
matrix:
- TRAVIS_PYTHON_VERSION="2.7"
- TRAVIS_PYTHON_VERSION="3.5"
- TRAVIS_PYTHON_VERSION="3.6"
global:
- CONDA_PREFIX=$HOME/miniconda
- MINICONDA_URL_BASE="https://repo.continuum.io/miniconda/Miniconda3-latest"
- CONDA_ENV=py36
- CONDA_ENV=py37
- CONDA_ENV=lint
matrix:
exclude:
- os: osx
env: CONDA_ENV=lint
sudo: false
jobs:
include:
- stage: deploy
if: tag =~ v.*$
script: skip
os: linux
deploy:
on:
all_branches: true
provider: pypi
user: mcflugen
password:
secure: dbebH+nSyyeqIBov9XDxl3IGGjQk5TSimW8tQKf5aC0W7xY6cexsya34ar/F0AmDWmpy7MlQHQSZkcVPVqHpObcLNW9m6cHXfaLyASG5TgcVOkqTgTtufrdqQb/q084e2Af3CLVn/iSicmntgsAiKt/QIhKpD9HE4qlbcExMNPo=
before_install:
- |
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
Expand All @@ -21,17 +35,30 @@ before_install:
install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
OS="MacOSX-x86_64"
curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > $HOME/miniconda.sh
else
OS="Linux-x86_64"
curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh > $HOME/miniconda.sh
fi
- curl $MINICONDA_URL_BASE-$OS.sh > $HOME/minconda.sh
- bash $HOME/minconda.sh -b -p $CONDA_PREFIX
- export PATH="$CONDA_PREFIX/bin:$PATH"
- bash $HOME/miniconda.sh -b -p $HOME/anaconda
- export PATH="$HOME/anaconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda create -n _testing python=$TRAVIS_PYTHON_VERSION
- source activate _testing
- conda install -q conda-build anaconda-client coverage sphinx pytest
- |
if [[ "$CONDA_ENV" == "docs" ]]; then
conda env create -n test_env --file docs/environment.yml
else
conda env create -n test_env --file ci/requirements-$CONDA_ENV-$TRAVIS_OS_NAME.yml
fi
- source activate test_env
- pip install . -r requirements.txt
script:
- conda build ./conda-recipe -c csdms-stack -c conda-forge
- |
if [[ "$CONDA_ENV" == "lint" ]]; then
make lint
elif [[ "$CONDA_ENV" == "docs" ]]; then
sphinx-apidoc --force -o docs/api model_metadata *tests
make -C docs clean html
else
pytest --cov=model_metadata --cov-report=xml:$(pwd)/coverage.xml -vvv
fi
after_success: coveralls
93 changes: 93 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys

try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache

lint: ## check style with flake8
flake8 standard_names tests

pretty: ## reformat files to make them look pretty
find standard_names -name '*.py' | xargs isort
black setup.py standard_names

test: ## run tests quickly with the default Python
py.test

test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
pytest --cov=standard_names --cov-report= --cov-report=html --cov-config=setup.cfg
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/api/standard_names.rst
rm -f docs/api/modules.rst
sphinx-apidoc --force -o docs/api standard_names *tests
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html

changelog:
changelog --force --batch

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
63 changes: 23 additions & 40 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,37 @@
environment:

global:
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\.ci\\appveyor\\run_with_env.cmd"
ANACONDA_TOKEN:
secure: zCRzslOrbeC7LtC9Z7qHe4PnG3oUhSo5CHI7V9KShfMO/ZGZrWLbk1U7y7HM+09Y
BUILD_STR: "dev"

matrix:
- PYTHON: "C:\\Python27"
DISTUTILS_USE_SDK: "1"
PYTHON_VERSION: "2.7"
- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5"
- TARGET_ARCH: x64
CONDA_INSTALL_LOCN: C:\\Miniconda37-x64
CONDA_ENV: py37-windows

- TARGET_ARCH: x64
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64
CONDA_ENV: py36-windows

platform:
- x64
- x86

os: Previous Visual Studio 2015

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %HOME% %PLATFORM%"
- "ECHO %CONDA_INSTALL_LOCN% %CONDA_PY% %HOME% %PLATFORM%"
- "ECHO %APPVEYOR_REPO_BRANCH%"

install:
- powershell .ci/appveyor/install.ps1
- if "%APPVEYOR_REPO_TAG%"=="true" if "%APPVEYOR_REPO_TAG_NAME:~0,1%"=="v" set BUILD_STR=""
- IF "%PLATFORM%"=="x64" (SET SUFFIX="_64") ELSE (SET SUFFIX="_32")
- "set PATH=%PYTHON%%SUFFIX%;%PYTHON%%SUFFIX%/Scripts;%PYTHON%%SUFFIX%/Library/bin;%PATH%"
- conda info
- conda config --set always_yes yes
- conda install -q --force --no-deps conda psutil ruamel_yaml requests
- conda install -q python=%PYTHON_VERSION%
- conda install -q conda-build
- conda install -q anaconda-client
- conda install -q pytest
- pip install twine
- "%WITH_COMPILER% conda build -q conda-recipe"
- "%WITH_COMPILER% conda install -q standard_names --use-local"
- "conda list"
build: false
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
- cmd: conda update --yes --quiet conda
- cmd: set PYTHONUNBUFFERED=1
- cmd: conda config --set always_yes yes
- cmd: conda update conda
- cmd: conda config --append channels conda-forge
- cmd: conda env create -n test_env --file ci/requirements-$CONDA_ENV.yml
- cmd: conda activate test_env
- cmd: python --version
- cmd: pip install . -r requirements.txt

test_script:
- "%WITH_COMPILER% pytest"

after_test:
- "%WITH_COMPILER% python setup.py bdist_wheel"

artifacts:
# Archive the generated conda package in the ci.appveyor.com build report.
- path: 'dist\*'
build: false

deploy_script:
- "python .ci/appveyor/anaconda_upload.py"
# - "python .ci/appveyor/pypi_upload.py"
test_script:
- pytest
6 changes: 6 additions & 0 deletions ci/requirements-lint-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.7
- flake8
5 changes: 5 additions & 0 deletions ci/requirements-py36-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.6
5 changes: 5 additions & 0 deletions ci/requirements-py36-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.6
5 changes: 5 additions & 0 deletions ci/requirements-py36-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.6
5 changes: 5 additions & 0 deletions ci/requirements-py37-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.7
5 changes: 5 additions & 0 deletions ci/requirements-py37-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.7
5 changes: 5 additions & 0 deletions ci/requirements-py37-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: test_env
channels:
- conda-forge
dependencies:
- python=3.7
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpydoc
nose
pyyaml
coveralls
pytest>=3.6
pytest-cov
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
[pylint]
disable = missing-docstring,line-too-long,bad-continuation

[flake8]
exclude = docs
ignore =
E203
E501
W503
max-line-length = 88

[versioneer]
VCS = git
style = pep440
Expand Down
20 changes: 19 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,25 @@
author="Eric Hutton",
author_email="eric.hutton@colorado.edu",
url="https://csdms.colorado.edu",
install_requires=["pyyaml"],
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
],
install_requires=[
"pyyaml",
"six",
"packaging",
"jinja2",
"py-scripting",
"binaryornot",
],
packages=[
"standard_names",
"standard_names.cmd",
Expand Down
15 changes: 11 additions & 4 deletions standard_names/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
"""The CSDMS Standard Names"""

from .standardname import StandardName, is_valid_name
from .registry import NamesRegistry
from ._version import get_versions
from .error import BadNameError, BadRegistryError
from .registry import NamesRegistry
from .standardname import StandardName, is_valid_name

__all__ = [
"StandardName",
"is_valid_name",
"NamesRegistry",
"BadNameError",
"BadRegistryError",
]

from ._version import get_versions
__version__ = get_versions()['version']
__version__ = get_versions()["version"]
del get_versions

0 comments on commit e6af663

Please sign in to comment.