Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .travis.yml
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License boilerplate

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
9 changes: 8 additions & 1 deletion Makefile
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
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Expand All @@ -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

Expand Down
23 changes: 18 additions & 5 deletions setup.py
100644 → 100755
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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 setuptools installed, e.g. using python setup.py install. That means that they can't get any of the extras (that's a setuptools feature) but they can at least install the package.

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',
Expand All @@ -31,7 +44,7 @@
'autopep8',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra_requires is really neat.

'pytest',
'pytest-randomly',
'mypy',
'mypy; python_version > "3.3"',
]
}
)
5 changes: 5 additions & 0 deletions shopify_python/__init__.py
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'
7 changes: 7 additions & 0 deletions tests/shopify_python/test_package.py
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__