Skip to content

Commit 61c7942

Browse files
authored
Merge pull request #25 from PredixDev/develop_rc1
Final adjustments for rc1
2 parents ede2c39 + 4cf4661 commit 61c7942

File tree

7 files changed

+54
-11
lines changed

7 files changed

+54
-11
lines changed

docs/cookbook/eventhub.inc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
.. _eventhub-cookbook:
3+
4+
Event Hub Recipes
5+
-----------------
6+
7+
Recipes for working with Predix Python SDK and the Event Hub Service.
8+
9+
It is expected that you first properly created and configured UAA and a client
10+
to work with event hub.
11+
12+
More to come.

docs/devguide/index.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In your environment you can run:
1919

2020
::
2121

22-
pip install -e
22+
pip install -e .
2323

2424
This will install the library to site packages with a symlink back to the
2525
GitHub repository. This will allow any changes you make to have an immediate
@@ -67,3 +67,15 @@ To build a distributable package with setuptools::
6767

6868
The version comes from incrementing the value in *setup.py*.
6969

70+
How-To Build Documentation
71+
--------------------------
72+
73+
See setup.py for library depenencies on sphinx.
74+
75+
Start in the docs directory::
76+
77+
make html
78+
cd _build/html
79+
python2 -m SimpleHTTPServer
80+
python3 -m http.server
81+

predix/app.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import copy
55
import logging
66
from cryptography.fernet import Fernet
7+
from builtins import bytes
78

89
import predix.config
910

@@ -119,8 +120,8 @@ def _get_encrypted_manifest(self):
119120

120121
manifest = copy.deepcopy(self.manifest)
121122
for var in self.manifest['env'].keys():
122-
value = self.manifest['env'][var]
123-
manifest['env'][var] = f.encrypt(bytes(str(value), 'utf-8')).decode('utf-8')
123+
value = str(self.manifest['env'][var])
124+
manifest['env'][var] = f.encrypt(bytes(value, 'utf-8')).decode('utf-8')
124125

125126
return manifest
126127

@@ -251,4 +252,4 @@ def get_eventhub(self, publish_config=None, subscribe_config=None):
251252
import predix.data.eventhub.client
252253
eventhub = predix.data.eventhub.client.Eventhub(subscribe_config=subscribe_config,
253254
publish_config=publish_config)
254-
return eventhub
255+
return eventhub

setup.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
from setuptools import setup, find_packages
33

44
install_requires = [
5+
"python-dateutil==2.6.0",
56
"boto3",
6-
"python-dateutil",
77
"PyYAML",
88
"requests",
99
"cryptography",
1010
"redis",
1111
"sqlalchemy",
12+
"six",
13+
"future",
1214
"psycopg2",
1315
"websocket",
1416
"websocket-client"
@@ -17,13 +19,25 @@
1719
setup_requires = [
1820
]
1921

22+
docs_require = [
23+
"sphinx",
24+
"sphinx-autobuild",
25+
"sphinxcontrib-httpdomain",
26+
"sphinx_rtd_theme",
27+
"recommonmark",
28+
]
29+
30+
tests_require = [
31+
# "mock", # only for Python < 3.3
32+
]
33+
2034
long_description = 'See GitHub README.rst for more details.'
2135
with open('README.rst') as file:
2236
long_description = file.read()
2337

2438
setup(
2539
name="predix",
26-
version="0.x.x",
40+
version="1.0.0rc1",
2741
author="Jayson DeLancey",
2842
author_email="[email protected]",
2943
description="Python Client SDK for Predix Services",
@@ -35,11 +49,11 @@
3549
},
3650
packages=find_packages(exclude=['test', 'test.*']),
3751
test_suite="test",
52+
tests_require=tests_require,
3853
entry_points={
3954
'console_scripts': [
4055
]
4156
},
42-
tests_require=[],
4357
keywords=['predix', 'ge', 'asset', 'analytics'],
4458
url="https://github.com/PredixDev/predixpy",
4559
classifiers=[

test/unit/data/manifest_empty_version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
applications:
33
- name: my-predix-app
44
env:
5-
PREDIXPY_VERSION: 0.0.9
5+
PREDIXPY_VERSION: 1.0.0
66
services: []

test/unit/test_manifest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def _get_test_data_file(self, filename):
2424

2525
def test_version_written(self):
2626
# Verify environment variable set for version tracking
27-
self.assertEqual(os.getenv('PREDIXPY_VERSION'), predix.version)
27+
self.assertTrue(os.getenv('PREDIXPY_VERSION') in self.manifest_content)
2828

2929
# Verify creating a new manifest will write version
3030
self.assertTrue('PREDIXPY_VERSION' in self.manifest_content)
@@ -43,7 +43,7 @@ def test_version_read(self):
4343
admin = predix.admin.app.Manifest(manifest_path)
4444

4545
self.assertEqual(admin.app_name, 'my-predix-app')
46-
self.assertEqual(admin.get_manifest_version(), '0.0.9')
46+
self.assertEqual(admin.get_manifest_version(), '1.0.0')
4747

4848
def test_encrypted_manifest(self):
4949
# Check that we are encrypting output

test/unit/test_uaa.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import logging
55
import unittest
66

7-
from mock import Mock, patch
7+
import six
8+
if six.PY3:
9+
from unittest.mock import Mock, patch
10+
else:
11+
from mock import Mock, patch
812

913
import predix.security.uaa
1014

0 commit comments

Comments
 (0)