Skip to content

Commit 971b623

Browse files
committed
feat: add initial operations
Initial durable operations: - step - wait - run_in_child_context - create_callback - wait_for_callback - wait_for_condition - parallel - map
1 parent 64cdc7a commit 971b623

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+15896
-9
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.11", "3.13"]
20+
21+
steps:
22+
- uses: actions/checkout@v5
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install Hatch
28+
run: |
29+
python -m pip install --upgrade hatch
30+
- name: static analysis
31+
run: hatch fmt --check
32+
- name: Run tests + coverage
33+
run: hatch test:cov
34+
- name: Build distribution
35+
run: hatch build

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*~
2+
*#
3+
*.swp
4+
*.iml
5+
*.DS_Store
6+
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
*.egg-info/
11+
12+
/.coverage
13+
/.coverage.*
14+
/.cache
15+
/.pytest_cache
16+
/.mypy_cache
17+
18+
/doc/_apidoc/
19+
/build
20+
21+
.venv
22+
.venv/
23+
24+
.attach_*
25+
26+
dist/

CONTRIBUTING.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,119 @@ documentation, we greatly value feedback and contributions from our community.
66
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
77
information to effectively respond to your bug report or contribution.
88

9+
## Dependencies
10+
Install [hatch](https://hatch.pypa.io/dev/install/).
11+
12+
## Developer workflow
13+
These are all the checks you would typically do as you prepare a PR:
14+
```
15+
# just test
16+
hatch test
17+
18+
# coverage
19+
hatch run test:cov
20+
21+
# type checks
22+
hatch run types:check
23+
24+
# static analysis
25+
hatch fmt
26+
```
27+
28+
## Set up your IDE
29+
Point your IDE at the hatch virtual environment to have it recognize dependencies
30+
and imports.
31+
32+
You can find the path to the hatch Python interpreter like this:
33+
```
34+
echo "$(hatch env find)/bin/python"
35+
```
36+
37+
### VS Code
38+
If you're using VS Code, "Python: Select Interpreter" and use the hatch venv Python interpreter
39+
as found with the `hatch env find` command.
40+
41+
Hatch uses Ruff for static analysis.
42+
43+
You might want to install the [Ruff extension for VS Code](https://github.com/astral-sh/ruff-vscode)
44+
to have your IDE interactively warn of the same linting and formatting rules.
45+
46+
These `settings.json` settings are useful:
47+
```
48+
{
49+
"[python]": {
50+
"editor.formatOnSave": true,
51+
"editor.codeActionsOnSave": {
52+
"source.fixAll": "explicit",
53+
"source.organizeImports": "explicit"
54+
},
55+
"editor.defaultFormatter": "charliermarsh.ruff"
56+
}
57+
}
58+
"ruff.nativeServer": "on",
59+
```
60+
61+
## Testing
62+
### How to run tests
63+
To run all tests:
64+
```
65+
hatch test
66+
```
67+
68+
To run a single test file:
69+
```
70+
hatch test tests/path_to_test_module.py
71+
```
72+
73+
To run a specific test in a module:
74+
```
75+
hatch test tests/path_to_test_module.py::test_mytestmethod
76+
```
77+
78+
To run a single test, or a subset of tests:
79+
```
80+
$ hatch test -k TEST_PATTERN
81+
```
82+
83+
This will run tests which contain names that match the given string expression (case-insensitive),
84+
which can include Python operators that use filenames, class names and function names as variables.
85+
86+
### Debug
87+
To debug failing tests:
88+
89+
```
90+
$ hatch test --pdb
91+
```
92+
93+
This will drop you into the Python debugger on the failed test.
94+
95+
### Writing tests
96+
Place test files in the `tests/` directory, using file names that end with `_test`.
97+
98+
Mimic the package structure in the src/aws_durable_functions_sdk_python directory.
99+
Name your module so that src/mypackage/mymodule.py has a dedicated unit test file
100+
tests/mypackage/mymodule_test.py
101+
102+
## Coverage
103+
```
104+
hatch run test:cov
105+
```
106+
107+
## Linting and type checks
108+
Type checking:
109+
```
110+
hatch run types:check
111+
```
112+
113+
Static analysis (with auto-fix of known issues):
114+
```
115+
hatch fmt
116+
```
117+
118+
To do static analysis without auto-fixes:
119+
```
120+
hatch fmt --check
121+
```
9122

10123
## Reporting Bugs/Feature Requests
11124

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
## My Project
1+
# aws-durable-functions-sdk-python
22

3-
TODO: Fill this README out!
3+
[![PyPI - Version](https://img.shields.io/pypi/v/aws-durable-functions-sdk-python.svg)](https://pypi.org/project/aws-durable-functions-sdk-python)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aws-durable-functions-sdk-python.svg)](https://pypi.org/project/aws-durable-functions-sdk-python)
45

5-
Be sure to:
6+
-----
67

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
8+
## Table of Contents
99

10-
## Security
10+
- [Installation](#installation)
11+
- [License](#license)
1112

12-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
13+
## Installation
1314

14-
## License
15+
```console
16+
pip install aws-durable-functions-sdk-python
17+
```
18+
19+
## Developers
20+
Please see [CONTRIBUTING.md](CONTRIBUTING.md). It contains the testing guide, sample commands and instructions
21+
for how to contribute to this package.
1522

16-
This project is licensed under the Apache-2.0 License.
23+
tldr; use `hatch` and it will manage virtual envs and dependencies for you, so you don't have to do it manually.
24+
25+
## License
1726

27+
This project is licensed under the [Apache-2.0 License](LICENSE).

pyproject.toml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "aws-durable-functions-sdk-python"
7+
dynamic = ["version"]
8+
description = 'This the Python SDK for AWS Lambda Durable Functions.'
9+
readme = "README.md"
10+
requires-python = ">=3.13"
11+
license = "Apache-2.0"
12+
keywords = []
13+
authors = [
14+
{ name = "yaythomas", email = "tgaigher@amazon.com" },
15+
]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.13",
20+
"Programming Language :: Python :: Implementation :: CPython",
21+
"Programming Language :: Python :: Implementation :: PyPy",
22+
]
23+
dependencies = [
24+
"boto3>=1.40.30"
25+
]
26+
27+
[project.urls]
28+
Documentation = "https://github.com/aws/aws-durable-functions-sdk-python#readme"
29+
Issues = "https://github.com/aws/aws-durable-functions-sdk-python/issues"
30+
Source = "https://github.com/aws/aws-durable-functions-sdk-python"
31+
32+
[tool.hatch.build.targets.sdist]
33+
packages = ["src/aws_durable_functions_sdk_python"]
34+
35+
[tool.hatch.build.targets.wheel]
36+
packages = ["src/aws_durable_functions_sdk_python"]
37+
38+
[tool.hatch.version]
39+
path = "src/aws_durable_functions_sdk_python/__about__.py"
40+
41+
# [tool.hatch.envs.default]
42+
# dependencies=["pytest"]
43+
44+
# [tool.hatch.envs.default.scripts]
45+
# test="pytest"
46+
47+
[tool.hatch.envs.test]
48+
dependencies = [
49+
"coverage[toml]",
50+
"pytest",
51+
"pytest-cov",
52+
]
53+
54+
[tool.hatch.envs.test.scripts]
55+
cov="pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aws_durable_functions_sdk_python --cov=tests --cov-fail-under=98"
56+
57+
[tool.hatch.envs.types]
58+
extra-dependencies = [
59+
"mypy>=1.0.0",
60+
"pytest"
61+
]
62+
[tool.hatch.envs.types.scripts]
63+
check = "mypy --install-types --non-interactive {args:src/aws_durable_functions_sdk_python tests}"
64+
65+
[tool.coverage.run]
66+
source_pkgs = ["aws_durable_functions_sdk_python", "tests"]
67+
branch = true
68+
parallel = true
69+
omit = [
70+
"src/aws_durable_functions_sdk_python/__about__.py",
71+
]
72+
73+
[tool.coverage.paths]
74+
aws_durable_functions_sdk_python = ["src/aws_durable_functions_sdk_python", "*/aws-durable-functions-sdk-python/src/aws_durable_functions_sdk_python"]
75+
tests = ["tests", "*/aws-durable-functions-sdk-python/tests"]
76+
77+
[tool.coverage.report]
78+
exclude_lines = [
79+
"no cov",
80+
"if __name__ == .__main__.:",
81+
"if TYPE_CHECKING:",
82+
]
83+
84+
[tool.ruff]
85+
line-length = 88
86+
87+
[tool.ruff.lint]
88+
preview = false
89+
90+
[tool.ruff.lint.per-file-ignores]
91+
"tests/**" = ["ARG001", "ARG002", "ARG005", "S101", "PLR2004", "SIM117", "TRY301"]

src/aws_durable_functions_sdk_python/.gitignore

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: 2025-present Amazon.com, Inc. or its affiliates.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
__version__ = "0.0.1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""AWS Lambda Durable Executions Python SDK."""

0 commit comments

Comments
 (0)