diff --git a/.github/workflows/_release.yml b/.github/workflows/_release.yml index 39243a1..389a791 100644 --- a/.github/workflows/_release.yml +++ b/.github/workflows/_release.yml @@ -11,10 +11,12 @@ on: inputs: working-directory: required: true + type: choice options: - libs/mongodb - langgraph-checkpoint-mongodb default: libs/mongodb + description: "From which folder this pipeline executes" env: PYTHON_VERSION: "3.11" @@ -114,7 +116,7 @@ jobs: PKG_NAME: ${{ needs.build.outputs.pkg-name }} VERSION: ${{ needs.build.outputs.version }} # Here we use: - # - The default regular PyPI index as the *primary* index, meaning + # - The default regular PyPI index as the *primary* index, meaning # that it takes priority (https://pypi.org/simple) # - The test PyPI index as an extra index, so that any dependencies that # are not found on test PyPI can be resolved and installed anyway. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a612ce7..3e09d46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,18 @@ jobs: outputs: dirs-to-lint: ${{ steps.set-matrix.outputs.dirs-to-lint }} dirs-to-test: ${{ steps.set-matrix.outputs.dirs-to-test }} + pre-commit: + name: pre-commit + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files --hook-stage=manual lint: name: cd ${{ matrix.working-directory }} needs: [ build ] @@ -61,7 +73,7 @@ jobs: ci_success: name: "CI Success" - needs: [build, lint, test] + needs: [build, lint, test, pre-commit] if: | always() runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a64e407 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: forbid-new-submodules + - id: trailing-whitespace + exclude_types: [json] + +# We use the Python version instead of the original version which seems to require Docker +# https://github.com/koalaman/shellcheck-precommit +- repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.6 + hooks: + - id: shellcheck + name: shellcheck + args: ["--severity=warning"] + stages: [manual] + +- repo: https://github.com/sirosen/check-jsonschema + rev: 0.29.4 + hooks: + - id: check-github-workflows + args: ["--verbose"] diff --git a/libs/langgraph-checkpoint-mongodb/pyproject.toml b/libs/langgraph-checkpoint-mongodb/pyproject.toml index e9e699a..1f22c64 100644 --- a/libs/langgraph-checkpoint-mongodb/pyproject.toml +++ b/libs/langgraph-checkpoint-mongodb/pyproject.toml @@ -66,4 +66,3 @@ warn_unused_ignores = "True" warn_redundant_casts = "True" allow_redefinition = "True" disable_error_code = "typeddict-item, return-value" - diff --git a/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel.ambr b/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel.ambr index b2cf266..33f691d 100644 --- a/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel.ambr +++ b/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel.ambr @@ -8,7 +8,7 @@ tool_two_slow --> finish; prepare -.-> tool_two_fast; tool_two_fast --> finish; - + ''' # --- # name: test_branch_then[memory].1 @@ -30,7 +30,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_branch_then[mongodb] @@ -42,7 +42,7 @@ tool_two_slow --> finish; prepare -.-> tool_two_fast; tool_two_fast --> finish; - + ''' # --- # name: test_branch_then[mongodb].1 @@ -64,7 +64,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_entrypoint_graph @@ -147,7 +147,7 @@ __start__ -.  go-left  .-> left; __start__ -.  go-right  .-> right; left -.-> __end__; - + ''' # --- # name: test_conditional_entrypoint_graph_state @@ -230,7 +230,7 @@ __start__ -.  go-left  .-> left; __start__ -.  go-right  .-> right; left -.-> __end__; - + ''' # --- # name: test_conditional_entrypoint_to_multiple_state_graph @@ -292,7 +292,7 @@ get_weather --> __end__; __start__ -.-> get_weather; __start__ -.-> __end__; - + ''' # --- # name: test_conditional_graph[memory] @@ -373,7 +373,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[memory].2 @@ -393,7 +393,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_graph[memory].3 @@ -553,7 +553,7 @@ tools --> Parallel_agent_outcome_Input; Parallel_agent_outcome_Output -.  continue  .-> tools; Parallel_agent_outcome_Output -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[memory].5 @@ -646,7 +646,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_graph[mongodb] @@ -727,7 +727,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[mongodb].2 @@ -747,7 +747,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_graph[mongodb].3 @@ -907,7 +907,7 @@ tools --> Parallel_agent_outcome_Input; Parallel_agent_outcome_Output -.  continue  .-> tools; Parallel_agent_outcome_Output -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[mongodb].5 @@ -1000,7 +1000,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_state_graph[memory] @@ -1082,7 +1082,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_state_graph[mongodb] @@ -1164,7 +1164,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_state_graph_with_list_edge_inputs @@ -1236,7 +1236,7 @@ B --> __end__; __start__ --> A; __start__ --> B; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge[memory] @@ -1249,7 +1249,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query --> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge[mongodb] @@ -1262,7 +1262,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query --> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic1[memory] @@ -1275,7 +1275,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic1[memory].1 @@ -1345,7 +1345,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic1[mongodb].1 @@ -1415,7 +1415,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[memory].1 @@ -1485,7 +1485,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[mongodb].1 @@ -1555,7 +1555,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_via_branch[mongodb] @@ -1568,7 +1568,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_message_graph[memory] @@ -1649,7 +1649,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  end  .-> __end__; - + ''' # --- # name: test_message_graph[mongodb] @@ -1730,7 +1730,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  end  .-> __end__; - + ''' # --- # name: test_multiple_sinks_subgraphs @@ -1753,7 +1753,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_nested_graph @@ -1762,7 +1762,7 @@ __start__ --> inner; inner --> side; side --> __end__; - + ''' # --- # name: test_nested_graph.1 @@ -1779,7 +1779,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_nested_graph_xray @@ -1934,7 +1934,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_prebuilt_tool_chat @@ -2014,7 +2014,7 @@ tools --> agent; agent -.-> tools; agent -.-> __end__; - + ''' # --- # name: test_repeat_condition @@ -2030,7 +2030,7 @@ Call_Tool -.-> Researcher; Call_Tool -.-> Chart_Generator; Researcher -.  redo  .-> Researcher; - + ''' # --- # name: test_simple_multi_edge @@ -2042,7 +2042,7 @@ up --> down; up --> other; up --> side; - + ''' # --- # name: test_start_branch_then[memory] @@ -2060,7 +2060,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_start_branch_then[mongodb] @@ -2078,7 +2078,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_state_graph_w_config_inherited_state_keys @@ -2112,7 +2112,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_weather_subgraph[mongodb] @@ -2137,7 +2137,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_bool @@ -2173,7 +2173,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_issue @@ -2200,7 +2200,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_lance diff --git a/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel_async.ambr b/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel_async.ambr index 6edff52..48cef72 100644 --- a/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel_async.ambr +++ b/libs/langgraph-checkpoint-mongodb/tests/__snapshots__/test_pregel_async.ambr @@ -9,7 +9,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[memory].1 @@ -130,7 +130,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[mongodb_aio].1 @@ -263,7 +263,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_weather_subgraph[mongodb_aio] @@ -288,6 +288,6 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- diff --git a/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel.ambr b/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel.ambr index 247b3ae..c2c76ab 100644 --- a/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel.ambr +++ b/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel.ambr @@ -8,7 +8,7 @@ tool_two_slow --> finish; prepare -.-> tool_two_fast; tool_two_fast --> finish; - + ''' # --- # name: test_branch_then[mongodb].1 @@ -30,7 +30,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_entrypoint_graph @@ -113,7 +113,7 @@ __start__ -.  go-left  .-> left; __start__ -.  go-right  .-> right; left -.-> __end__; - + ''' # --- # name: test_conditional_entrypoint_graph_state @@ -196,7 +196,7 @@ __start__ -.  go-left  .-> left; __start__ -.  go-right  .-> right; left -.-> __end__; - + ''' # --- # name: test_conditional_entrypoint_to_multiple_state_graph @@ -258,7 +258,7 @@ get_weather --> __end__; __start__ -.-> get_weather; __start__ -.-> __end__; - + ''' # --- # name: test_conditional_graph[mongodb] @@ -339,7 +339,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[mongodb].2 @@ -359,7 +359,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_graph[mongodb].3 @@ -440,7 +440,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_graph[mongodb].5 @@ -533,7 +533,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_conditional_state_graph[mongodb] @@ -615,7 +615,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  exit  .-> __end__; - + ''' # --- # name: test_conditional_state_graph_with_list_edge_inputs @@ -687,7 +687,7 @@ B --> __end__; __start__ --> A; __start__ --> B; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge[mongodb] @@ -700,7 +700,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query --> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic1[mongodb] @@ -713,7 +713,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic1[mongodb].1 @@ -783,7 +783,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[mongodb].1 @@ -853,7 +853,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_message_graph[mongodb] @@ -934,7 +934,7 @@ tools --> agent; agent -.  continue  .-> tools; agent -.  end  .-> __end__; - + ''' # --- # name: test_multiple_sinks_subgraphs @@ -957,7 +957,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_nested_graph @@ -966,7 +966,7 @@ __start__ --> inner; inner --> side; side --> __end__; - + ''' # --- # name: test_nested_graph.1 @@ -983,7 +983,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_nested_graph_xray @@ -1138,7 +1138,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_prebuilt_tool_chat @@ -1218,7 +1218,7 @@ tools --> agent; agent -.-> tools; agent -.-> __end__; - + ''' # --- # name: test_repeat_condition @@ -1234,7 +1234,7 @@ Call_Tool -.-> Researcher; Call_Tool -.-> Chart_Generator; Researcher -.  redo  .-> Researcher; - + ''' # --- # name: test_send_react_interrupt_control[mongodb] @@ -1249,7 +1249,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_simple_multi_edge @@ -1261,7 +1261,7 @@ up --> down; up --> other; up --> side; - + ''' # --- # name: test_start_branch_then[mongodb] @@ -1279,7 +1279,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_state_graph_w_config_inherited_state_keys @@ -1313,7 +1313,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_bool @@ -1349,7 +1349,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_issue @@ -1376,7 +1376,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_xray_lance diff --git a/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel_async.ambr b/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel_async.ambr index 83172f1..3c8b7f8 100644 --- a/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel_async.ambr +++ b/libs/langgraph-checkpoint-mongodb/tests/integration_tests/__snapshots__/test_pregel_async.ambr @@ -9,7 +9,7 @@ retriever_two --> qa; rewrite_query --> analyzer_one; rewrite_query -.-> retriever_two; - + ''' # --- # name: test_in_one_fan_out_state_graph_waiting_edge_custom_state_class_pydantic2[mongodb_aio].1 @@ -132,7 +132,7 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # --- # name: test_weather_subgraph[mongodb_aio] @@ -157,6 +157,6 @@ classDef default fill:#f2f0ff,line-height:1.2 classDef first fill-opacity:0 classDef last fill:#bfb6fc - + ''' # ---