From a9e08674badfd0bfd8a65ff4fe0d5fd795f4b85d Mon Sep 17 00:00:00 2001 From: Fabien Coelho Date: Thu, 8 Aug 2024 05:04:18 +0200 Subject: [PATCH 1/5] add version files with numbers, dates and change description --- .github/scripts/docs.sh | 1 + docs/source/versions.rst | 274 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+) create mode 100644 docs/source/versions.rst diff --git a/.github/scripts/docs.sh b/.github/scripts/docs.sh index 9287df00..54c0bf2c 100755 --- a/.github/scripts/docs.sh +++ b/.github/scripts/docs.sh @@ -20,6 +20,7 @@ Table of Contents Database Driver Adapters Contributing API + Versions EOF sphinx-apidoc -f -o docs/source/pydoc aiosql diff --git a/docs/source/versions.rst b/docs/source/versions.rst new file mode 100644 index 00000000..1765d9e7 --- /dev/null +++ b/docs/source/versions.rst @@ -0,0 +1,274 @@ +AioSQL - Versions +================= + +10.3 on 2024-08-03 +------------------ + +- add *Python 3.13* and *PyPy 3.10* + +10.2 on 2024-05-29 +------------------ + +- exclude SQL hints from pattern matching on C comments. +- improve tests about SQL comments. + +10.1 on 2024-03-06 +------------------ + +- drop ``black`` and ``flake8`` checks, add ``ruff`` instead. +- upgrade doc build GitHub CI version. + +10.0 on 2024-03-02 +------------------ + +- add ``:object.attribute`` support to reference object attributes in queries. +- add tests about these with dataclasses. + +9.5 on 2024-02-18 +----------------- + +- add ``duckdb`` support for *Python 3.12* CI. + +9.4 on 2024-01-28 +----------------- + +- upgrade non regression tests CI version. +- improve coverage test report. +- add doc strings to more methods. +- add ``kwargs*only`` option to fail on simple args. +- add relevant tests about previous item. +- move various utils in ``Queries``. +- add more or improve static typing hints. +- minor style changes. + +9.3 on 2024-01-18 +----------------- + +- add pyright check. +- improve generic adapter. +- improve static typing. + +9.2 on 2023-12-24 +----------------- + +- improve some tests. +- minor improvements for async adapters. + +9.1 on 2023-12-06 +----------------- + +- add *Python 3.12* to GitHub CI. +- get release number from package meta data. +- update doc relating to `` Date: Thu, 8 Aug 2024 07:06:48 +0200 Subject: [PATCH 2/5] prepare next --- docs/source/versions.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/versions.rst b/docs/source/versions.rst index 1765d9e7..6d96985c 100644 --- a/docs/source/versions.rst +++ b/docs/source/versions.rst @@ -1,6 +1,11 @@ AioSQL - Versions ================= +10.4 on ? +--------- + +- add history of version changes in the documentation (this file!). + 10.3 on 2024-08-03 ------------------ From 3e7cc3646554ba78fbc9b9d4e18e6443bbe5204b Mon Sep 17 00:00:00 2001 From: Fabien Coelho Date: Thu, 8 Aug 2024 10:07:15 +0200 Subject: [PATCH 3/5] fix 2.0.0 description --- docs/source/versions.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/versions.rst b/docs/source/versions.rst index 6d96985c..f1c32194 100644 --- a/docs/source/versions.rst +++ b/docs/source/versions.rst @@ -276,4 +276,5 @@ AioSQL - Versions ------------------- - adaptater refactoring, including breaking changes. -- remove add ``_cursor`` variants for full control. +- add ``_cursor`` variants for full control. +- remove some stuff From 7a883276ee51b429830b34cd216b246aef5bda7d Mon Sep 17 00:00:00 2001 From: Fabien Coelho Date: Thu, 8 Aug 2024 10:13:59 +0200 Subject: [PATCH 4/5] more stuff about 4.0. --- docs/source/versions.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/versions.rst b/docs/source/versions.rst index f1c32194..37a670b1 100644 --- a/docs/source/versions.rst +++ b/docs/source/versions.rst @@ -173,6 +173,7 @@ AioSQL - Versions - add convenient makefile. - refactor adapters. - add ``apsw`` driver support. +- add MySQL support with several drivers. - test names with dash (``-``). - refactor and improve tests to reduce code duplications. From f91e59c22e5e217628f86e6a019d790a368631b3 Mon Sep 17 00:00:00 2001 From: Fabien Coelho Date: Thu, 8 Aug 2024 11:29:55 +0200 Subject: [PATCH 5/5] add comments and docs --- aiosql/aiosql.py | 3 ++- aiosql/queries.py | 11 ++++++++--- aiosql/query_loader.py | 8 +++++++- aiosql/utils.py | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/aiosql/aiosql.py b/aiosql/aiosql.py index fc38a6a2..0271449f 100644 --- a/aiosql/aiosql.py +++ b/aiosql/aiosql.py @@ -18,6 +18,7 @@ "aiosqlite": AioSQLiteAdapter, # type: ignore "apsw": GenericAdapter, "asyncpg": AsyncPGAdapter, # type: ignore + "duckdb": DuckDBAdapter, "mariadb": BrokenMySQLAdapter, "mysqldb": BrokenMySQLAdapter, "mysql-connector": PyFormatAdapter, @@ -27,8 +28,8 @@ "pygresql": PyFormatAdapter, "pymysql": BrokenMySQLAdapter, "sqlite3": SQLite3Adapter, - "duckdb": DuckDBAdapter, } +"""Map adapter names to their adapter class.""" def register_adapter(name: str, adapter: Callable[..., DriverAdapterProtocol]): diff --git a/aiosql/queries.py b/aiosql/queries.py index bb5036e1..c09e5d2a 100644 --- a/aiosql/queries.py +++ b/aiosql/queries.py @@ -40,7 +40,12 @@ def __init__( def _params( self, attributes, args: Union[List[Any], Tuple[Any]], kwargs: Dict[str, Any] ) -> Union[List[Any], Tuple[Any], Dict[str, Any]]: - """Execute parameter handling.""" + """Handle query parameters. + + - update attribute references ``:u.a`` to ``:u__a``. + - check whether non kwargs are allowed and other checks. + - return the parameters, either ``args`` or ``kwargs``. + """ if attributes and kwargs: @@ -231,13 +236,13 @@ def add_child_queries(self, child_name: str, child_queries: "Queries") -> None: self._available_queries.add(f"{child_name}.{child_query_name}") def load_from_list(self, query_data: List[QueryDatum]): - """Load Queries from a list of `QuaryDatum`""" + """Load Queries from a list of `QueryDatum`""" for query_datum in query_data: self.add_queries(self._create_methods(query_datum, self.is_aio)) return self def load_from_tree(self, query_data_tree: QueryDataTree): - """Load Queries from a `QuaryDataTree`""" + """Load Queries from a `QueryDataTree`""" for key, value in query_data_tree.items(): if isinstance(value, dict): self.add_child_queries(key, Queries(self.driver_adapter).load_from_tree(value)) diff --git a/aiosql/query_loader.py b/aiosql/query_loader.py index eb9e1811..4919c113 100644 --- a/aiosql/query_loader.py +++ b/aiosql/query_loader.py @@ -49,7 +49,7 @@ def _remove_ml_comments(code: str) -> str: """Remove /* ... */ comments from code""" - # identify commented regions + # identify commented regions to be removed rm = [] for m in _UNCOMMENT.finditer(code): ml = m.groupdict()["multiline"] @@ -60,6 +60,7 @@ def _remove_ml_comments(code: str) -> str: for start, end in rm: ncode += code[current:start] current = end + # get tail ncode += code[current:] return ncode @@ -90,6 +91,11 @@ def _replace(m): class QueryLoader: + """Load Queries. + + This class holds the various utilities to read SQL files and build + QueryDatum, which will be transformed as functions in Queries. + """ def __init__( self, diff --git a/aiosql/utils.py b/aiosql/utils.py index e2a94b17..2f0d6677 100644 --- a/aiosql/utils.py +++ b/aiosql/utils.py @@ -21,6 +21,7 @@ """Pattern to identify colon-variables with a simple attribute in SQL code.""" log = logging.getLogger("aiosql") +"""Shared package logging.""" # log.setLevel(logging.DEBUG)