mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-17 21:25:46 +02:00
9ed7572527
Bumps the all-dependencies group in /libs/checkpoint-postgres with 1 update: [ruff](https://github.com/astral-sh/ruff). Updates `ruff` from 0.15.5 to 0.15.6 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/releases">ruff's releases</a>.</em></p> <blockquote> <h2>0.15.6</h2> <h2>Release Notes</h2> <p>Released on 2026-03-12.</p> <h3>Preview features</h3> <ul> <li>Add support for <code>lazy</code> import parsing (<a href="https://redirect.github.com/astral-sh/ruff/pull/23755">#23755</a>)</li> <li>Add support for star-unpacking of comprehensions (PEP 798) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23788">#23788</a>)</li> <li>Reject semantic syntax errors for lazy imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23757">#23757</a>)</li> <li>Drop a few rules from the preview default set (<a href="https://redirect.github.com/astral-sh/ruff/pull/23879">#23879</a>)</li> <li>[<code>airflow</code>] Flag <code>Variable.get()</code> calls outside of task execution context (<code>AIR003</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23584">#23584</a>)</li> <li>[<code>airflow</code>] Flag runtime-varying values in DAG/task constructor arguments (<code>AIR304</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23631">#23631</a>)</li> <li>[<code>flake8-bugbear</code>] Implement <code>delattr-with-constant</code> (<code>B043</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23737">#23737</a>)</li> <li>[<code>flake8-tidy-imports</code>] Add <code>TID254</code> to enforce lazy imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23777">#23777</a>)</li> <li>[<code>flake8-tidy-imports</code>] Allow users to ban lazy imports with <code>TID254</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23847">#23847</a>)</li> <li>[<code>isort</code>] Retain <code>lazy</code> keyword when sorting imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23762">#23762</a>)</li> <li>[<code>pyupgrade</code>] Add <code>from __future__ import annotations</code> automatically (<code>UP006</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23260">#23260</a>)</li> <li>[<code>refurb</code>] Support <code>newline</code> parameter in <code>FURB101</code> for Python 3.13+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23754">#23754</a>)</li> <li>[<code>ruff</code>] Add <code>os-path-commonprefix</code> (<code>RUF071</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23814">#23814</a>)</li> <li>[<code>ruff</code>] Add unsafe fix for os-path-commonprefix (<code>RUF071</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23852">#23852</a>)</li> <li>[<code>ruff</code>] Limit <code>RUF036</code> to typing contexts; make it unsafe for non-typing-only (<a href="https://redirect.github.com/astral-sh/ruff/pull/23765">#23765</a>)</li> <li>[<code>ruff</code>] Use starred unpacking for <code>RUF017</code> in Python 3.15+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23789">#23789</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Fix <code>--add-noqa</code> creating unwanted leading whitespace (<a href="https://redirect.github.com/astral-sh/ruff/pull/23773">#23773</a>)</li> <li>Fix <code>--add-noqa</code> breaking shebangs (<a href="https://redirect.github.com/astral-sh/ruff/pull/23577">#23577</a>)</li> <li>[formatter] Fix lambda body formatting for multiline calls and subscripts (<a href="https://redirect.github.com/astral-sh/ruff/pull/23866">#23866</a>)</li> <li>[formatter] Preserve required annotation parentheses in annotated assignments (<a href="https://redirect.github.com/astral-sh/ruff/pull/23865">#23865</a>)</li> <li>[formatter] Preserve type-expression parentheses in the formatter (<a href="https://redirect.github.com/astral-sh/ruff/pull/23867">#23867</a>)</li> <li>[<code>flake8-annotations</code>] Fix stack overflow in <code>ANN401</code> on quoted annotations with escape sequences (<a href="https://redirect.github.com/astral-sh/ruff/pull/23912">#23912</a>)</li> <li>[<code>pep8-naming</code>] Check naming conventions in <code>match</code> pattern bindings (<code>N806</code>, <code>N815</code>, <code>N816</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23899">#23899</a>)</li> <li>[<code>perflint</code>] Fix comment duplication in fixes (<code>PERF401</code>, <code>PERF403</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23729">#23729</a>)</li> <li>[<code>pyupgrade</code>] Properly trigger <code>super</code> change in nested class (<code>UP008</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22677">#22677</a>)</li> <li>[<code>ruff</code>] Avoid syntax errors in <code>RUF036</code> fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23764">#23764</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>[<code>flake8-bandit</code>] Flag <code>S501</code> with <code>requests.request</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23873">#23873</a>)</li> <li>[<code>flake8-executable</code>] Fix WSL detection in non-Docker containers (<a href="https://redirect.github.com/astral-sh/ruff/pull/22879">#22879</a>)</li> <li>[<code>flake8-print</code>] Ignore <code>pprint</code> calls with <code>stream=</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23787">#23787</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Update docs for Markdown code block formatting (<a href="https://redirect.github.com/astral-sh/ruff/pull/23871">#23871</a>)</li> <li>[<code>flake8-bugbear</code>] Fix misleading description for <code>B904</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23731">#23731</a>)</li> </ul> <h3>Contributors</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md">ruff's changelog</a>.</em></p> <blockquote> <h2>0.15.6</h2> <p>Released on 2026-03-12.</p> <h3>Preview features</h3> <ul> <li>Add support for <code>lazy</code> import parsing (<a href="https://redirect.github.com/astral-sh/ruff/pull/23755">#23755</a>)</li> <li>Add support for star-unpacking of comprehensions (PEP 798) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23788">#23788</a>)</li> <li>Reject semantic syntax errors for lazy imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23757">#23757</a>)</li> <li>Drop a few rules from the preview default set (<a href="https://redirect.github.com/astral-sh/ruff/pull/23879">#23879</a>)</li> <li>[<code>airflow</code>] Flag <code>Variable.get()</code> calls outside of task execution context (<code>AIR003</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23584">#23584</a>)</li> <li>[<code>airflow</code>] Flag runtime-varying values in DAG/task constructor arguments (<code>AIR304</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23631">#23631</a>)</li> <li>[<code>flake8-bugbear</code>] Implement <code>delattr-with-constant</code> (<code>B043</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23737">#23737</a>)</li> <li>[<code>flake8-tidy-imports</code>] Add <code>TID254</code> to enforce lazy imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23777">#23777</a>)</li> <li>[<code>flake8-tidy-imports</code>] Allow users to ban lazy imports with <code>TID254</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23847">#23847</a>)</li> <li>[<code>isort</code>] Retain <code>lazy</code> keyword when sorting imports (<a href="https://redirect.github.com/astral-sh/ruff/pull/23762">#23762</a>)</li> <li>[<code>pyupgrade</code>] Add <code>from __future__ import annotations</code> automatically (<code>UP006</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23260">#23260</a>)</li> <li>[<code>refurb</code>] Support <code>newline</code> parameter in <code>FURB101</code> for Python 3.13+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23754">#23754</a>)</li> <li>[<code>ruff</code>] Add <code>os-path-commonprefix</code> (<code>RUF071</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23814">#23814</a>)</li> <li>[<code>ruff</code>] Add unsafe fix for os-path-commonprefix (<code>RUF071</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23852">#23852</a>)</li> <li>[<code>ruff</code>] Limit <code>RUF036</code> to typing contexts; make it unsafe for non-typing-only (<a href="https://redirect.github.com/astral-sh/ruff/pull/23765">#23765</a>)</li> <li>[<code>ruff</code>] Use starred unpacking for <code>RUF017</code> in Python 3.15+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23789">#23789</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Fix <code>--add-noqa</code> creating unwanted leading whitespace (<a href="https://redirect.github.com/astral-sh/ruff/pull/23773">#23773</a>)</li> <li>Fix <code>--add-noqa</code> breaking shebangs (<a href="https://redirect.github.com/astral-sh/ruff/pull/23577">#23577</a>)</li> <li>[formatter] Fix lambda body formatting for multiline calls and subscripts (<a href="https://redirect.github.com/astral-sh/ruff/pull/23866">#23866</a>)</li> <li>[formatter] Preserve required annotation parentheses in annotated assignments (<a href="https://redirect.github.com/astral-sh/ruff/pull/23865">#23865</a>)</li> <li>[formatter] Preserve type-expression parentheses in the formatter (<a href="https://redirect.github.com/astral-sh/ruff/pull/23867">#23867</a>)</li> <li>[<code>flake8-annotations</code>] Fix stack overflow in <code>ANN401</code> on quoted annotations with escape sequences (<a href="https://redirect.github.com/astral-sh/ruff/pull/23912">#23912</a>)</li> <li>[<code>pep8-naming</code>] Check naming conventions in <code>match</code> pattern bindings (<code>N806</code>, <code>N815</code>, <code>N816</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23899">#23899</a>)</li> <li>[<code>perflint</code>] Fix comment duplication in fixes (<code>PERF401</code>, <code>PERF403</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23729">#23729</a>)</li> <li>[<code>pyupgrade</code>] Properly trigger <code>super</code> change in nested class (<code>UP008</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22677">#22677</a>)</li> <li>[<code>ruff</code>] Avoid syntax errors in <code>RUF036</code> fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23764">#23764</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>[<code>flake8-bandit</code>] Flag <code>S501</code> with <code>requests.request</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23873">#23873</a>)</li> <li>[<code>flake8-executable</code>] Fix WSL detection in non-Docker containers (<a href="https://redirect.github.com/astral-sh/ruff/pull/22879">#22879</a>)</li> <li>[<code>flake8-print</code>] Ignore <code>pprint</code> calls with <code>stream=</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23787">#23787</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Update docs for Markdown code block formatting (<a href="https://redirect.github.com/astral-sh/ruff/pull/23871">#23871</a>)</li> <li>[<code>flake8-bugbear</code>] Fix misleading description for <code>B904</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23731">#23731</a>)</li> </ul> <h3>Contributors</h3> <ul> <li><a href="https://github.com/zsol"><code>@zsol</code></a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/ruff/commit/e4c7f357777a2fdd34dbe6a98b1b7d3e7488f675"><code>e4c7f35</code></a> Bump 0.15.6 (<a href="https://redirect.github.com/astral-sh/ruff/issues/23919">#23919</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/edfe6c17a493669227da45ce7edc786208d9d0b0"><code>edfe6c1</code></a> [ty] Narrow type context during collection literal inference (<a href="https://redirect.github.com/astral-sh/ruff/issues/23844">#23844</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/dd16d689abd9d0fa1caf4316e70479fd422b6142"><code>dd16d68</code></a> Exclude broken symlink in ecosystem check (<a href="https://redirect.github.com/astral-sh/ruff/issues/23921">#23921</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/3f94c6ac6397cdc3160459d9d6e3892e3f3242dd"><code>3f94c6a</code></a> Fix stack overflow in ANN401 on quoted annotations with escape sequences (<a href="https://redirect.github.com/astral-sh/ruff/issues/23">#23</a>...</li> <li><a href="https://github.com/astral-sh/ruff/commit/91fc7bd3f936974d7107ba8fd0668bc251a55c58"><code>91fc7bd</code></a> [ty] Fix false-positive diagnostics for PEP-604 union annotations on attribut...</li> <li><a href="https://github.com/astral-sh/ruff/commit/04229cffb44dfe8c64a0879eb3cea472a08d1565"><code>04229cf</code></a> [ty] Initial test suite for PEP-728 <code>TypedDict</code> features (<a href="https://redirect.github.com/astral-sh/ruff/issues/23832">#23832</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/728b9d6fd300d492fc2572bcfade170141296f97"><code>728b9d6</code></a> [<code>pep8-naming</code>] Check naming conventions in <code>match</code> pattern bindings (<code>N806</code>,...</li> <li><a href="https://github.com/astral-sh/ruff/commit/88d1eecd261679fc9d1d10f30d814230a7f28513"><code>88d1eec</code></a> [ty] Ensure a <code>type[]</code> type <code>T</code> is always considered assignable to a union th...</li> <li><a href="https://github.com/astral-sh/ruff/commit/37cdd61406ad4965847c9baa7c3f6ca633887d68"><code>37cdd61</code></a> Fix lambda body formatting for multiline calls and subscripts (<a href="https://redirect.github.com/astral-sh/ruff/issues/23866">#23866</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/a25a4df54aca67d23b4867ddad634fe0768fd6a2"><code>a25a4df</code></a> [ty] Disambiguate duplicate-looking overloaded callables in union display (<a href="https://redirect.github.com/astral-sh/ruff/issues/2">#2</a>...</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/ruff/compare/0.15.5...0.15.6">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
LangGraph Checkpoint Postgres
Implementation of LangGraph CheckpointSaver that uses Postgres.
Dependencies
By default langgraph-checkpoint-postgres installs psycopg (Psycopg 3) without any extras. However, you can choose a specific installation that best suits your needs here (for example, psycopg[binary]).
Usage
Important
When using Postgres checkpointers for the first time, make sure to call
.setup()method on them to create required tables. See example below.
Important
When manually creating Postgres connections and passing them to
PostgresSaverorAsyncPostgresSaver, make sure to includeautocommit=Trueandrow_factory=dict_row(from psycopg.rows import dict_row). See a full example in this how-to guide.Why these parameters are required:
autocommit=True: Required for the.setup()method to properly commit the checkpoint tables to the database. Without this, table creation may not be persisted.row_factory=dict_row: Required because the PostgresSaver implementation accesses database rows using dictionary-style syntax (e.g.,row["column_name"]). The defaulttuple_rowfactory returns tuples that only support index-based access (e.g.,row[0]), which will causeTypeErrorexceptions when the checkpointer tries to access columns by name.Example of incorrect usage:
# ❌ This will fail with TypeError during checkpointer operations with psycopg.connect(DB_URI) as conn: # Missing autocommit=True and row_factory=dict_row checkpointer = PostgresSaver(conn) checkpointer.setup() # May not persist tables properly # Any operation that reads from database will fail with: # TypeError: tuple indices must be integers or slices, not str
from langgraph.checkpoint.postgres import PostgresSaver
write_config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
read_config = {"configurable": {"thread_id": "1"}}
DB_URI = "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable"
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
# call .setup() the first time you're using the checkpointer
checkpointer.setup()
checkpoint = {
"v": 4,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
}
# store checkpoint
checkpointer.put(write_config, checkpoint, {}, {})
# load checkpoint
checkpointer.get(read_config)
# list checkpoints
list(checkpointer.list(read_config))
Async
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
checkpoint = {
"v": 4,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
}
# store checkpoint
await checkpointer.aput(write_config, checkpoint, {}, {})
# load checkpoint
await checkpointer.aget(read_config)
# list checkpoints
[c async for c in checkpointer.alist(read_config)]