diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5ac8be6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,51 @@ +sudo: required +language: python +python: + - 2.7 + - 3.5 + +cache: + - pip + - packages + +install: + - make install + - pip install requests typing + +script: + - make test + +# jobs instead of deploy to deploy only once (for Python3 build) +jobs: + fast_finish: true + include: + - stage: upload to PYPI, build docs and create a release + # python-semantic-release fails with Travis Python3.5 + python: 2.7 + install: make install_dev + script: make html + + deploy: + - provider: script + skip_cleanup: true + on: + branch: master + script: make publish + + - provider: releases + skip-cleanup: true + api_key: $GH_TOKEN + on: + tags: true + file: dist/* + + - provider: pages + skip-cleanup: true + github-token: $GH_TOKEN + keep-history: true + on: + branch: master + local-dir: docs/build/html + +after_failure: + - pip freeze \ No newline at end of file diff --git a/Makefile b/Makefile index d62db7a..69a4338 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,12 @@ TESTROOT = stscraper .PHONY: test test: python -m unittest test - python3 -m unittest test .PHONY: publish publish: - $(MAKE) clean - $(MAKE) test - python setup.py sdist bdist_wheel - twine upload dist/* - $(MAKE) clean + test $$(git config user.name) || git config user.name "semantic-release (via TravisCI)" + test $$(git config user.email) || git config user.email "semantic-release@travis" + semantic-release publish .PHONY: clean clean: @@ -26,7 +23,13 @@ clean: html: sphinx-build -M html "docs" "docs/build" +.PHONY: install +install: + pip install -r requirements.txt + .PHONY: install_dev install_dev: - pip install --user --upgrade -r requirements.txt - pip install --user --upgrade sphinx sphinx-autobuild + $(MAKE) install + pip install requests + pip install typing requests sphinx sphinx-autobuild + pip install python-semantic-release==3.11.2 diff --git a/requirements.txt b/requirements.txt index 409f5f7..684bc0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ - requests strudel.utils \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index b223cbf..cc8922d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,4 +2,7 @@ license_file = LICENSE [bdist_wheel] -universal=1 \ No newline at end of file +universal=1 + +[semantic_release] +version_variable = stscraper/__init__.py:__version__ \ No newline at end of file diff --git a/setup.py b/setup.py index 660487a..624d5a2 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,17 @@ #!/usr/bin/env python +import os +import re from setuptools import setup +# get author, version and license from package files +# since it has some not yet installed dependencies, parsing the file: +package = 'stscraper' +head = open(os.path.join(package, '__init__.py')).read(2048) +pattern = r"""__%s__\s*=\s*['"]([^'"]*)['"]""" +kwargs = {keyword: re.search(pattern % keyword, head).group(1) + for keyword in ('version', 'author', 'license')} + requirements = [ line.strip() for line in open('requirements.txt') @@ -10,13 +20,7 @@ # options reference: https://docs.python.org/2/distutils/ # see also: https://packaging.python.org/tutorials/distributing-packages/ setup( - # whenever you're updating the next three lines - # please also update oscar.py name="strudel.scraper", - version="0.2.6", # make sure to update __init__.py.__version__ - author='Marat (@cmu.edu)', - author_email='marat@cmu.edu', - description="Python interfaces to Github, Bitbucket and Gitlab APIs", long_description=open('README.md').read(), long_description_content_type='text/markdown', @@ -27,18 +31,16 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Operating System :: POSIX :: Linux', 'Topic :: Scientific/Engineering' ], platforms=["Linux", "Solaris", "Mac OS-X", "Unix", "Windows"], - python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4', - scripts=['scripts/check_gh_limits.py'], - # entry_points={'console_scripts': [ - # 'console_scripts = stscraper.github:print_limits', - # ]}, - packages=['stscraper'], - license="GPL v3.0", + python_requires='>2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4', + scripts=[os.path.join('scripts', 'check_gh_limits.py')], + packages=[package], url='https://github.com/cmustrudel/strudel.scraper', - install_requires=requirements + install_requires=requirements, + **kwargs )