diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..e9955e7 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +ignore = W191,W503 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..8ae4468 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,5 @@ +python: + version: 3 + extra_requirements: + - docs + pip_install: true diff --git a/.travis.yml b/.travis.yml index 08a1b39..cf85e44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,35 @@ +dist: trusty sudo: false language: python + python: - 2.7 -- 3.4 -- 3.5 +- &latest_py3 3.6 - pypy -matrix: - allow_failures: - - python: pypy -script: -- pip install -U pytest -- python setup.py test -branches: - except: - - skeleton -deploy: - provider: pypi - server: https://upload.pypi.org/legacy/ - on: - tags: true - all_branches: true - python: 3.5 - user: jaraco - distributions: dists - password: - secure: 2JIGwS5V4TRi8+T1PzH9hardS+woul2s0y0a7l0KyLxta8ThUihZjLqqDvniX3aOPKoYRx+wrg73Qs+t1ISkjGENsmuIqkdtG++EvfN6Goopv7qePZlm41plsGZBS/EDT6woLNy1Mk6uRAmp7UrVqgXPkyPTJPOh+C8SdZ/AvbqlXOpTNfOJaUGJb3GbCQy1nX8SbFAteVRVe1sWGuNS0MRyDb6DOOwhRmGUHwVMNyvLoNZ3QGsTViju7CJUmie+XjKgKiPDbF+OCBHR+VAbY6vZiWC2I0rV6CmKoXfgaaF0BGZLq4iOw7LUNTIVInRSuyQd+bkoUNP2/aU84mFD9bAHcp5uGJ7xy4ahh8ieTkvKk0kudrmu+mtUPZ/fW6Zu51sDjrfdsNLlUZ7tHc1CsIJnjYYU/SasuQ1BT6s4NpsQ7/gNFAdO6JOfSLmTM3arOJIAeDPYEBW8yCEVaxK4EnYl0vE6kuFRq2ey8eyqkwr8Kahn13qUwaOiSmecIWgI/pZ1ettfoVdEh/aL4qONOFD6trfpeqjKFUugLyNmh+PvAfNTjxL+pe309Y8Uw2yaouDLZNI1jUDlNrV9025LJMwNGXs3ViVTTdmTfJza0+SVOfJ77ttLvQxdDvQd9jfYFmDpeeKtReJrFiTt00xSksJd4kbi6iarzRblUplemmA= + +jobs: + fast_finish: true + include: + - stage: deploy + if: tag IS present + python: *latest_py3 + install: skip + script: skip + deploy: + provider: pypi + on: + tags: true + all_branches: true + user: jaraco + password: + secure: 2JIGwS5V4TRi8+T1PzH9hardS+woul2s0y0a7l0KyLxta8ThUihZjLqqDvniX3aOPKoYRx+wrg73Qs+t1ISkjGENsmuIqkdtG++EvfN6Goopv7qePZlm41plsGZBS/EDT6woLNy1Mk6uRAmp7UrVqgXPkyPTJPOh+C8SdZ/AvbqlXOpTNfOJaUGJb3GbCQy1nX8SbFAteVRVe1sWGuNS0MRyDb6DOOwhRmGUHwVMNyvLoNZ3QGsTViju7CJUmie+XjKgKiPDbF+OCBHR+VAbY6vZiWC2I0rV6CmKoXfgaaF0BGZLq4iOw7LUNTIVInRSuyQd+bkoUNP2/aU84mFD9bAHcp5uGJ7xy4ahh8ieTkvKk0kudrmu+mtUPZ/fW6Zu51sDjrfdsNLlUZ7tHc1CsIJnjYYU/SasuQ1BT6s4NpsQ7/gNFAdO6JOfSLmTM3arOJIAeDPYEBW8yCEVaxK4EnYl0vE6kuFRq2ey8eyqkwr8Kahn13qUwaOiSmecIWgI/pZ1ettfoVdEh/aL4qONOFD6trfpeqjKFUugLyNmh+PvAfNTjxL+pe309Y8Uw2yaouDLZNI1jUDlNrV9025LJMwNGXs3ViVTTdmTfJza0+SVOfJ77ttLvQxdDvQd9jfYFmDpeeKtReJrFiTt00xSksJd4kbi6iarzRblUplemmA= + distributions: dists + skip_cleanup: true + skip_upload_docs: true + +cache: pip + +install: +- pip install tox tox-venv + +script: tox diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5e795a6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright Jason R. Coombs + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.rst b/README.rst index 6ae93c6..6660af5 100644 --- a/README.rst +++ b/README.rst @@ -3,14 +3,14 @@ .. image:: https://img.shields.io/pypi/pyversions/wolframalpha.svg -.. image:: https://img.shields.io/pypi/dm/wolframalpha.svg - .. image:: https://img.shields.io/travis/jaraco/wolframalpha/master.svg - :target: http://travis-ci.org/jaraco/wolframalpha + :target: https://travis-ci.org/jaraco/wolframalpha + +.. image:: https://readthedocs.org/projects/wolframalpha/badge/?version=latest + :target: https://wolframalpha.readthedocs.io/en/latest/?badge=latest Python Client built against the `Wolfram|Alpha `_ -v2.0 API. This project is hosted on `Github -`_. +v2.0 API. Usage ===== diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..2b7808f --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +environment: + + APPVEYOR: true + + matrix: + - PYTHON: "C:\\Python36-x64" + - PYTHON: "C:\\Python27-x64" + +install: + # symlink python from a directory with a space + - "mklink /d \"C:\\Program Files\\Python\" %PYTHON%" + - "SET PYTHON=\"C:\\Program Files\\Python\"" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + +build: off + +cache: + - '%LOCALAPPDATA%\pip\Cache' + +test_script: + - "python -m pip install tox tox-venv" + - "tox" + +version: '{build}' diff --git a/docs/conf.py b/docs/conf.py index 39f3b33..14744ee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,38 +1,31 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import setuptools_scm - extensions = [ - 'sphinx.ext.autodoc', - 'rst.linker', + 'sphinx.ext.autodoc', + 'jaraco.packaging.sphinx', + 'rst.linker', ] -# General information about the project. -project = 'wolframalpha' -copyright = '2016 Jason R. Coombs' - -# The short X.Y version. -version = setuptools_scm.get_version(root='..', relative_to=__file__) -# The full version, including alpha/beta/rc tags. -release = version - master_doc = 'index' link_files = { - 'CHANGES.rst': dict( + '../CHANGES.rst': dict( using=dict( GH='https://github.com', - project=project, ), replace=[ dict( - pattern=r"(Issue )?#(?P\d+)", - url='{GH}/jaraco/{project}/issues/{issue}', + pattern=r'(Issue )?#(?P\d+)', + url='{package_url}/issues/{issue}', + ), + dict( + pattern=r'^(?m)((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n', + with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', ), dict( - pattern=r"^(?m)((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n", - with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n", + pattern=r'PEP[- ](?P\d+)', + url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', ), ], ), diff --git a/pytest.ini b/pytest.ini index 9752c36..0ba22c3 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,4 @@ [pytest] -norecursedirs=*.egg .eggs dist build -addopts=--doctest-modules +norecursedirs=dist build .tox .eggs +addopts=--doctest-modules --flake8 doctest_optionflags=ALLOW_UNICODE ELLIPSIS diff --git a/setup.cfg b/setup.cfg index dcd8d12..378a8e4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,9 @@ [aliases] -release = dists build_sphinx upload upload_docs +release = dists upload dists = clean --all sdist bdist_wheel -test = pytest -[wheel] +[bdist_wheel] universal = 1 -[upload] -repository = https://upload.pypi.org/legacy/ +[metadata] +license_file = LICENSE diff --git a/setup.py b/setup.py index 51d69f4..ef7cc65 100644 --- a/setup.py +++ b/setup.py @@ -3,24 +3,21 @@ # Project skeleton maintained at https://github.com/jaraco/skeleton import io -import sys import setuptools with io.open('README.rst', encoding='utf-8') as readme: long_description = readme.read() -needs_pytest = {'pytest', 'test'}.intersection(sys.argv) -pytest_runner = ['pytest_runner'] if needs_pytest else [] -needs_sphinx = {'release', 'build_sphinx', 'upload_docs'}.intersection(sys.argv) -sphinx = ['sphinx', 'rst.linker'] if needs_sphinx else [] -needs_wheel = {'release', 'bdist_wheel'}.intersection(sys.argv) -wheel = ['wheel'] if needs_wheel else [] - name = 'wolframalpha' description = 'Wolfram|Alpha 2.0 API client' +nspkg_technique = 'native' +""" +Does this package use "native" namespace packages or +pkg_resources "managed" namespace packages? +""" -setup_params = dict( +params = dict( name=name, use_scm_version=True, author="Jason R. Coombs", @@ -30,20 +27,38 @@ setup_params = dict( url="https://github.com/jaraco/" + name, packages=setuptools.find_packages(), include_package_data=True, - namespace_packages=name.split('.')[:-1], + namespace_packages=( + name.split('.')[:-1] if nspkg_technique == 'managed' + else [] + ), + python_requires='>=2.7', install_requires=[ 'six', 'xmltodict', 'jaraco.itertools>=2.0', ], extras_require={ + 'testing': [ + # upstream + 'pytest>=2.8', + 'pytest-sugar>=0.9.1', + 'collective.checkdocs', + 'pytest-flake8', + + # local + 'pmxbot', + ], + 'docs': [ + # upstream + 'sphinx', + 'jaraco.packaging>=3.2', + 'rst.linker>=1.9', + + # local + ], }, setup_requires=[ - 'setuptools_scm>=1.9', - ] + pytest_runner + sphinx + wheel, - tests_require=[ - 'pytest>=2.8', - 'pmxbot', + 'setuptools_scm>=1.15.0', ], classifiers=[ "Development Status :: 5 - Production/Stable", @@ -54,9 +69,9 @@ setup_params = dict( ], entry_points={ 'pmxbot_handlers': [ - 'Wolfram|Alpha = wolframalpha.pmxbot', - ], + 'Wolfram|Alpha = wolframalpha.pmxbot', + ], }, ) if __name__ == '__main__': - setuptools.setup(**setup_params) + setuptools.setup(**params) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..c0cd38b --- /dev/null +++ b/tox.ini @@ -0,0 +1,22 @@ +[tox] +envlist = python +minversion = 2.4 + +[testenv] +deps = + setuptools>=31.0.1 + # workaround for yaml/pyyaml#126 + git+https://github.com/yaml/pyyaml@master#egg=pyyaml +commands = + py.test {posargs} + python setup.py checkdocs +usedevelop = True +extras = testing + +[testenv:build-docs] +extras = + docs + testing +changedir = docs +commands = + python -m sphinx . {toxinidir}/build/html