From b830cac9c6ca8e90ed17855cdf1f69098b78ea1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 09:16:55 -0700 Subject: [PATCH 1/9] chore(deps): bump jinja2 from 3.1.3 to 3.1.4 in /.kokoro (#46) Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/3.1.3...3.1.4) --- updated-dependencies: - dependency-name: jinja2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .kokoro/requirements.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index c2ce28d..1b2d154 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -273,10 +273,12 @@ jaraco-classes==3.3.1 \ jeepney==0.8.0 \ --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 - # via secretstorage -jinja2==3.1.3 \ - --hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \ - --hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90 + # via + # keyring + # secretstorage +jinja2==3.1.4 \ + --hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \ + --hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d # via gcp-releasetool keyring==24.3.1 \ --hash=sha256:c3327b6ffafc0e8befbdb597cacdb4928ffe5c1212f7645f186e6d9957a898db \ @@ -479,7 +481,9 @@ rsa==4.9 \ secretstorage==3.3.3 \ --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via -r requirements.in + # via + # -r requirements.in + # keyring six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 From 04a4d85910c1b6b49c13a72433dfcbe7e087f45d Mon Sep 17 00:00:00 2001 From: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> Date: Thu, 16 May 2024 12:36:46 -0400 Subject: [PATCH 2/9] ci: Add code coverage check (#47) * ci: Add code coverage check * change dir name * increase cc to 90 * typo --- .coveragerc | 8 ++++++++ DEVELOPER.md | 14 +++++++++++++- integration.cloudbuild.yaml | 2 +- pyproject.toml | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..2c634d5 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,8 @@ +[run] +branch = true +omit = + */__init__.py + +[report] +show_missing = true +fail_under = 90 \ No newline at end of file diff --git a/DEVELOPER.md b/DEVELOPER.md index cc958c3..c1d95df 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -58,7 +58,7 @@ substitutions: _VERSION: "3.8" ``` -Use `gcloud builds triggers import --source=trigger.yaml` create triggers via the command line +Use `gcloud builds triggers import --source=trigger.yaml` to create triggers via the command line #### Project Setup @@ -77,5 +77,17 @@ Use `gcloud builds triggers import --source=trigger.yaml` create triggers via th To run Cloud Build tests on GitHub from external contributors, ie RenovateBot, comment: `/gcbrun`. +#### Code Coverage +Please make sure your code is fully tested. The Cloud Build integration tests are run with the `pytest-cov` code coverage plugin. They fail for PRs with a code coverage less than the threshold specified in `.coveragerc`. If your file is inside the main module and should be ignored by code coverage check, add it to the `omit` section of `.coveragerc`. + +Check for code coverage report in any Cloud Build integration test log. +Here is a breakdown of the report: +- `Stmts`: lines of executable code (statements). +- `Miss`: number of lines not covered by tests. +- `Branch`: branches of executable code (e.g an if-else clause may count as 1 statement but 2 branches; test for both conditions to have both branches covered). +- `BrPart`: number of branches not covered by tests. +- `Cover`: average coverage of files. +- `Missing`: lines that are not covered by tests. + [triggers]: https://console.cloud.google.com/cloud-build/triggers?e=13802955&project=langchain-cloud-sql-testing \ No newline at end of file diff --git a/integration.cloudbuild.yaml b/integration.cloudbuild.yaml index 8f37d32..a46e34d 100644 --- a/integration.cloudbuild.yaml +++ b/integration.cloudbuild.yaml @@ -26,7 +26,7 @@ steps: - id: Run integration tests name: python:${_VERSION} entrypoint: python - args: ["-m", "pytest"] + args: ["-m", "pytest", "--cov=langchain_google_cloud_sql_mssql", "--cov-config=.coveragerc", "tests/"] env: - "PROJECT_ID=$PROJECT_ID" - "INSTANCE_ID=$_INSTANCE_ID" diff --git a/pyproject.toml b/pyproject.toml index 505384b..5e262c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,8 @@ test = [ "langchain==0.1.12", "mypy==1.9.0", "pytest-asyncio==0.23.5.post1", - "pytest==7.4.4" + "pytest==7.4.4", + "pytest-cov==5.0.0" ] [build-system] From ee426daa66ced8bef834960cbec448518c931395 Mon Sep 17 00:00:00 2001 From: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> Date: Mon, 20 May 2024 16:43:58 -0400 Subject: [PATCH 3/9] ci: Add blunderbuss config (#48) Co-authored-by: Averi Kitsch --- .github/blunderbuss.yml | 4 ++++ .github/header-checker-lint.yml | 1 + 2 files changed, 5 insertions(+) create mode 100644 .github/blunderbuss.yml diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 0000000..21e15f8 --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,4 @@ +assign_issues: + - googleapis/langchain-csql-mssql +assign_prs: + - googleapis/langchain-csql-mssql diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml index 53c9c5c..5a21e5f 100644 --- a/.github/header-checker-lint.yml +++ b/.github/header-checker-lint.yml @@ -11,6 +11,7 @@ sourceFileExtensions: - "py" - "text" ignoreFiles: + - ".github/blunderbuss.yml" - ".github/release-please.yml" - ".github/release-trigger.yml" - ".github/header-checker-lint.yml" From a969dadd80e8ce3eba98773fbf227d48860306f1 Mon Sep 17 00:00:00 2001 From: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> Date: Mon, 20 May 2024 19:33:19 -0400 Subject: [PATCH 4/9] ci: Add mypy function type check (#49) Co-authored-by: Averi Kitsch --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5e262c9..3f7b3be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ profile = "black" [tool.mypy] python_version = "3.11" warn_unused_configs = true +disallow_incomplete_defs = true exclude = [ 'docs/*', From de434303b95f4034e2b5ced722bafc389b892401 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 12:57:30 -0700 Subject: [PATCH 5/9] chore(deps): bump requests from 2.31.0 to 2.32.0 in /.kokoro (#50) --- updated-dependencies: - dependency-name: requests dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .kokoro/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 1b2d154..7eb2ec2 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -453,9 +453,9 @@ readme-renderer==42.0 \ --hash=sha256:13d039515c1f24de668e2c93f2e877b9dbe6c6c32328b90a40a49d8b2b85f36d \ --hash=sha256:2d55489f83be4992fe4454939d1a051c33edbab778e82761d060c9fc6b308cd1 # via twine -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 +requests==2.32.0 \ + --hash=sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5 \ + --hash=sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8 # via # gcp-releasetool # google-api-core From 4fedf3745165b84c50d34f66528064ddec5e3eb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:23:26 -0700 Subject: [PATCH 6/9] chore(deps): bump urllib3 from 2.2.1 to 2.2.2 in /.kokoro (#54) Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2) --- updated-dependencies: - dependency-name: urllib3 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .kokoro/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 7eb2ec2..ad774a6 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -502,9 +502,9 @@ typing-extensions==4.10.0 \ --hash=sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475 \ --hash=sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb # via -r requirements.in -urllib3==2.2.1 \ - --hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \ - --hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19 +urllib3==2.2.2 \ + --hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \ + --hash=sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168 # via # requests # twine From 00b5011d0bb1511ff292932f39f2c1621fe1b96d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 20 Jun 2024 20:35:32 +0200 Subject: [PATCH 7/9] chore(deps): update python-nonmajor (#53) * chore(deps): update python-nonmajor * Update requirements.txt --------- Co-authored-by: Averi Kitsch --- pyproject.toml | 6 +++--- requirements.txt | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3f7b3be..222d76d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,9 +40,9 @@ Changelog = "https://github.com/googleapis/langchain-google-cloud-sql-mssql-pyth test = [ "black[jupyter]==23.12.1", "isort==5.13.2", - "langchain==0.1.12", - "mypy==1.9.0", - "pytest-asyncio==0.23.5.post1", + "langchain==0.2.5", + "mypy==1.10.0", + "pytest-asyncio==0.23.7", "pytest==7.4.4", "pytest-cov==5.0.0" ] diff --git a/requirements.txt b/requirements.txt index 8fb218d..0ad100d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -langchain-core==0.1.35 -langchain-community==0.0.28 -SQLAlchemy==2.0.28 +langchain-core==0.2.7 +langchain-community==0.2.5 +SQLAlchemy==2.0.30 sqlalchemy-pytds==1.0.0 -cloud-sql-python-connector[pytds]==1.8.0 +cloud-sql-python-connector[pytds]==1.10.0 From 0c29445be6680cd45b4c796a1f3254552131f15c Mon Sep 17 00:00:00 2001 From: Jack Wotherspoon Date: Wed, 26 Jun 2024 16:19:12 -0400 Subject: [PATCH 8/9] fix: use lazy refresh for Cloud SQL Connector (#55) --- pyproject.toml | 2 +- src/langchain_google_cloud_sql_mssql/engine.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 222d76d..88420b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ "langchain-community>=0.0.18, <1.0.0", "SQLAlchemy>=2.0.7, <3.0.0", "sqlalchemy-pytds>=1.0.0, <2.0.0", - "cloud-sql-python-connector[pytds]>=1.7.0, <2.0.0" + "cloud-sql-python-connector[pytds]>=1.10.0, <2.0.0" ] classifiers = [ "Intended Audience :: Developers", diff --git a/src/langchain_google_cloud_sql_mssql/engine.py b/src/langchain_google_cloud_sql_mssql/engine.py index 875d9eb..1dc7feb 100644 --- a/src/langchain_google_cloud_sql_mssql/engine.py +++ b/src/langchain_google_cloud_sql_mssql/engine.py @@ -18,7 +18,7 @@ from typing import List, Optional import sqlalchemy -from google.cloud.sql.connector import Connector +from google.cloud.sql.connector import Connector, RefreshStrategy from .version import __version__ @@ -96,7 +96,9 @@ def _create_connector_engine( Python Connector. """ if cls._connector is None: - cls._connector = Connector(user_agent=USER_AGENT) + cls._connector = Connector( + user_agent=USER_AGENT, refresh_strategy=RefreshStrategy.LAZY + ) # anonymous function to be used for SQLAlchemy 'creator' argument def getconn(): From bece33fb8d04a982099b5f4b5bf5754abd8204e3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:19:32 -0700 Subject: [PATCH 9/9] chore(main): release 0.2.1 (#56) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ src/langchain_google_cloud_sql_mssql/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ba473..b89ee48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.2.1](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/compare/v0.2.0...v0.2.1) (2024-06-26) + + +### Bug Fixes + +* Use lazy refresh for Cloud SQL Connector ([#55](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/issues/55)) ([0c29445](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/commit/0c29445be6680cd45b4c796a1f3254552131f15c)) + ## [0.2.0](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/compare/v0.1.0...v0.2.0) (2024-05-01) diff --git a/src/langchain_google_cloud_sql_mssql/version.py b/src/langchain_google_cloud_sql_mssql/version.py index 20c5861..fffa9d9 100644 --- a/src/langchain_google_cloud_sql_mssql/version.py +++ b/src/langchain_google_cloud_sql_mssql/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.2.0" +__version__ = "0.2.1"