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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:

pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.13"]

steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Hatch
run: |
python -m pip install --upgrade hatch
- name: static analysis
run: hatch fmt --check
- name: type checking
run: hatch run types:check
- name: Run tests + coverage
run: hatch run test:cov
- name: Build distribution
run: hatch build
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*~
*#
*.swp
*.iml
*.DS_Store

__pycache__/
*.py[cod]
*$py.class
*.egg-info/

/.coverage
/.coverage.*
/.cache
/.pytest_cache
/.mypy_cache

/doc/_apidoc/
/build

.venv
.venv/

.attach_*

dist/
113 changes: 113 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,119 @@ documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.

## Dependencies
Install [hatch](https://hatch.pypa.io/dev/install/).

## Developer workflow
These are all the checks you would typically do as you prepare a PR:
```
# just test
hatch test

# coverage
hatch run test:cov

# type checks
hatch run types:check

# static analysis
hatch fmt
```

## Set up your IDE
Point your IDE at the hatch virtual environment to have it recognize dependencies
and imports.

You can find the path to the hatch Python interpreter like this:
```
echo "$(hatch env find)/bin/python"
```

### VS Code
If you're using VS Code, "Python: Select Interpreter" and use the hatch venv Python interpreter
as found with the `hatch env find` command.

Hatch uses Ruff for static analysis.

You might want to install the [Ruff extension for VS Code](https://github.com/astral-sh/ruff-vscode)
to have your IDE interactively warn of the same linting and formatting rules.

These `settings.json` settings are useful:
```
{
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
"ruff.nativeServer": "on",
```

## Testing
### How to run tests
To run all tests:
```
hatch test
```

To run a single test file:
```
hatch test tests/path_to_test_module.py
```

To run a specific test in a module:
```
hatch test tests/path_to_test_module.py::test_mytestmethod
```

To run a single test, or a subset of tests:
```
$ hatch test -k TEST_PATTERN
```

This will run tests which contain names that match the given string expression (case-insensitive),
which can include Python operators that use filenames, class names and function names as variables.

### Debug
To debug failing tests:

```
$ hatch test --pdb
```

This will drop you into the Python debugger on the failed test.

### Writing tests
Place test files in the `tests/` directory, using file names that end with `_test`.

Mimic the package structure in the src/aws_durable_functions_sdk_python directory.
Name your module so that src/mypackage/mymodule.py has a dedicated unit test file
tests/mypackage/mymodule_test.py

## Coverage
```
hatch run test:cov
```

## Linting and type checks
Type checking:
```
hatch run types:check
```

Static analysis (with auto-fix of known issues):
```
hatch fmt
```

To do static analysis without auto-fixes:
```
hatch fmt --check
```

## Reporting Bugs/Feature Requests

Expand Down
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
## My Project
# aws-durable-functions-sdk-python

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

Be sure to:
-----

* Change the title in this README
* Edit your repository description on GitHub
## Table of Contents

## Security
- [Installation](#installation)
- [License](#license)

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

## License
```console
pip install aws-durable-functions-sdk-python
```

## Developers
Please see [CONTRIBUTING.md](CONTRIBUTING.md). It contains the testing guide, sample commands and instructions
for how to contribute to this package.

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

## License

This project is licensed under the [Apache-2.0 License](LICENSE).
91 changes: 91 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "aws-durable-functions-sdk-python"
dynamic = ["version"]
description = 'This the Python SDK for AWS Lambda Durable Functions.'
readme = "README.md"
requires-python = ">=3.13"
license = "Apache-2.0"
keywords = []
authors = [
{ name = "yaythomas", email = "tgaigher@amazon.com" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"boto3>=1.40.30"
]

[project.urls]
Documentation = "https://github.com/aws/aws-durable-functions-sdk-python#readme"
Issues = "https://github.com/aws/aws-durable-functions-sdk-python/issues"
Source = "https://github.com/aws/aws-durable-functions-sdk-python"

[tool.hatch.build.targets.sdist]
packages = ["src/aws_durable_functions_sdk_python"]

[tool.hatch.build.targets.wheel]
packages = ["src/aws_durable_functions_sdk_python"]

[tool.hatch.version]
path = "src/aws_durable_functions_sdk_python/__about__.py"

# [tool.hatch.envs.default]
# dependencies=["pytest"]

# [tool.hatch.envs.default.scripts]
# test="pytest"

[tool.hatch.envs.test]
dependencies = [
"coverage[toml]",
"pytest",
"pytest-cov",
]

[tool.hatch.envs.test.scripts]
cov="pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aws_durable_functions_sdk_python --cov=tests --cov-fail-under=98"

[tool.hatch.envs.types]
extra-dependencies = [
"mypy>=1.0.0",
"pytest"
]
[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/aws_durable_functions_sdk_python tests}"

[tool.coverage.run]
source_pkgs = ["aws_durable_functions_sdk_python", "tests"]
branch = true
parallel = true
omit = [
"src/aws_durable_functions_sdk_python/__about__.py",
]

[tool.coverage.paths]
aws_durable_functions_sdk_python = ["src/aws_durable_functions_sdk_python", "*/aws-durable-functions-sdk-python/src/aws_durable_functions_sdk_python"]
tests = ["tests", "*/aws-durable-functions-sdk-python/tests"]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[tool.ruff]
line-length = 88

[tool.ruff.lint]
preview = false

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ARG001", "ARG002", "ARG005", "S101", "PLR2004", "SIM117", "TRY301"]
Empty file.
4 changes: 4 additions & 0 deletions src/aws_durable_functions_sdk_python/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2025-present Amazon.com, Inc. or its affiliates.
#
# SPDX-License-Identifier: Apache-2.0
__version__ = "0.0.1"
Copy link
Member

Choose a reason for hiding this comment

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

1 change: 1 addition & 0 deletions src/aws_durable_functions_sdk_python/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""AWS Lambda Durable Executions Python SDK."""
Loading