Skip to content
Closed
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
5 changes: 5 additions & 0 deletions libs/langgraph-agentcore-checkpoint/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Code of Conduct

This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.
198 changes: 198 additions & 0 deletions libs/langgraph-agentcore-checkpoint/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
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.

## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you've made relevant to the bug
- Anything unusual about your environment or deployment

## Contributing via Pull Requests

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the _main_ branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.

## Development Setup

This section provides detailed instructions for setting up your development environment and running tests locally.

### Prerequisites

This project utilizes [Poetry](https://python-poetry.org/) v1.7.1+ as a dependency manager.

❗Note: _Before installing Poetry_, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n langgraph-agentcore-checkpoint python=3.9`)

Install Poetry: **[documentation on how to install it](https://python-poetry.org/docs/#installation)**.

❗Note: If you use `Conda` or `Pyenv` as your environment/package manager, after installing Poetry,
tell Poetry to use the virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)

### Installation

All commands should be run from the `libs/langgraph-agentcore-checkpoint` directory:

```bash
cd libs/langgraph-agentcore-checkpoint
```

Install all development dependencies:

```bash
poetry install --with dev,test,lint,typing,codespell,test_integration
```

### Testing

#### Unit Tests

Unit tests cover modular logic that does not require calls to outside APIs:

```bash
make tests
```

To run a specific unit test:

```bash
make test TEST_FILE=tests/unit_tests/specific_test.py
```

#### Integration Tests

Integration tests cover end-to-end functionality with AWS services:

```bash
make integration_tests
```

To run a specific integration test:

```bash
make integration_test TEST_FILE=tests/integration_tests/specific_test.py
```

### Code Coverage

This project uses [coverage.py](https://github.com/nedbat/coveragepy) to track code coverage during testing.

#### Running Tests with Coverage

To run unit tests with coverage:

```bash
make coverage_tests
```

To run all integration tests with coverage:

```bash
make coverage_integration_tests
```

To run a specific integration test with coverage:

```bash
make coverage_integration_test TEST_FILE=tests/integration_tests/specific_test.py
```

#### Viewing Coverage Reports

**Terminal Report:**

```bash
make coverage_report
```

**HTML Report:**

```bash
make coverage_html
```

The HTML report will be generated in the `htmlcov/` directory. Open `htmlcov/index.html` in your browser for detailed analysis.

### Code Quality

#### Formatting

Code formatting is done via [ruff](https://docs.astral.sh/ruff/rules/):

```bash
make format
```

#### Linting

Linting is done via [ruff](https://docs.astral.sh/ruff/rules/):

```bash
make lint
```

To automatically fix linting issues:

```bash
make lint_fix
```

#### Type Checking

Type checking is done via [mypy](http://mypy-lang.org/):

```bash
make lint_tests
```

#### Spell Checking

Spell checking is done via [codespell](https://github.com/codespell-project/codespell):

```bash
make spell_check
```

To fix spelling issues:

```bash
make spell_fix
```

### Clean Up

To clean generated files and caches:

```bash
make clean
```

## Finding contributions to work on

Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.

## Code of Conduct

This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.

## Security issue notifications

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.

## Licensing

See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
21 changes: 21 additions & 0 deletions libs/langgraph-agentcore-checkpoint/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) LangChain, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
150 changes: 150 additions & 0 deletions libs/langgraph-agentcore-checkpoint/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
######################
# VARIABLES
######################

PYTHON_FILES=.
MYPY_CACHE=.mypy_cache
PACKAGE_NAME=langgraph_agentcore_checkpoint

.PHONY: help lint format install_dev install_test install_lint install_typing install_codespell check_imports spell_check spell_fix coverage_integration_tests coverage_integration_test coverage_tests coverage_report coverage_html

######################
# LINTING AND FORMATTING
######################

# Define different lint targets
lint format: PYTHON_FILES=.
lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$|\.ipynb$$')
lint_package: PYTHON_FILES=$(PACKAGE_NAME)
lint_tests: PYTHON_FILES=tests
lint_tests: MYPY_CACHE=.mypy_cache_test

lint: ## Run linter
poetry run ruff check $(PYTHON_FILES)

lint_fix: ## Run linter and fix issues
poetry run ruff check --fix $(PYTHON_FILES)

lint_diff: ## Run linter on changed files
poetry run ruff check $(PYTHON_FILES)

lint_package: ## Run linter on package
poetry run ruff check --select I $(PYTHON_FILES)

lint_tests: ## Run type checking on tests
mkdir -p $(MYPY_CACHE); poetry run mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)

format: ## Run code formatter
poetry run ruff format $(PYTHON_FILES)

format_diff: ## Run code formatter and show differences
poetry run ruff format $(PYTHON_FILES) --diff

spell_check: ## Run code spell check
poetry run codespell --toml pyproject.toml

spell_fix: ## Run code spell fix
poetry run codespell --toml pyproject.toml -w

######################
# TESTING
######################

# Define a variable for the test file path.
test test_watch tests: TEST_FILE ?= tests/unit_tests/
integration_test integration_tests: TEST_FILE = tests/integration_tests/

# Define a variable for Python and notebook files.
PYTHON_FILES=.

tests: ## Run all unit tests
poetry run pytest $(TEST_FILE)

test: ## Run individual unit test: make test TEST_FILE=tests/unit_test/test.py
poetry run pytest $(TEST_FILE)

integration_tests: ## Run all integration tests
poetry run pytest $(TEST_FILE)

integration_test: ## Run individual integration test: make integration_test TEST_FILE=tests/integration_tests/integ_test.py
poetry run pytest $(TEST_FILE)

test_watch: ## Run and interactively watch unit tests
poetry run ptw --snapshot-update --now . -- -vv $(TEST_FILE)

coverage_integration_tests: ## Run integration tests with coverage
poetry run pytest --cov=langgraph_agentcore_checkpoint --cov-report=html --cov-report=term-missing --cov-branch tests/integration_tests/

coverage_integration_test: ## Run specific integration test with coverage: make coverage_integration_test TEST_FILE=tests/integration_tests/integ_test.py
poetry run pytest --cov=langgraph_agentcore_checkpoint --cov-report=html --cov-report=term-missing --cov-branch $(TEST_FILE)

coverage_tests: ## Run unit tests with coverage
poetry run pytest --cov=langgraph_agentcore_checkpoint --cov-report=html --cov-report=term-missing --cov-branch tests/unit_tests/

coverage_report: ## Generate coverage report
poetry run coverage report

coverage_html: ## Generate HTML coverage report
poetry run coverage html

######################
# DEPENDENCIES
######################

install: ## Install package
@pip install --no-cache -U poetry
@poetry install

install_dev: ## Install development environment
@pip install --no-cache -U poetry
@poetry install --with dev

install_test: ## Install test dependencies
@pip install --no-cache -U poetry
@poetry install --with test

install_lint: ## Install lint dependencies
@pip install --no-cache -U poetry
@poetry install --with lint

install_typing: ## Install typing dependencies
@pip install --no-cache -U poetry
@poetry install --with typing

install_codespell: ## Install codespell dependencies
@pip install --no-cache -U poetry
@poetry install --with codespell

install_all: ## Install all dependencies including optional groups
@pip install --no-cache -U poetry
@poetry install --with dev,test,lint,typing,codespell

check_imports: $(shell find $(PACKAGE_NAME) -name '*.py') ## Check missing imports
@poetry run python ./scripts/check_imports.py $^

######################
# CLEANING
######################

clean: ## Clean all generated files
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -type f -name ".coverage" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name "*.egg" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +
find . -type d -name "build" -exec rm -rf {} +

######################
# HELP
######################

help: ## Print this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
Loading