Skip to content

Commit 0066726

Browse files
committed
improve project structure
Signed-off-by: Antonio Mendoza Pérez <antmendoza@gmail.com>
1 parent 12d2b24 commit 0066726

17 files changed

+34
-27
lines changed

Pipfile.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ With the SDK you can:
1414

1515
- Python 3 required
1616

17+
- pipenv required `pip install pipenv`
18+
1719
```
1820
pipenv install
19-
python setup.py pytest
20-
```
2121
22-
If you get issues about missing modules:
22+
pipenv shell
2323
24-
```
25-
pip3 install jsonschema
26-
pip3 install pyyaml
24+
python setup.py pytest
2725
```
2826

2927
## **WIP** Programmatically build workflow definitions
@@ -69,7 +67,7 @@ functions:
6967
workflow = Workflow.from_source(swf_content)
7068
```
7169

72-
You can see a full example in the [test_workflow.py](./tests/test_workflow.py) file
70+
You can see a full example in the [test_workflow.py](tests/serverlessworkflow/sdk/test_workflow.py) file
7371

7472

7573
### Parse workflow to JSON / YAML
@@ -88,7 +86,7 @@ print(workflow.to_json())
8886
print(workflow.to_yaml())
8987
```
9088

91-
You can see a full example in the [test_workflow.py](./tests/test_workflow.py) file
89+
You can see a full example in the [test_workflow.py](tests/serverlessworkflow/sdk/test_workflow.py) file
9290

9391

9492
## Validate workflow definitions
@@ -108,4 +106,4 @@ WorkflowValidator(Workflow(workflow)).validate()
108106
```
109107
The `validate` method will raise an exception if the provided workflow does not complaint specification.
110108

111-
You can see a full example in the [test_workflow_validator](./tests/test_workflow_validator.py) file
109+
You can see a full example in the [test_workflow_validator](tests/serverlessworkflow/sdk/test_workflow_validator.py) file
File renamed without changes.

serverlessworkflow/sdk/__init__.py

Whitespace-only changes.
File renamed without changes.

serverlessworkflow_sdk/inject_state.py renamed to serverlessworkflow/sdk/inject_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from serverlessworkflow_sdk.state import State
1+
from serverlessworkflow.sdk.state import State
22

33

44
class InjectState(State):

serverlessworkflow_sdk/operation_state.py renamed to serverlessworkflow/sdk/operation_state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from serverlessworkflow_sdk.action import Action
2-
from serverlessworkflow_sdk.state import State
1+
from serverlessworkflow.sdk.action import Action
2+
from serverlessworkflow.sdk.state import State
33

44

55
class OperationState(State):
File renamed without changes.

serverlessworkflow_sdk/workflow.py renamed to serverlessworkflow/sdk/workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import yaml
44

5-
from serverlessworkflow_sdk.inject_state import InjectState
6-
from serverlessworkflow_sdk.operation_state import OperationState
7-
from serverlessworkflow_sdk.state import State
5+
from serverlessworkflow.sdk.inject_state import InjectState
6+
from serverlessworkflow.sdk.operation_state import OperationState
7+
from serverlessworkflow.sdk.state import State
88

99

1010
def is_inject_state(state: State):

serverlessworkflow_sdk/workflow_validator.py renamed to serverlessworkflow/sdk/workflow_validator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import json
22
import requests
33
from jsonschema.validators import validate
4-
from serverlessworkflow_sdk.workflow import Workflow
4+
5+
from serverlessworkflow.sdk.workflow import Workflow
56

67

78
class WorkflowValidator:

setup.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
from setuptools import find_packages, setup
2+
3+
with open("README.md", "r") as readme_file:
4+
readme = readme_file.read()
5+
26
setup(
3-
name='serverlessworkflow_sdk',
4-
packages=find_packages(include=['serverlessworkflow_sdk']),
7+
name='serverlessworkflow.sdk',
8+
packages=find_packages(include=['serverlessworkflow', 'serverlessworkflow.sdk']),
59
version='0.1.0',
610
description='Serverless Workflow Specification - Python SDK',
11+
long_description=readme,
12+
long_description_content_type="text/markdown",
13+
url="https://serverlessworkflow.io/",
714
author='Serverless Workflow Contributors',
815
license='http://www.apache.org/licenses/LICENSE-2.0.txt',
9-
install_requires=[],
16+
install_requires=['pyyaml==6.0', "jsonschema==4.4.0", "requests"],
1017
setup_requires=['pytest-runner'],
1118
tests_require=['pytest'],
1219
test_suite='tests',
13-
)
20+
21+
)

tests/serverlessworkflow/__init__.py

Whitespace-only changes.

tests/serverlessworkflow/sdk/__init__.py

Whitespace-only changes.

tests/test_workflow.py renamed to tests/serverlessworkflow/sdk/test_workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os
22
import unittest
33

4-
from serverlessworkflow_sdk.action import Action
5-
from serverlessworkflow_sdk.workflow import Workflow
4+
from serverlessworkflow.sdk.action import Action
5+
from serverlessworkflow.sdk.workflow import Workflow
66

77

88
class TestWorkflow(unittest.TestCase):

tests/test_workflow_validator.py renamed to tests/serverlessworkflow/sdk/test_workflow_validator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
from jsonschema.exceptions import ValidationError
77

8-
from serverlessworkflow_sdk.workflow import Workflow
9-
from serverlessworkflow_sdk.workflow_validator import WorkflowValidator
8+
from serverlessworkflow.sdk.workflow import Workflow
9+
from serverlessworkflow.sdk.workflow_validator import WorkflowValidator
1010

1111

1212
class TestWorkflowValidator(unittest.TestCase):
1313

1414
def test_validate_examples(self):
15-
examples_dir = os.path.join(os.path.dirname(__file__), 'examples')
15+
examples_dir = os.path.join(os.path.dirname(__file__), '../../examples')
1616
examples = listdir(examples_dir)
1717
self.assertEqual(len(examples), 9)
1818

@@ -22,7 +22,7 @@ def test_validate_examples(self):
2222
WorkflowValidator(Workflow(**swf_file_content)).validate()
2323

2424
def test_invalid_wf(self):
25-
wf_file = os.path.join(os.path.dirname(__file__), 'examples', 'applicantrequest.json')
25+
wf_file = os.path.join(os.path.dirname(__file__), '../../examples', 'applicantrequest.json')
2626

2727
with open(wf_file, "r") as swf_file:
2828
swf_content = swf_file.read()

0 commit comments

Comments
 (0)