From 3339a057697645b3568fb2c75a6af8cca47bb14f Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:12:05 +0000 Subject: [PATCH 01/29] updating tests to support all db types --- .github/workflows/testing.yml | 97 +- coverage.xml | 3078 ++++++++--------- .../database_config.py | 27 + report.xml | 2 +- 4 files changed, 1637 insertions(+), 1567 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2775f0cd..41b2eaa2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,49 +6,92 @@ on: jobs: build: - env: - USING_COVERAGE: "3.12" - DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" runs-on: ubuntu-latest + strategy: + max-parallel: 10 + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.13","3.12","3.11","3.10","3.9"] + db: [sqlite, postgres, mysql, mssql, oracle] services: - postgresdbTest: + postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres + POSTGRES_DB: test ports: - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - strategy: - max-parallel: 10 - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.13","3.12","3.11", "3.10", "3.9"] + options: >- + --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mysql: + if: matrix.db == 'mysql' + image: mysql:8 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: test + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 + mssql: + if: matrix.db == 'mssql' + image: mcr.microsoft.com/mssql/server:2019-latest + env: + SA_PASSWORD: "Your_password123" + ACCEPT_EULA: "Y" + ports: + - 1433:1433 + options: >- + --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 + oracle: + if: matrix.db == 'oracle' + image: wnameless/oracle-xe-11g:latest + ports: + - 1521:1521 + env: + ORACLE_ALLOW_REMOTE: "true" + options: >- + --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s system/oracle@localhost:1521/XE" + --health-interval 10s --health-timeout 5s --health-retries 10 + env: + SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" + MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + steps: - uses: actions/checkout@v4 - - name: Wait for PostgreSQL to become ready + - name: Wait for database + if: matrix.db != 'sqlite' run: | for i in {1..30}; do - pg_isready -h localhost -p 5432 && echo Success && exit 0 - echo -n . - sleep 2 + case "${{ matrix.db }}" in + postgres) pg_isready -h localhost -p 5432 && break;; + mysql) mysqladmin ping -h localhost -u root -proot && break;; + mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break;; + oracle) echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break;; + esac + echo -n .; sleep 2 done - echo Failed waiting for Postgres && exit 1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Clear pip cache - run: pip cache purge - - name: Install dependencies - run: pip install --no-cache-dir -r requirements.txt - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # pip install -r requirements.txt --use-deprecated=legacy-resolver - - name: Test with pytest run: | - pip install pytest - pytest + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Export DATABASE_URL + run: | + case ${{ matrix.db }} in + sqlite) echo "DATABASE_URL=$SQLITE_URL" >> $GITHUB_ENV;; + postgres) echo "DATABASE_URL=$POSTGRES_URL" >> $GITHUB_ENV;; + mysql) echo "DATABASE_URL=$MYSQL_URL" >> $GITHUB_ENV;; + mssql) echo "DATABASE_URL=$MSSQL_URL" >> $GITHUB_ENV;; + oracle) echo "DATABASE_URL=$ORACLE_URL" >> $GITHUB_ENV;; + esac + - name: Test with pytest + run: pytest -q diff --git a/coverage.xml b/coverage.xml index 5ef22829..79dfb10d 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -68,15 +68,15 @@ - - + + - - - - - - + + + + + + @@ -123,7 +123,7 @@ - + @@ -134,27 +134,27 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + @@ -169,22 +169,22 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -193,264 +193,264 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -461,43 +461,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -516,7 +516,7 @@ - + @@ -530,184 +530,184 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -719,65 +719,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -787,7 +787,7 @@ - + @@ -799,50 +799,50 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -856,68 +856,68 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -929,7 +929,7 @@ - + @@ -939,22 +939,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -962,8 +962,8 @@ - - + + @@ -979,7 +979,7 @@ - + @@ -1001,33 +1001,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1639,7 +1639,7 @@ - + @@ -1701,117 +1701,117 @@ - + - - - - - - - - - + + + + + + + + + - + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - - + + + + - - - - + + + + - - + + - - - + + + - - + + - - - + + + - + @@ -1820,22 +1820,22 @@ - - - + + + - - + + - - - + + + - + @@ -1843,40 +1843,40 @@ - - + + - - + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - + - + @@ -1885,38 +1885,38 @@ - - - - + + + + - - + + - - - - + + + + - - + + - - - - + + + + - - - + + + - + @@ -1924,21 +1924,21 @@ - - - - + + + + - - - - - + + + + + - + @@ -1948,58 +1948,58 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - + @@ -2009,44 +2009,44 @@ - - - + + + - + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -2056,24 +2056,24 @@ - - + + - + - - + + - - + + - - + + - + @@ -2087,45 +2087,45 @@ - - + + - - - + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - + + + - + @@ -2134,54 +2134,54 @@ - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - + @@ -2189,28 +2189,28 @@ - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - + @@ -2220,43 +2220,43 @@ - - - + + + - + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - + - + @@ -2270,79 +2270,79 @@ - - - - - - - - - + + + + + + + + + - + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - + @@ -2355,24 +2355,24 @@ - - - - - + + + + + - + - - - - + + + + - - + + - + @@ -2384,51 +2384,51 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - + @@ -2439,26 +2439,26 @@ - - + + - + - - - + + + - - - + + + - - - - + + + + - + @@ -2471,34 +2471,34 @@ - - - + + + - + - - + + - - + + - - - - - + + + + + - + - + @@ -2521,493 +2521,493 @@ - - + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - - + + - - - - - - + + + + + + - + @@ -3023,31 +3023,31 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + @@ -3055,34 +3055,34 @@ - - - - + + + + - - - + + + - - - - + + + + - - - + + + - + - + @@ -3094,45 +3094,45 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - + + + - - - + + + - - - + + + - - - + + + - + @@ -3146,27 +3146,27 @@ - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + diff --git a/dsg_lib/async_database_functions/database_config.py b/dsg_lib/async_database_functions/database_config.py index 3eacf072..670db051 100644 --- a/dsg_lib/async_database_functions/database_config.py +++ b/dsg_lib/async_database_functions/database_config.py @@ -131,6 +131,33 @@ class DBConfig: "pool_recycle", "pool_timeout", }, + "mysql": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "mssql": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "oracle": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, # Add other engines here... } diff --git a/report.xml b/report.xml index 505cf43f..4aa511b8 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 701229483ac27aaa8d48f82275d618c53ff650af Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:15:31 +0000 Subject: [PATCH 02/29] fixing setup --- .github/workflows/testing.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 41b2eaa2..d3784f93 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,6 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -26,7 +25,6 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -36,7 +34,6 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -46,7 +43,6 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - if: matrix.db == 'oracle' image: wnameless/oracle-xe-11g:latest ports: - 1521:1521 From 0821c5ee2da4dfa7f9c7e45b07299398e4ef1322 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:45:23 +0000 Subject: [PATCH 03/29] updating docker file --- .devcontainer/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 119ae183..c5411e59 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,3 +1,4 @@ +# .devcontainer docker-compose configuration version: '3.8' services: From 014f96354af42629603d97ca82fb8a1ea27ddd76 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:39:39 +0000 Subject: [PATCH 04/29] run of local docs --- CHANGELOG.md | 19 +++++++++++++++++++ docs/release-notes.md | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f78c94c..028ed468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Latest Changes +### Improving SQLAlchemy Queries and Improved Documentation ([v2025.4.17.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.17.1)) + +![DSG Logo](https://raw.githubusercontent.com/devsetgo/devsetgo_lib/refs/heads/main/images/devsetgo_lib_logo_white_bg.svg) +Read the Full Documentation [here](https://devsetgo.github.io/devsetgo_lib/). +#### What's Changed +* fixing sonar issue (#494) @devsetgo +* updating release drafter (#493) @devsetgo +* Improving Examples (#492) @devsetgo +* Fix of issue with distinct queries in read queries (#491) @devsetgo +* updating footer (#490) @devsetgo +* adding raw link to release drafter (#489) @devsetgo +* Improving documentation (#488) @devsetgo +* adding 3.13 testing (#486) @devsetgo + +Built to help reduce copy/paste from multiple projects and uses calendar versioning (year.month.day.build) from [BumpCalver](https://github.com/devsetgo/bumpcalver). + + +Published Date: 2025 April 17, 15:47 + ### New Functions and Updated Documentation ([v2025.4.5.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.5.1)) #### What's Changed diff --git a/docs/release-notes.md b/docs/release-notes.md index 5f78c94c..028ed468 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Latest Changes +### Improving SQLAlchemy Queries and Improved Documentation ([v2025.4.17.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.17.1)) + +![DSG Logo](https://raw.githubusercontent.com/devsetgo/devsetgo_lib/refs/heads/main/images/devsetgo_lib_logo_white_bg.svg) +Read the Full Documentation [here](https://devsetgo.github.io/devsetgo_lib/). +#### What's Changed +* fixing sonar issue (#494) @devsetgo +* updating release drafter (#493) @devsetgo +* Improving Examples (#492) @devsetgo +* Fix of issue with distinct queries in read queries (#491) @devsetgo +* updating footer (#490) @devsetgo +* adding raw link to release drafter (#489) @devsetgo +* Improving documentation (#488) @devsetgo +* adding 3.13 testing (#486) @devsetgo + +Built to help reduce copy/paste from multiple projects and uses calendar versioning (year.month.day.build) from [BumpCalver](https://github.com/devsetgo/bumpcalver). + + +Published Date: 2025 April 17, 15:47 + ### New Functions and Updated Documentation ([v2025.4.5.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.5.1)) #### What's Changed From 5db2d0ac1808c0113bf6e84e41bb59aa419ea2ca Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:40:05 +0000 Subject: [PATCH 05/29] updating database config documentation and configuration --- docs/database/database_configuration.md | 11 +++++++++++ .../async_database_functions/database_config.py | 15 ++++++++++++--- pyproject.toml | 4 +++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/database/database_configuration.md b/docs/database/database_configuration.md index a673860f..14831850 100644 --- a/docs/database/database_configuration.md +++ b/docs/database/database_configuration.md @@ -1,4 +1,15 @@ # Reference +## Supported Databases + +| Database | Library (with link) | Supported Database Versions (via library) | +|---------------|-------------------------------------------------------------------------------------|-----------------------------------------------| +| PostgreSQL | [asyncpg](https://pypi.org/project/asyncpg/) `>=0.21.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | asyncpg supports PostgreSQL 9.2+ | +| SQLite | [aiosqlite](https://pypi.org/project/aiosqlite/) `>=0.17.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | SQLite 3.x | +| Oracle | [oracledb](https://pypi.org/project/oracledb/) `>=2.4.1,<2.5.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | Oracle Database 11.2+ | +| MS SQL Server | [aioodbc](https://pypi.org/project/aioodbc/) `>=0.4.1`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | SQL Server 2008+ (via ODBC driver) | +| CockroachDB | [sqlalchemy-cockroachdb](https://pypi.org/project/sqlalchemy-cockroachdb/) `<2.0.2`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99`
[asyncpg](https://pypi.org/project/asyncpg/) `>=0.21.0` | CockroachDB v19.2+ | +| MySQL | [asyncmy](https://pypi.org/project/asyncmy/) `>=0.2.10`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | MySQL 5.7+, MariaDB 10.2+ | + ::: dsg_lib.async_database_functions.database_config handler: python diff --git a/dsg_lib/async_database_functions/database_config.py b/dsg_lib/async_database_functions/database_config.py index 670db051..c919dadd 100644 --- a/dsg_lib/async_database_functions/database_config.py +++ b/dsg_lib/async_database_functions/database_config.py @@ -131,7 +131,7 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "mysql": { # experimental + "cockroachdb": { # experimental support for CockroachDB "echo", "future", "pool_pre_ping", @@ -140,7 +140,7 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "mssql": { # experimental + "mysql": { # experimental support for MySQL "echo", "future", "pool_pre_ping", @@ -149,7 +149,16 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "oracle": { # experimental + "mssql": { # experimental support for Microsoft SQL Server + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "oracle": { # experimental support for Oracle "echo", "future", "pool_pre_ping", diff --git a/pyproject.toml b/pyproject.toml index 544fb97f..85dc0bef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,10 @@ postgres = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99",] sqlite = [ "aiosqlite>=0.17.0", "sqlalchemy>=2.0.10,<2.0.99",] oracle = [ "oracledb>=2.4.1,<2.5.0", "sqlalchemy>=2.0.10,<2.0.99",] mssql = [ "aioodbc>=0.4.1", "sqlalchemy>=2.0.10,<2.0.99",] +cockroachdb = [ "sqlalchemy-cockroachdb<2.0.2", "sqlalchemy>=2.0.10,<2.0.99", "asyncpg>=0.21.0",] +mysql = [ "asyncmy>=0.2.10", "sqlalchemy>=2.0.10,<2.0.99",] fastapi = [ "fastapi>=0.100.0", "pydantic[email]>=2.0",] -all = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99", "aiosqlite>=0.17.0", "oracledb>=2.4.1,<2.5.0", "fastapi>=0.100.0", "pydantic[email]>=2.0", "aioodbc>=0.4.1",] +all = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99", "aiosqlite>=0.17.0", "oracledb>=2.4.1,<2.5.0", "fastapi>=0.100.0", "pydantic[email]>=2.0", "aioodbc>=0.4.1", "sqlalchemy-cockroachdb<2.0.0", "asyncmy>=0.2.10",] [project.scripts] From 918e9e81db68b08df5fc6d6d0060ea32d3e97140 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:40:17 +0000 Subject: [PATCH 06/29] formatting --- coverage.xml | 38 +++++++++++++++++++------------------- report.xml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/coverage.xml b/coverage.xml index 79dfb10d..2ec5a7e8 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -134,24 +134,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/report.xml b/report.xml index 4aa511b8..8b25e30c 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From dccc360183155428b6573c21a4b01dc83e5c9ca9 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:43:11 +0000 Subject: [PATCH 07/29] changing oracle db image --- .github/workflows/testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d3784f93..41459093 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -43,13 +43,13 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - image: wnameless/oracle-xe-11g:latest + image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 env: - ORACLE_ALLOW_REMOTE: "true" + ORACLE_PWD: "oracle" options: >- - --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s system/oracle@localhost:1521/XE" + --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 env: SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" From 6dba631358c183ca2e5f666d0b2d28c60ba3c5b8 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:49:33 +0000 Subject: [PATCH 08/29] working on db test setup --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 41459093..769fc9e0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest strategy: - max-parallel: 10 + max-parallel: 2 matrix: os: [ubuntu-latest, windows-latest] python-version: ["3.13","3.12","3.11","3.10","3.9"] From 4037578b6808949d8e21e8d6ad075f267d7d5343 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:54:35 +0000 Subject: [PATCH 09/29] working mssql to get it working --- .github/workflows/testing.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 769fc9e0..2ec856ad 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,6 +15,7 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -25,6 +26,7 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: + if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -34,6 +36,7 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: + if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -43,6 +46,7 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: + if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 From 25b7289d20a0ea61916060a946240f870a0b2148 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:00:03 +0000 Subject: [PATCH 10/29] working on issue for running db tests --- .github/workflows/testing.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2ec856ad..769fc9e0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,6 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -26,7 +25,6 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -36,7 +34,6 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -46,7 +43,6 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 From 17a12037230affcf4fabdea10b89d2c3d75b4e32 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:05:58 +0000 Subject: [PATCH 11/29] working on issues with testing the matrix --- .github/workflows/testing.yml | 96 +++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 769fc9e0..75b52d4d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,11 +10,92 @@ jobs: strategy: max-parallel: 2 matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.13","3.12","3.11","3.10","3.9"] - db: [sqlite, postgres, mysql, mssql, oracle] + include: + - os: ubuntu-latest + python-version: "3.13" + db: sqlite + - os: ubuntu-latest + python-version: "3.13" + db: postgres + - os: ubuntu-latest + python-version: "3.13" + db: mysql + - os: ubuntu-latest + python-version: "3.13" + db: mssql + - os: ubuntu-latest + python-version: "3.13" + db: oracle + - os: ubuntu-latest + python-version: "3.12" + db: sqlite + - os: ubuntu-latest + python-version: "3.12" + db: postgres + - os: ubuntu-latest + python-version: "3.12" + db: mysql + - os: ubuntu-latest + python-version: "3.12" + db: mssql + - os: ubuntu-latest + python-version: "3.12" + db: oracle + - os: ubuntu-latest + python-version: "3.11" + db: sqlite + - os: ubuntu-latest + python-version: "3.11" + db: postgres + - os: ubuntu-latest + python-version: "3.11" + db: mysql + - os: ubuntu-latest + python-version: "3.11" + db: mssql + - os: ubuntu-latest + python-version: "3.11" + db: oracle + - os: ubuntu-latest + python-version: "3.10" + db: sqlite + - os: ubuntu-latest + python-version: "3.10" + db: postgres + - os: ubuntu-latest + python-version: "3.10" + db: mysql + - os: ubuntu-latest + python-version: "3.10" + db: mssql + - os: ubuntu-latest + python-version: "3.10" + db: oracle + - os: ubuntu-latest + python-version: "3.9" + db: sqlite + - os: ubuntu-latest + python-version: "3.9" + db: postgres + - os: ubuntu-latest + python-version: "3.9" + db: mysql + - os: ubuntu-latest + python-version: "3.9" + db: mssql + - os: ubuntu-latest + python-version: "3.9" + db: oracle + env: + SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" + MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + services: postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -25,6 +106,7 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: + if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -34,6 +116,7 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: + if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -43,6 +126,7 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: + if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 @@ -51,12 +135,6 @@ jobs: options: >- --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 - env: - SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" - MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" steps: - uses: actions/checkout@v4 From 01d694aee9fc918680987a100fff617f07f76594 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:08:06 +0000 Subject: [PATCH 12/29] working on test setup --- .github/workflows/testing.yml | 208 +++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 75b52d4d..10556ebe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,97 +5,33 @@ on: workflow_dispatch: jobs: - build: + test-sqlite: runs-on: ubuntu-latest strategy: - max-parallel: 2 matrix: - include: - - os: ubuntu-latest - python-version: "3.13" - db: sqlite - - os: ubuntu-latest - python-version: "3.13" - db: postgres - - os: ubuntu-latest - python-version: "3.13" - db: mysql - - os: ubuntu-latest - python-version: "3.13" - db: mssql - - os: ubuntu-latest - python-version: "3.13" - db: oracle - - os: ubuntu-latest - python-version: "3.12" - db: sqlite - - os: ubuntu-latest - python-version: "3.12" - db: postgres - - os: ubuntu-latest - python-version: "3.12" - db: mysql - - os: ubuntu-latest - python-version: "3.12" - db: mssql - - os: ubuntu-latest - python-version: "3.12" - db: oracle - - os: ubuntu-latest - python-version: "3.11" - db: sqlite - - os: ubuntu-latest - python-version: "3.11" - db: postgres - - os: ubuntu-latest - python-version: "3.11" - db: mysql - - os: ubuntu-latest - python-version: "3.11" - db: mssql - - os: ubuntu-latest - python-version: "3.11" - db: oracle - - os: ubuntu-latest - python-version: "3.10" - db: sqlite - - os: ubuntu-latest - python-version: "3.10" - db: postgres - - os: ubuntu-latest - python-version: "3.10" - db: mysql - - os: ubuntu-latest - python-version: "3.10" - db: mssql - - os: ubuntu-latest - python-version: "3.10" - db: oracle - - os: ubuntu-latest - python-version: "3.9" - db: sqlite - - os: ubuntu-latest - python-version: "3.9" - db: postgres - - os: ubuntu-latest - python-version: "3.9" - db: mysql - - os: ubuntu-latest - python-version: "3.9" - db: mssql - - os: ubuntu-latest - python-version: "3.9" - db: oracle + python-version: ["3.13","3.12","3.11","3.10","3.9"] env: - SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" - MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + DATABASE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + test-postgres: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -105,8 +41,34 @@ jobs: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + env: + DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + pg_isready -h localhost -p 5432 && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-mysql: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -115,8 +77,34 @@ jobs: - 3306:3306 options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 + env: + DATABASE_URL: "mysql+aiomysql://root:root@localhost:3306/test" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + mysqladmin ping -h localhost -u root -proot && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-mssql: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -125,8 +113,34 @@ jobs: - 1433:1433 options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 + env: + DATABASE_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-oracle: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: oracle: - if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 @@ -135,19 +149,14 @@ jobs: options: >- --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 - + env: + DATABASE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" steps: - uses: actions/checkout@v4 - name: Wait for database - if: matrix.db != 'sqlite' run: | for i in {1..30}; do - case "${{ matrix.db }}" in - postgres) pg_isready -h localhost -p 5432 && break;; - mysql) mysqladmin ping -h localhost -u root -proot && break;; - mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break;; - oracle) echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break;; - esac + echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break echo -n .; sleep 2 done - name: Set up Python ${{ matrix.python-version }} @@ -158,14 +167,5 @@ jobs: run: | pip install --no-cache-dir -r requirements.txt pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Export DATABASE_URL - run: | - case ${{ matrix.db }} in - sqlite) echo "DATABASE_URL=$SQLITE_URL" >> $GITHUB_ENV;; - postgres) echo "DATABASE_URL=$POSTGRES_URL" >> $GITHUB_ENV;; - mysql) echo "DATABASE_URL=$MYSQL_URL" >> $GITHUB_ENV;; - mssql) echo "DATABASE_URL=$MSSQL_URL" >> $GITHUB_ENV;; - oracle) echo "DATABASE_URL=$ORACLE_URL" >> $GITHUB_ENV;; - esac - name: Test with pytest run: pytest -q From cdb00d3a6f97e12a078969da331982ff2afe632c Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:22:33 +0000 Subject: [PATCH 13/29] reverting back --- .github/workflows/testing.yml | 163 +++++----------------------------- 1 file changed, 23 insertions(+), 140 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 10556ebe..2775f0cd 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,167 +5,50 @@ on: workflow_dispatch: jobs: - test-sqlite: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] + build: env: - DATABASE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q - - test-postgres: + USING_COVERAGE: "3.12" + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] services: - postgres: + postgresdbTest: image: postgres:latest env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: test + POSTGRES_DB: postgres ports: - 5432:5432 - options: >- - --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - env: - DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - steps: - - uses: actions/checkout@v4 - - name: Wait for database - run: | - for i in {1..30}; do - pg_isready -h localhost -p 5432 && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q - - test-mysql: - runs-on: ubuntu-latest + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 strategy: + max-parallel: 10 matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - mysql: - image: mysql:8 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: test - ports: - - 3306:3306 - options: >- - --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 - env: - DATABASE_URL: "mysql+aiomysql://root:root@localhost:3306/test" + os: [ubuntu-latest, windows-latest] + python-version: ["3.13","3.12","3.11", "3.10", "3.9"] steps: - uses: actions/checkout@v4 - - name: Wait for database + - name: Wait for PostgreSQL to become ready run: | for i in {1..30}; do - mysqladmin ping -h localhost -u root -proot && break - echo -n .; sleep 2 + pg_isready -h localhost -p 5432 && echo Success && exit 0 + echo -n . + sleep 2 done + echo Failed waiting for Postgres && exit 1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q + - name: Clear pip cache + run: pip cache purge - test-mssql: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - mssql: - image: mcr.microsoft.com/mssql/server:2019-latest - env: - SA_PASSWORD: "Your_password123" - ACCEPT_EULA: "Y" - ports: - - 1433:1433 - options: >- - --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 - env: - DATABASE_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - steps: - - uses: actions/checkout@v4 - - name: Wait for database - run: | - for i in {1..30}; do - /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb + run: pip install --no-cache-dir -r requirements.txt + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt --use-deprecated=legacy-resolver - name: Test with pytest - run: pytest -q - - test-oracle: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - oracle: - image: container-registry.oracle.com/database/free:latest - ports: - - 1521:1521 - env: - ORACLE_PWD: "oracle" - options: >- - --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" - --health-interval 10s --health-timeout 5s --health-retries 10 - env: - DATABASE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" - steps: - - uses: actions/checkout@v4 - - name: Wait for database run: | - for i in {1..30}; do - echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q + pip install pytest + pytest From 10fe5faef25e52b5f5ce94061c57e251d25ee7ab Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:29:32 +0000 Subject: [PATCH 14/29] moving test --- .../test_file_functions}/test_file_functions.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{ => test_common_functions/test_file_functions}/test_file_functions.py (100%) diff --git a/tests/test_file_functions.py b/tests/test_common_functions/test_file_functions/test_file_functions.py similarity index 100% rename from tests/test_file_functions.py rename to tests/test_common_functions/test_file_functions/test_file_functions.py From 4e7f068ac0cb804ecb6b21c7507c2a54384d550d Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:22:52 -0400 Subject: [PATCH 15/29] update --- .devcontainer/devcontainer.json | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 96acfd23..e16b30f6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -37,47 +37,16 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ // "usernamehw.errorlens", - "charliermarsh.ruff", "streetsidesoftware.code-spell-checker", "GitHub.copilot", "GitHub.copilot-chat", - "ms-vscode.cpptools-extension-pack", - "ms-vscode.cpptools", - "aaron-bond.better-comments", - "alefragnani.project-manager", - "dbaeumer.vscode-eslint", - "DavidAnson.vscode-markdownlint", - "DotJoshJohnson.xml", "donjayamanne.githistory", "ecmel.vscode-html-css", - "esbenp.prettier-vscode", - "george-alisson.html-preview-vscode", - "Gruntfuggly.todo-tree", "hnw.vscode-auto-open-markdown-preview", "kamikillerto.vscode-colorize", "mikestead.dotenv", - "ms-python.isort", - "ms-python.pylint", - "ms-python.python", - "ms-toolsai.jupyter", - "ms-toolsai.jupyter-keymap", - "ms-vscode.makefile-tools", - "njpwerner.autodocstring", "oderwat.indent-rainbow", - "peakchen90.open-html-in-browser", - "pnp.polacode", - "redhat.vscode-yaml", - "streetsidesoftware.code-spell-checker", - "waderyan.gitblame", "wayou.vscode-todo-highlight", - "wholroyd.jinja", - "wix.vscode-import-cost", - "GrapeCity.gc-excelviewer", - "supperchong.pretty-json", - "ms-azuretools.vscode-docker", - "ms-kubernetes-tools.vscode-kubernetes-tools", - "ms-vsliveshare.vsliveshare", - "ms-python.black-formatter" ] } }, From c292f1ee64874665a342ae09d762a9f553cf319a Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:21:48 +0000 Subject: [PATCH 16/29] working on log_propagate --- coverage-badge.svg | 2 +- coverage.xml | 3148 ++++++++++++++++++----------------- ex.py | 39 + examples/fastapi_example.py | 2 +- report.xml | 2 +- 5 files changed, 1634 insertions(+), 1559 deletions(-) create mode 100644 ex.py diff --git a/coverage-badge.svg b/coverage-badge.svg index 82884f80..6e694487 100644 --- a/coverage-badge.svg +++ b/coverage-badge.svg @@ -1 +1 @@ -coverage: 77.63%coverage77.63% +coverage: 76.92%coverage76.92% diff --git a/coverage.xml b/coverage.xml index 2ec5a7e8..5d5e0f5d 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,11 +1,45 @@ - + /workspaces/devsetgo_lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25,7 +59,7 @@ - + @@ -57,7 +91,7 @@ - + @@ -68,15 +102,15 @@ - - + + - - - - - - + + + + + + @@ -123,7 +157,7 @@ - + @@ -140,21 +174,21 @@ - - - + + + - - - - + + + + - + @@ -169,22 +203,22 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -193,264 +227,264 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -461,43 +495,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -516,7 +550,7 @@ - + @@ -530,184 +564,184 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -719,65 +753,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -787,7 +821,7 @@ - + @@ -799,125 +833,127 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -929,7 +965,7 @@ - + @@ -939,22 +975,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -962,8 +998,8 @@ - - + + @@ -979,7 +1015,7 @@ - + @@ -1001,33 +1037,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1639,7 +1675,7 @@ - + @@ -1701,117 +1737,101 @@ - - - - - - - - - - - - - - - - - + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - - + + + + - - - - + + + + - - + + - - - + + + - - + + - - - + + + - + @@ -1820,22 +1840,22 @@ - - - - - - - + + + + + + - - - - - + + + + + + - + @@ -1843,40 +1863,40 @@ - - + + - - + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - + - + @@ -1885,38 +1905,38 @@ - - - - + + + + - - + + - - - - + + + + - - + + - - - - + + + + - - - + + + - + @@ -1924,21 +1944,37 @@ - - - - + + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + @@ -1948,58 +1984,58 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - + @@ -2009,44 +2045,44 @@ - - - + + + - + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -2056,24 +2092,24 @@ - - + + - + - - + + - - + + - - + + - + @@ -2087,45 +2123,45 @@ - - + + - - - + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - + + + - + @@ -2134,54 +2170,54 @@ - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - + @@ -2189,28 +2225,28 @@ - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - + @@ -2220,43 +2256,43 @@ - - - + + + - + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - + - + @@ -2270,79 +2306,79 @@ - - - - - - - - - + + + + + + + + + - + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - + @@ -2355,80 +2391,80 @@ - - - - - + + + + + - + - - - - + + + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - + @@ -2439,26 +2475,26 @@ - - + + - + - - - + + + - - - + + + - - - - + + + + - + @@ -2471,34 +2507,34 @@ - - - + + + - + - - + + - - + + - - - - - + + + + + - + - + @@ -2521,493 +2557,493 @@ - - + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - - + + - - - - - - + + + + + + - + @@ -3023,31 +3059,31 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + @@ -3055,34 +3091,34 @@ - - - - + + + + - - - + + + - - - - + + + + - - - + + + - + - + @@ -3094,45 +3130,45 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - + + + - - - + + + - - - + + + - - - + + + - + @@ -3146,27 +3182,27 @@ - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + diff --git a/ex.py b/ex.py new file mode 100644 index 00000000..6ebda078 --- /dev/null +++ b/ex.py @@ -0,0 +1,39 @@ +from fastapi import FastAPI, Request +from fastapi.responses import HTMLResponse, JSONResponse +from pydantic import BaseModel, Field +from PySchemaForms.form import FormConfig, FormBuilder + +app = FastAPI() + +# Define a simple Pydantic model for the form +class SimpleForm(BaseModel): + name: str = Field(..., title="Your Name") + age: int = Field(..., title="Your Age") + +# Configure the form +form_config = FormConfig( + post_url="/submit", + theme="bootstrap5", + form_title="Simple Example Form" +) +form_builder = FormBuilder(SimpleForm, form_config) + +@app.get("/", response_class=HTMLResponse) +async def show_form(): + html = form_builder.render_html() + return HTMLResponse(content=html) + +@app.post("/submit") +async def submit_form(request: Request): + data = await request.json() + try: + form = SimpleForm(**data) + # Here you could process/store the form data + return JSONResponse({"message": "Success", "data": form.dict()}) + except Exception as e: + return JSONResponse({"error": str(e)}, status_code=400) + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="127.0.0.1", port=5000) +# To run the example, save this code in a file named `example.py` and run it using: diff --git a/examples/fastapi_example.py b/examples/fastapi_example.py index a839b161..9edf034b 100644 --- a/examples/fastapi_example.py +++ b/examples/fastapi_example.py @@ -105,7 +105,7 @@ log_serializer=False, logging_directory="log", log_name="log.log", - intercept_standard_logging=False, + intercept_standard_logging=True, ) # Create a DBConfig instance config = { diff --git a/report.xml b/report.xml index 8b25e30c..24d10691 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 34bb68133f2ff606f7de074d24a2de5002738430 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:23:34 +0000 Subject: [PATCH 17/29] Enhance logging configuration with log_propagate option - Added the log_propagate parameter to the config_log function, allowing users to control whether log messages propagate to ancestor loggers. - Updated the module and function docstrings to document the new log_propagate option and its default value (False). - Modified the logging configuration logic to set the propagate attribute on all managed loggers according to the log_propagate argument, helping prevent duplicate log lines when intercepting standard logging. - Updated usage examples in the documentation to include log_propagate. - Ensured all unit tests and test calls to config_log explicitly pass the log_propagate argument for clarity and coverage. - This change improves flexibility and prevents duplicate log entries when integrating loguru with standard Python logging. --- dsg_lib/common_functions/logging_config.py | 44 +++++++++++-------- .../test_logging_config.py | 7 +-- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/dsg_lib/common_functions/logging_config.py b/dsg_lib/common_functions/logging_config.py index 4d67e1f9..980bfd77 100644 --- a/dsg_lib/common_functions/logging_config.py +++ b/dsg_lib/common_functions/logging_config.py @@ -2,7 +2,7 @@ """ This module provides a comprehensive logging setup using the loguru library, facilitating easy logging management for Python applications. -The `config_log` function, central to this module, allows for extensive customization of logging behavior. It supports specifying the logging directory, log file name, logging level, and controls for log rotation, retention, and formatting among other features. Additionally, it offers advanced options like backtrace and diagnose for in-depth debugging, and the ability to append the application name to the log file for clearer identification. +The `config_log` function, central to this module, allows for extensive customization of logging behavior. It supports specifying the logging directory, log file name, logging level, and controls for log rotation, retention, and formatting among other features. Additionally, it offers advanced options like backtrace and diagnose for in-depth debugging, the ability to append the application name to the log file for clearer identification, and control over logger propagation via the `log_propagate` parameter. Usage example: @@ -15,6 +15,7 @@ log_rotation='100 MB', # Size threshold for log rotation log_retention='30 days', # Duration to retain old log files enqueue=True, # Enqueue log messages + log_propagate=False, # Control log propagation ) # Example log messages @@ -228,6 +229,7 @@ def config_log( append_app_name: bool = False, enqueue: bool = True, intercept_standard_logging: bool = True, + log_propagate: bool = False, compression: str = "zip", ): """ @@ -249,6 +251,7 @@ def config_log( append_app_name (bool): Whether to append the application name to the log file name. Defaults to False. enqueue (bool): Whether to enqueue log messages for asynchronous processing. Defaults to True. intercept_standard_logging (bool): Whether to intercept standard logging calls. Defaults to True. + log_propagate (bool): Whether to propagate log messages to ancestor loggers. Defaults to False. compression (str): The compression method for rotated log files (e.g., "zip"). Defaults to 'zip'. Returns: @@ -269,6 +272,7 @@ def config_log( append_app_name=True, enqueue=False, intercept_standard_logging=False, + log_propagate=False, compression='gz' ) @@ -334,7 +338,6 @@ def config_log( diagnose=log_diagnose, ) - basic_config_handlers: list = [] class InterceptHandler(logging.Handler): """ @@ -377,19 +380,24 @@ def emit(self, record): ) # pragma: no cover if intercept_standard_logging: - # Add interceptor handler to all existing loggers - for name in logging.Logger.manager.loggerDict: - logging.getLogger(name).addHandler(InterceptHandler()) - - # Add interceptor handler to the root logger - basic_config_handlers.append(InterceptHandler()) - - # Set the root logger's level to the lowest level possible - logging.getLogger().setLevel(logging.NOTSET) - - if intercept_standard_logging: - # Append an InterceptHandler instance to the handlers list if intercept_standard_logging is True - basic_config_handlers.append(InterceptHandler()) - - if len(basic_config_handlers) > 0: - logging.basicConfig(handlers=basic_config_handlers, level=logging_level.upper()) + # Remove all handlers from all loggers to prevent duplicates + for logger_name in logging.Logger.manager.loggerDict: + log_instance = logging.getLogger(logger_name) + log_instance.handlers = [] + # Optionally, set propagate to False if you want to avoid double propagation + log_instance.propagate = log_propagate + + # Remove handlers from root logger + root_logger = logging.getLogger() + root_logger.handlers = [] + + # Add InterceptHandler to all loggers (including root) + for logger_name in logging.Logger.manager.loggerDict: + logging.getLogger(logger_name).addHandler(InterceptHandler()) + root_logger.addHandler(InterceptHandler()) + + # Set the root logger's level to the lowest level possible + root_logger.setLevel(logging.NOTSET) + else: + # If not intercepting, you may want to configure basicConfig as before + logging.basicConfig(level=logging_level.upper()) diff --git a/tests/test_common_functions/test_logging_config.py b/tests/test_common_functions/test_logging_config.py index 44ecaedc..33f475e9 100644 --- a/tests/test_common_functions/test_logging_config.py +++ b/tests/test_common_functions/test_logging_config.py @@ -23,6 +23,7 @@ def test_config_log_with_valid_params(self, mock_logger): append_app_name=False, enqueue=True, intercept_standard_logging=True, + log_propagate=False, compression="zip", ) mock_logger.configure.assert_called_once() @@ -30,15 +31,15 @@ def test_config_log_with_valid_params(self, mock_logger): def test_config_log_with_invalid_level(self): with self.assertRaises(ValueError): - config_log(logging_level="INVALID") + config_log(logging_level="INVALID", log_propagate=False) # def test_config_log_with_invalid_log_name(self): # with self.assertRaises(ValueError): - # config_log(log_name="invalid_name") + # config_log(log_name="invalid_name", log_propagate=False) @patch("dsg_lib.common_functions.logging_config.logger") def test_config_log_with_app_name(self, mock_logger): - config_log(app_name="my_app", append_app_name=True) + config_log(app_name="my_app", append_app_name=True, log_propagate=False) mock_logger.configure.assert_called_once() mock_logger.add.assert_called_once() From 46825f7dd6d41b76089d94a940edb4fd6403e352 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:27:35 +0000 Subject: [PATCH 18/29] updating library versions --- requirements.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index ddbd4d13..3a1a3894 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ asyncpg==0.30.0 # Vulnerabilities: None autoflake==2.3.1 # Vulnerabilities: None autopep8==2.3.2 # Vulnerabilities: None black==25.1.0 # Vulnerabilities: None -bumpcalver==2024.12.14.1 # Vulnerabilities: None +bumpcalver==2025.4.12.1 # From 2024.12.14.1 | Vulnerabilities: None click==8.1.8 # Vulnerabilities: None fastapi[all]==0.115.12 # Vulnerabilities: None flake8==7.2.0 # Vulnerabilities: None @@ -12,33 +12,33 @@ genbadge[all]==1.1.2 # Vulnerabilities: None hatchling==1.27.0 # Vulnerabilities: None loguru==0.7.3 # Vulnerabilities: None mike==2.1.3 # Vulnerabilities: None -mkdocs-material==9.6.11 # From 9.6.9 | Vulnerabilities: None -mkdocs-print-site-plugin==2.7.2 # From 2.7.1 | Vulnerabilities: None -mkdocstrings[python,shell]==0.29.1 # From 0.29.0 | Vulnerabilities: None -oracledb==3.1.0 # From 3.0.0 | Vulnerabilities: None -packaging==24.2 # Vulnerabilities: None +mkdocs-material==9.6.12 # From 9.6.11 | Vulnerabilities: None +mkdocs-print-site-plugin==2.7.2 # Vulnerabilities: None +mkdocstrings[python,shell]==0.29.1 # Vulnerabilities: None +oracledb==3.1.0 # Vulnerabilities: None +packaging==25.0 # From 24.2 | Vulnerabilities: None pre-commit==4.2.0 # Vulnerabilities: None psycopg2==2.9.10 # Vulnerabilities: None Pygments==2.19.1 # Vulnerabilities: None -pylint==3.3.6 # Vulnerabilities: None -pymdown-extensions==10.14.3 # Vulnerabilities: None +pylint==3.3.7 # From 3.3.6 | Vulnerabilities: None +pymdown-extensions==10.15 # From 10.14.3 | Vulnerabilities: None pytest==8.3.5 # Vulnerabilities: None pytest-asyncio==0.26.0 # Vulnerabilities: None -pytest-cov==6.1.1 # From 6.0.0 | Vulnerabilities: None +pytest-cov==6.1.1 # Vulnerabilities: None pytest-html==4.1.1 # Vulnerabilities: None pytest-mock==3.14.0 # Vulnerabilities: None pytest-runner==6.0.1 # Vulnerabilities: None pytest-xdist==3.6.1 # Vulnerabilities: None python-json-logger==3.3.0 # Vulnerabilities: None PyYAML==6.0.2 # Vulnerabilities: None -ruff==0.11.4 # From 0.11.2 | Vulnerabilities: None +ruff==0.11.8 # From 0.11.4 | Vulnerabilities: None SQLAlchemy==2.0.40 # Vulnerabilities: None -structlog==25.2.0 # Vulnerabilities: None +structlog==25.3.0 # From 25.2.0 | Vulnerabilities: None toml==0.10.2 # Vulnerabilities: None tox==4.25.0 # Vulnerabilities: None tqdm==4.67.1 # Vulnerabilities: None twine==6.1.0 # Vulnerabilities: None watchdog==6.0.0 # Vulnerabilities: None -watchfiles==1.0.4 # Vulnerabilities: None +watchfiles==1.0.5 # From 1.0.4 | Vulnerabilities: None wheel==0.45.1 # Vulnerabilities: None xmltodict==0.14.2 # Vulnerabilities: None From 61b44f21db0faff66e995807b7cb968e10c3a991 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:45:11 +0000 Subject: [PATCH 19/29] Removed code block under `if __name__ == "__main__":` to exclude script execution from module and coverage; note that the same example usage code is available in examples/validate_email.py --- dsg_lib/common_functions/email_validation.py | 100 ------------------- 1 file changed, 100 deletions(-) diff --git a/dsg_lib/common_functions/email_validation.py b/dsg_lib/common_functions/email_validation.py index 29ca5301..6621702d 100644 --- a/dsg_lib/common_functions/email_validation.py +++ b/dsg_lib/common_functions/email_validation.py @@ -213,103 +213,3 @@ def validate_email_address( logger.error(f"Exception: {email} - {str(e)}") logger.debug(f"Exception: {email} - {str(e)}, - {parameters}") return email_dict - - -if __name__ == "__main__": - # create a list of email addresses to check if valid - email_addresses = [ - "bob@devsetgo.com", - "bob@devset.go", - "foo@yahoo.com", - "bob@gmail.com", - "very fake@devsetgo.com", - "jane.doe@example.com", - "john_doe@example.co.uk", - "user.name+tag+sorting@example.com", - "x@example.com", # shortest possible email address - "example-indeed@strange-example.com", - "admin@mailserver1", # local domain name with no TLD - "example@s.example", # see the list of Internet top-level domains - '" "@example.org', # space between the quotes - '"john..doe"@example.org', # quoted double dot - "mailhost!username@example.org", # bangified host route used for uucp mailers - "user%example.com@example.org", # percent sign in local part - "user-@example.org", # valid due to the last character being an allowed character - # Invalid email addresses - "Abc.example.com", # no @ character - "A@b@c@example.com", # only one @ is allowed outside quotation marks - 'a"b(c)d,e:f;gi[j\\k]l@example.com', # none of the special characters in this local part are allowed outside quotation marks - 'just"not"right@example.com', # quoted strings must be dot separated or the only element making up the local-part - 'this is"not\\allowed@example.com', # spaces, quotes, and backslashes may only exist when within quoted strings and preceded by a backslash - 'this\\ still\\"not\\\\allowed@example.com', # even if escaped (preceded by a backslash), spaces, quotes, and backslashes must still be contained by quotes - "1234567890123456789012345678901234567890123456789012345678901234+x@example.com", # local part is longer than 64 characters - # Emails with empty local part - "@example.com", # only valid if allow_empty_local is True - # Emails with non-ASCII characters - "üñîçøðé@example.com", # only valid if allow_smtputf8 is True - "user@üñîçøðé.com", # only valid if allow_smtputf8 is True - # Emails with quoted local part - '"john.doe"@example.com', # only valid if allow_quoted_local is True - '"john..doe"@example.com', # only valid if allow_quoted_local is True - # Emails with display name - "John Doe ", # only valid if allow_display_name is True - # Emails with domain literal - "user@[192.0.2.1]", # only valid if allow_domain_literal is True - # Emails with long local part - "a" * 65 + "@example.com", # local part is longer than 64 characters - # Emails with invalid characters - "john doe@example.com", # space is not allowed - "john@doe@example.com", # only one @ is allowed - "john.doe@.com", # domain can't start with a dot - "john.doe@example..com", # domain can't have two consecutive dots - "test@google.com", - ] - - # create a list of configurations - configurations = [ - { - "check_deliverability": True, - "test_environment": False, - "allow_smtputf8": False, - "allow_empty_local": False, - "allow_quoted_local": False, - "allow_display_name": False, - "allow_domain_literal": False, - "globally_deliverable": None, - "timeout": 10, - "dns_type": "timeout", - }, - { - "check_deliverability": False, - "test_environment": True, - "allow_smtputf8": True, - "allow_empty_local": True, - "allow_quoted_local": True, - "allow_display_name": True, - "allow_domain_literal": True, - "globally_deliverable": None, - "timeout": 5, - "dns_type": "dns", - }, - {"check_deliverability": True}, - # add more configurations here - ] - - import pprint - import time - - t0 = time.time() - validity = [] - - for email in email_addresses: - for config in configurations: - - res = validate_email_address(email, **config) - validity.append(res) - t1 = time.time() - validity = sorted(validity, key=lambda x: x["email"]) - - for v in validity: - pprint.pprint(v, indent=4) - - print(f"Time taken: {t1 - t0:.2f}") From cb6a18a47ce0a20f0d44e2fddda4bc0fb0105c72 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:46:22 +0000 Subject: [PATCH 20/29] run of tests --- coverage-badge.svg | 2 +- coverage.xml | 2240 +------------------------------------------- pyproject.toml | 9 +- report.xml | 2 +- 4 files changed, 35 insertions(+), 2218 deletions(-) diff --git a/coverage-badge.svg b/coverage-badge.svg index 6e694487..96d7ac21 100644 --- a/coverage-badge.svg +++ b/coverage-badge.svg @@ -1 +1 @@ -coverage: 76.92%coverage76.92% +coverage: 99.11%coverage99.11% diff --git a/coverage.xml b/coverage.xml index 5d5e0f5d..e6cfd8b7 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,48 +1,14 @@ - + - /workspaces/devsetgo_lib + /workspaces/devsetgo_lib/dsg_lib - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -59,9 +25,9 @@ - + - + @@ -87,11 +53,11 @@ - + - + @@ -113,7 +79,7 @@ - + @@ -157,7 +123,7 @@ - + @@ -188,7 +154,7 @@ - + @@ -450,13 +416,13 @@ - + - + - + @@ -484,7 +450,7 @@ - + @@ -532,25 +498,9 @@ - - - - - - - - - - - - - - - - - + @@ -741,7 +691,7 @@ - + @@ -821,7 +771,7 @@ - + @@ -876,7 +826,7 @@ - + @@ -929,7 +879,7 @@ - + @@ -953,19 +903,19 @@ - + - + - + - + @@ -990,7 +940,7 @@ - + @@ -1015,7 +965,7 @@ - + @@ -1069,2143 +1019,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pyproject.toml b/pyproject.toml index 85dc0bef..a75a12fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,13 +99,18 @@ source = [ "dsg_lib",] omit = [ "setup.py", "_venv/*", "tests/*", "examples/*", "ex.py", "ex_*.py",] [tool.coverage.report] -exclude_lines = [ "pragma: no cover", "if __name__", "def main", "import_sqlalchemy",] +exclude_lines = [ + "pragma: no cover", + "if __name__ == .__main__.:", + "def main", + "import_sqlalchemy", +] [tool.pytest.ini_options] norecursedirs = [ "/tests",] testpaths = [ "tests",] python_files = [ "test_*.py", "*_test.py",] -addopts = [ "--cov=./", "--cov-report=html", "--cov-report=xml", "--junitxml=report.xml", "--html=htmlcov/_test_report.html", "--self-contained-html", "-ra", "--strict-markers", "--tb=short", "-p", "pytester",] +addopts = [ "--cov=dsg_lib", "--cov-report=html", "--cov-report=xml", "--junitxml=report.xml", "--html=htmlcov/_test_report.html", "--self-contained-html", "-ra", "--strict-markers", "--tb=short", "-p", "pytester",] [tool.hatch.build.targets.sdist] include = [ "/dsg_lib",] diff --git a/report.xml b/report.xml index 24d10691..5f6a7eac 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 9fb5c3eb248f7ac3bf683f82c5e3bae730a5a72a Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:47:26 +0000 Subject: [PATCH 21/29] bump of version 2025.4.17.1 --- dsg_lib/__init__.py | 2 +- makefile | 2 +- pyproject.toml | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/dsg_lib/__init__.py b/dsg_lib/__init__.py index 2e634f7d..0e358071 100644 --- a/dsg_lib/__init__.py +++ b/dsg_lib/__init__.py @@ -8,7 +8,7 @@ """ from datetime import date -__version__ = "2025.04.17-001" +__version__ = "2025.05.04-001" __author__ = "Mike Ryan" __license__ = "MIT" __copyright__ = f"Copyright© 2021-{date.today().year}" diff --git a/makefile b/makefile index 16d8bb5a..1e08de08 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ # Variables REPONAME = devsetgo_lib -APP_VERSION = 2025.04.17-001 +APP_VERSION = 2025.05.04-001 PYTHON = python3 PIP = $(PYTHON) -m pip PYTEST = $(PYTHON) -m pytest diff --git a/pyproject.toml b/pyproject.toml index a75a12fd..99e8f0ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "devsetgo_lib" -version = "2025.4.17.1" +version = "2025.5.4.1" requires-python = ">=3.9" description = "DevSetGo Library is a Python library offering reusable functions for efficient coding. It includes file operations, calendar utilities, pattern matching, advanced logging with loguru, FastAPI endpoints, async database handling, and email validation. Designed for ease of use and versatility, it's a valuable tool for Python developers.\n" keywords = [ "python", "library", "reusable functions", "file operations", "calendar utilities", "pattern matching", "logging", "loguru", "FastAPI", "async database", "CRUD operations", "email validation", "development tools",] @@ -99,12 +99,7 @@ source = [ "dsg_lib",] omit = [ "setup.py", "_venv/*", "tests/*", "examples/*", "ex.py", "ex_*.py",] [tool.coverage.report] -exclude_lines = [ - "pragma: no cover", - "if __name__ == .__main__.:", - "def main", - "import_sqlalchemy", -] +exclude_lines = [ "pragma: no cover", "if __name__ == .__main__.:", "def main", "import_sqlalchemy",] [tool.pytest.ini_options] norecursedirs = [ "/tests",] From a09cfbb4ef0eedb74fe08fdeb8fae0f45ceea994 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 20:49:26 +0000 Subject: [PATCH 22/29] bump of version --- coverage.xml | 2 +- pyproject.toml | 2 +- report.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coverage.xml b/coverage.xml index e6cfd8b7..8e735122 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + diff --git a/pyproject.toml b/pyproject.toml index 99e8f0ac..096fdb58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ line_length = 100 version_format = "{current_date}-{build_count:03}" date_format = "%Y.%m.%d" timezone = "America/New_York" -git_tag = false +git_tag = true auto_commit = false [[tool.bumpcalver.file]] path = "makefile" diff --git a/report.xml b/report.xml index 5f6a7eac..2b3e23d5 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From badc87845c1ef45a17b516a9d5aa7bc61705e5ef Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:01:32 +0000 Subject: [PATCH 23/29] run of tests --- coverage.xml | 2 +- report.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coverage.xml b/coverage.xml index 8e735122..2d61c0f6 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + diff --git a/report.xml b/report.xml index 2b3e23d5..421d1dfa 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 6d996d7463f57babab9beb1c6562079dd6be6225 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:05:35 +0000 Subject: [PATCH 24/29] run of tests and adding current versions --- coverage.xml | 1292 +++++++++++++++++++------------------- pyproject.toml | 10 +- report.xml | 2 +- sonar-project.properties | 2 +- 4 files changed, 657 insertions(+), 649 deletions(-) diff --git a/coverage.xml b/coverage.xml index 2d61c0f6..8afa6444 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,7 @@
- + @@ -57,7 +57,7 @@ - + @@ -68,15 +68,15 @@ - - + + - - - - - - + + + + + + @@ -123,7 +123,7 @@ - + @@ -140,21 +140,21 @@ - - - + + + - - - - + + + + - + @@ -169,22 +169,22 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -193,264 +193,264 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -461,46 +461,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -514,184 +514,184 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -703,65 +703,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -771,7 +771,7 @@ - + @@ -783,50 +783,50 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -840,70 +840,70 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -915,7 +915,7 @@ - + @@ -925,22 +925,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -948,8 +948,8 @@ - - + + @@ -965,7 +965,7 @@ - + @@ -987,33 +987,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/pyproject.toml b/pyproject.toml index 096fdb58..9da8505b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,12 +74,20 @@ file_type = "makefile" variable = "APP_VERSION" version_standard = "standard" +# [[tool.bumpcalver.file]] +# path = "sonar-project.properties" +# file_type = "toml" +# variable = "project.version" +# version_standard = "python" + + [[tool.bumpcalver.file]] path = "pyproject.toml" file_type = "toml" -variable = "project.version" +variable = "sonar.projectVersion" version_standard = "python" + [[tool.bumpcalver.file]] path = "dsg_lib/__init__.py" file_type = "python" diff --git a/report.xml b/report.xml index 421d1dfa..15c5e15e 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + diff --git a/sonar-project.properties b/sonar-project.properties index 53cf957f..2c621502 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectKey=devsetgo_devsetgo_lib sonar.organization=devsetgo sonar.projectName=devsetgo_lib -sonar.projectVersion=0.11.0 +sonar.projectVersion=2025.5.4.1 sonar.language=python sonar.python.version=3.9, 3.10, 3.11,3.12 sonar.sources=dsg_lib From 0b4331c759244f96ebbe98e3e304f3e2d5ce4c22 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:07:19 +0000 Subject: [PATCH 25/29] run of tests --- coverage.xml | 1292 +++++++++++++++++++++++++------------------------- report.xml | 2 +- 2 files changed, 647 insertions(+), 647 deletions(-) diff --git a/coverage.xml b/coverage.xml index 8afa6444..7b0db739 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -68,15 +68,15 @@ - - + + - - - - - - + + + + + + @@ -123,7 +123,7 @@ - + @@ -140,21 +140,21 @@ - - - + + + - - - - + + + + - + @@ -169,22 +169,22 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -193,264 +193,264 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -461,46 +461,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -514,184 +514,184 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -703,65 +703,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -771,7 +771,7 @@ - + @@ -783,50 +783,50 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -840,70 +840,70 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -915,7 +915,7 @@ - + @@ -925,22 +925,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -948,8 +948,8 @@ - - + + @@ -965,7 +965,7 @@ - + @@ -987,33 +987,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/report.xml b/report.xml index 15c5e15e..c3c1c23e 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From be089f7deb9258d8dbc89a04cedd5046c9a1ec4e Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:14:21 +0000 Subject: [PATCH 26/29] fixing issue with coverage file --- coverage.xml | 2 +- makefile | 2 +- report.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coverage.xml b/coverage.xml index 7b0db739..dafe0b67 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + diff --git a/makefile b/makefile index 1e08de08..2afa07a5 100644 --- a/makefile +++ b/makefile @@ -83,7 +83,7 @@ test: ## Run the project's tests pytest genbadge coverage -i /workspaces/$(REPONAME)/coverage.xml genbadge tests -i /workspaces/$(REPONAME)/report.xml - sed -i "s|/workspaces/$(REPONAME)|$(shell pwd)|" coverage.xml + sed -i 's|/workspaces/$(REPONAME)|/github/workspace|' /workspaces/$(REPONAME)/coverage.xml tests: test ## Run the project's tests diff --git a/report.xml b/report.xml index c3c1c23e..b7859a3b 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From b1d1c1b3436adaf1e5cea85a46991f2f69bccbe2 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:22:23 +0000 Subject: [PATCH 27/29] fixing issues with sonarqube reporting. --- coverage.xml | 4 ++-- makefile | 2 +- report.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coverage.xml b/coverage.xml index dafe0b67..948e166a 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,9 +1,9 @@ - + - /workspaces/devsetgo_lib/dsg_lib + /github/workspace diff --git a/makefile b/makefile index 2afa07a5..e19673cd 100644 --- a/makefile +++ b/makefile @@ -83,7 +83,7 @@ test: ## Run the project's tests pytest genbadge coverage -i /workspaces/$(REPONAME)/coverage.xml genbadge tests -i /workspaces/$(REPONAME)/report.xml - sed -i 's|/workspaces/$(REPONAME)|/github/workspace|' /workspaces/$(REPONAME)/coverage.xml + sed -i 's|.*|/github/workspace|' /workspaces/devsetgo_lib/coverage.xml tests: test ## Run the project's tests diff --git a/report.xml b/report.xml index b7859a3b..a316df30 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 0717f928f49342a16ca2c02a76c85922510d7860 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:36:53 +0000 Subject: [PATCH 28/29] update --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index e19673cd..02f053c9 100644 --- a/makefile +++ b/makefile @@ -83,7 +83,7 @@ test: ## Run the project's tests pytest genbadge coverage -i /workspaces/$(REPONAME)/coverage.xml genbadge tests -i /workspaces/$(REPONAME)/report.xml - sed -i 's|.*|/github/workspace|' /workspaces/devsetgo_lib/coverage.xml + sed -i 's|.*|dsg_lib|' /workspaces/devsetgo_lib/coverage.xml tests: test ## Run the project's tests From 2a2e8fffc8e54e70caa386216759a36b0602dcbf Mon Sep 17 00:00:00 2001 From: devsetgo Date: Sun, 4 May 2025 21:37:29 +0000 Subject: [PATCH 29/29] working on sonarqube scan issues --- coverage.xml | 4 ++-- report.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coverage.xml b/coverage.xml index 948e166a..e6137229 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,9 +1,9 @@ - + - /github/workspace + dsg_lib diff --git a/report.xml b/report.xml index a316df30..65ea015c 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - +