-
Notifications
You must be signed in to change notification settings - Fork 11
Add Travis CI support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) 2017 "Shopify inc." All rights reserved. | ||
| # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. | ||
| language: python | ||
| python: | ||
| - "2.7" | ||
| - "3.3" | ||
| - "3.4" | ||
| - "3.5" | ||
| - "3.6" | ||
| before_install: | ||
| - pip install -U pip setuptools | ||
| install: | ||
| - make setup_dev | ||
| script: | ||
| - make test | ||
| notifications: | ||
| email: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| # Copyright (c) 2017 "Shopify inc." All rights reserved. | ||
| # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. | ||
| python_files := find . -path '*/.*' -prune -o -name '*.py' -print0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License boilerplate |
||
| python_version_full := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1))) | ||
| python_version_major := $(word 1,${python_version_full}) | ||
|
|
||
| all: test | ||
|
|
||
|
|
@@ -13,7 +17,10 @@ autopep8: | |
| lint: | ||
| @echo 'Linting...' | ||
| @pylint --rcfile=pylintrc shopify_python tests.shopify_python | ||
| @mypy shopify_python tests/shopify_python --ignore-missing-imports | ||
| @if [ "$(python_version_major)" == "3" ]; then \ | ||
| echo 'Checking type annotations...'; \ | ||
| mypy --py2 shopify_python tests/shopify_python --ignore-missing-imports; \ | ||
| fi | ||
|
|
||
| autolint: autopep8 lint | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,24 @@ | ||
| #!/usr/bin/env python | ||
| # Copyright (c) 2017 "Shopify inc." All rights reserved. | ||
| # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. | ||
| import re | ||
|
|
||
| try: | ||
| from setuptools import setup | ||
| import setuptools as setuplib | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for this to be conditional? Not the least because you are apparently depending on it now.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This try/catch allows someone to install this locally if they don't have |
||
| except: | ||
| from distutils.core import setup | ||
| import distutils.core as setuplib | ||
|
|
||
|
|
||
| with open('shopify_python/__init__.py', 'r') as fd: | ||
| version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', | ||
| fd.read(), re.MULTILINE).group(1) | ||
|
|
||
| if not version: | ||
| raise RuntimeError('Cannot find version information') | ||
|
|
||
| setup( | ||
| setuplib.setup( | ||
| name='shopify_python', | ||
| version='0.1', | ||
| version=version, | ||
| description='Python Standards Library for Shopify', | ||
| url='http://github.com/shopify/shopify_python', | ||
| author='Shopify Data Acceleration', | ||
|
|
@@ -31,7 +44,7 @@ | |
| 'autopep8', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 'pytest', | ||
| 'pytest-randomly', | ||
| 'mypy', | ||
| 'mypy; python_version > "3.3"', | ||
| ] | ||
| } | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Copyright (c) 2017 "Shopify inc." All rights reserved. | ||
| # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. | ||
| from __future__ import unicode_literals | ||
|
|
||
| __version__ = '0.0.0' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Copyright (c) 2017 "Shopify inc." All rights reserved. | ||
| # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. | ||
| import shopify_python | ||
|
|
||
|
|
||
| def test_version(): | ||
| assert shopify_python.__version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License boilerplate