Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-dj-database-url for 
openSUSE:Factory checked in at 2023-04-26 17:24:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dj-database-url (Old)
 and      /work/SRC/openSUSE:Factory/.python-dj-database-url.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dj-database-url"

Wed Apr 26 17:24:38 2023 rev:8 rq:1082829 version:1.3.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-dj-database-url/python-dj-database-url.changes
    2022-12-30 11:09:02.689285817 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-dj-database-url.new.1533/python-dj-database-url.changes
  2023-04-26 17:25:11.865565956 +0200
@@ -1,0 +2,12 @@
+Tue Apr 25 21:59:28 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 1.3.0:
+  * Better error on missing schema
+  * Add types
+  * 100% test coverage
+  * Avoid duplicating the uses_netloc and schemes lines
+  * isort 5.11.4 is broken
+  * Throw warning if DATABASE_URL isn't set
+  * Fixes #209 - Make conn_max_age optional[int] type
+
+-------------------------------------------------------------------

Old:
----
  dj-database-url-1.2.0.tar.gz

New:
----
  dj-database-url-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-dj-database-url.spec ++++++
--- /var/tmp/diff_new_pack.ImYG8y/_old  2023-04-26 17:25:12.241568149 +0200
+++ /var/tmp/diff_new_pack.ImYG8y/_new  2023-04-26 17:25:12.245568172 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-dj-database-url
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           python-dj-database-url
-Version:        1.2.0
+Version:        1.3.0
 Release:        0
 Summary:        Utility to use database URLs in Django applications
 License:        BSD-3-Clause

++++++ dj-database-url-1.2.0.tar.gz -> dj-database-url-1.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dj-database-url-1.2.0/MANIFEST.in 
new/dj-database-url-1.3.0/MANIFEST.in
--- old/dj-database-url-1.2.0/MANIFEST.in       1970-01-01 01:00:00.000000000 
+0100
+++ new/dj-database-url-1.3.0/MANIFEST.in       2023-03-27 22:56:26.000000000 
+0200
@@ -0,0 +1 @@
+include py.typed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dj-database-url-1.2.0/PKG-INFO 
new/dj-database-url-1.3.0/PKG-INFO
--- old/dj-database-url-1.2.0/PKG-INFO  2022-12-13 10:21:36.382262000 +0100
+++ new/dj-database-url-1.3.0/PKG-INFO  2023-03-27 22:56:35.978649400 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dj-database-url
-Version: 1.2.0
+Version: 1.3.0
 Summary: Use Database URLs in your Django Application.
 Home-page: https://github.com/jazzband/dj-database-url
 Author: Original Author: Kenneth Reitz, Maintained by: JazzBand Community
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dj-database-url-1.2.0/dj_database_url.egg-info/PKG-INFO 
new/dj-database-url-1.3.0/dj_database_url.egg-info/PKG-INFO
--- old/dj-database-url-1.2.0/dj_database_url.egg-info/PKG-INFO 2022-12-13 
10:21:36.000000000 +0100
+++ new/dj-database-url-1.3.0/dj_database_url.egg-info/PKG-INFO 2023-03-27 
22:56:35.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dj-database-url
-Version: 1.2.0
+Version: 1.3.0
 Summary: Use Database URLs in your Django Application.
 Home-page: https://github.com/jazzband/dj-database-url
 Author: Original Author: Kenneth Reitz, Maintained by: JazzBand Community
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dj-database-url-1.2.0/dj_database_url.egg-info/SOURCES.txt 
new/dj-database-url-1.3.0/dj_database_url.egg-info/SOURCES.txt
--- old/dj-database-url-1.2.0/dj_database_url.egg-info/SOURCES.txt      
2022-12-13 10:21:36.000000000 +0100
+++ new/dj-database-url-1.3.0/dj_database_url.egg-info/SOURCES.txt      
2023-03-27 22:56:35.000000000 +0200
@@ -1,6 +1,8 @@
 LICENSE
+MANIFEST.in
 README.rst
 dj_database_url.py
+py.typed
 pyproject.toml
 setup.py
 dj_database_url.egg-info/PKG-INFO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dj-database-url-1.2.0/dj_database_url.egg-info/requires.txt 
new/dj-database-url-1.3.0/dj_database_url.egg-info/requires.txt
--- old/dj-database-url-1.2.0/dj_database_url.egg-info/requires.txt     
2022-12-13 10:21:36.000000000 +0100
+++ new/dj-database-url-1.3.0/dj_database_url.egg-info/requires.txt     
2023-03-27 22:56:35.000000000 +0200
@@ -1 +1,2 @@
 Django>=3.2
+typing_extensions>=3.10.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dj-database-url-1.2.0/dj_database_url.py 
new/dj-database-url-1.3.0/dj_database_url.py
--- old/dj-database-url-1.2.0/dj_database_url.py        2022-12-13 
10:21:27.000000000 +0100
+++ new/dj-database-url-1.3.0/dj_database_url.py        2023-03-27 
22:56:26.000000000 +0200
@@ -1,25 +1,9 @@
+import logging
 import os
 import urllib.parse as urlparse
+from typing import Any, Dict, Optional, Union
 
-# Register database schemes in URLs.
-urlparse.uses_netloc.append("postgres")
-urlparse.uses_netloc.append("postgresql")
-urlparse.uses_netloc.append("pgsql")
-urlparse.uses_netloc.append("postgis")
-urlparse.uses_netloc.append("mysql")
-urlparse.uses_netloc.append("mysql2")
-urlparse.uses_netloc.append("mysqlgis")
-urlparse.uses_netloc.append("mysql-connector")
-urlparse.uses_netloc.append("mssql")
-urlparse.uses_netloc.append("mssqlms")
-urlparse.uses_netloc.append("spatialite")
-urlparse.uses_netloc.append("sqlite")
-urlparse.uses_netloc.append("oracle")
-urlparse.uses_netloc.append("oraclegis")
-urlparse.uses_netloc.append("redshift")
-urlparse.uses_netloc.append("cockroach")
-urlparse.uses_netloc.append("timescale")
-urlparse.uses_netloc.append("timescalegis")
+from typing_extensions import TypedDict
 
 DEFAULT_ENV = "DATABASE_URL"
 
@@ -44,19 +28,46 @@
     "timescalegis": "timescale.db.backends.postgis",
 }
 
+# Register database schemes in URLs.
+for key in SCHEMES.keys():
+    urlparse.uses_netloc.append(key)
+
+
+# From https://docs.djangoproject.com/en/4.0/ref/settings/#databases
+class DBConfig(TypedDict, total=False):
+    ATOMIC_REQUESTS: bool
+    AUTOCOMMIT: bool
+    CONN_MAX_AGE: Optional[int]
+    CONN_HEALTH_CHECKS: bool
+    DISABLE_SERVER_SIDE_CURSORS: bool
+    ENGINE: str
+    HOST: str
+    NAME: str
+    OPTIONS: Optional[Dict[str, Any]]
+    PASSWORD: str
+    PORT: Union[str, int]
+    TEST: Dict[str, Any]
+    TIME_ZONE: str
+    USER: str
+
 
 def config(
-    env=DEFAULT_ENV,
-    default=None,
-    engine=None,
-    conn_max_age=0,
-    conn_health_checks=False,
-    ssl_require=False,
-    test_options=None,
-):
+    env: str = DEFAULT_ENV,
+    default: Optional[str] = None,
+    engine: Optional[str] = None,
+    conn_max_age: Optional[int] = 0,
+    conn_health_checks: bool = False,
+    ssl_require: bool = False,
+    test_options: Optional[Dict] = None,
+) -> DBConfig:
     """Returns configured DATABASE dictionary from DATABASE_URL."""
     s = os.environ.get(env, default)
 
+    if s is None:
+        logging.warning(
+            "No %s environment variable set, and so no databases setup" % env
+        )
+
     if s:
         return parse(
             s, engine, conn_max_age, conn_health_checks, ssl_require, 
test_options
@@ -66,13 +77,13 @@
 
 
 def parse(
-    url,
-    engine=None,
-    conn_max_age=0,
-    conn_health_checks=False,
-    ssl_require=False,
-    test_options=None,
-):
+    url: str,
+    engine: Optional[str] = None,
+    conn_max_age: Optional[int] = 0,
+    conn_health_checks: bool = False,
+    ssl_require: bool = False,
+    test_options: Optional[dict] = None,
+) -> DBConfig:
     """Parses a database URL."""
     if url == "sqlite://:memory:":
         # this is a special case, because if we pass this URL into
@@ -82,58 +93,59 @@
         # note: no other settings are required for sqlite
 
     # otherwise parse the url as normal
-    parsed_config = {}
+    parsed_config: DBConfig = {}
 
     if test_options is None:
         test_options = {}
 
-    url = urlparse.urlsplit(url)
+    spliturl = urlparse.urlsplit(url)
 
     # Split query strings from path.
-    path = url.path[1:]
-    if "?" in path and not url.query:
-        path, query = path.split("?", 2)
-    else:
-        path, query = path, url.query
-    query = urlparse.parse_qs(query)
+    path = spliturl.path[1:]
+    query = urlparse.parse_qs(spliturl.query)
 
     # If we are using sqlite and we have no path, then assume we
     # want an in-memory database (this is the behaviour of sqlalchemy)
-    if url.scheme == "sqlite" and path == "":
+    if spliturl.scheme == "sqlite" and path == "":
         path = ":memory:"
 
     # Handle postgres percent-encoded paths.
-    hostname = url.hostname or ""
+    hostname = spliturl.hostname or ""
     if "%" in hostname:
         # Switch to url.netloc to avoid lower cased paths
-        hostname = url.netloc
+        hostname = spliturl.netloc
         if "@" in hostname:
             hostname = hostname.rsplit("@", 1)[1]
-        if ":" in hostname:
-            hostname = hostname.split(":", 1)[0]
         # Use URL Parse library to decode % encodes
         hostname = urlparse.unquote(hostname)
 
     # Lookup specified engine.
-    engine = SCHEMES[url.scheme] if engine is None else engine
+    if engine is None:
+        engine = SCHEMES.get(spliturl.scheme)
+        if engine is None:
+            raise ValueError(
+                "No support for '%s'. We support: %s"
+                % (spliturl.scheme, ", ".join(sorted(SCHEMES.keys())))
+            )
 
     port = (
-        str(url.port)
-        if url.port
+        str(spliturl.port)
+        if spliturl.port
         and engine in (SCHEMES["oracle"], SCHEMES["mssql"], SCHEMES["mssqlms"])
-        else url.port
+        else spliturl.port
     )
 
     # Update with environment configuration.
     parsed_config.update(
         {
             "NAME": urlparse.unquote(path or ""),
-            "USER": urlparse.unquote(url.username or ""),
-            "PASSWORD": urlparse.unquote(url.password or ""),
+            "USER": urlparse.unquote(spliturl.username or ""),
+            "PASSWORD": urlparse.unquote(spliturl.password or ""),
             "HOST": hostname,
             "PORT": port or "",
             "CONN_MAX_AGE": conn_max_age,
             "CONN_HEALTH_CHECKS": conn_health_checks,
+            "ENGINE": engine,
         }
     )
     if test_options:
@@ -144,9 +156,9 @@
         )
 
     # Pass the query string into OPTIONS.
-    options = {}
+    options: Dict[str, Any] = {}
     for key, values in query.items():
-        if url.scheme == "mysql" and key == "ssl-ca":
+        if spliturl.scheme == "mysql" and key == "ssl-ca":
             options["ssl"] = {"ca": values[-1]}
             continue
 
@@ -169,7 +181,4 @@
     if options:
         parsed_config["OPTIONS"] = options
 
-    if engine:
-        parsed_config["ENGINE"] = engine
-
     return parsed_config
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dj-database-url-1.2.0/pyproject.toml 
new/dj-database-url-1.3.0/pyproject.toml
--- old/dj-database-url-1.2.0/pyproject.toml    2022-12-13 10:21:27.000000000 
+0100
+++ new/dj-database-url-1.3.0/pyproject.toml    2023-03-27 22:56:26.000000000 
+0200
@@ -1,2 +1,8 @@
 [tool.black]
 skip-string-normalization = 1
+
+[tool.mypy]
+show_error_codes=true
+disallow_untyped_defs=true
+disallow_untyped_calls=true
+warn_redundant_casts=true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dj-database-url-1.2.0/setup.py 
new/dj-database-url-1.3.0/setup.py
--- old/dj-database-url-1.2.0/setup.py  2022-12-13 10:21:27.000000000 +0100
+++ new/dj-database-url-1.3.0/setup.py  2023-03-27 22:56:26.000000000 +0200
@@ -6,7 +6,7 @@
 
 setup(
     name="dj-database-url",
-    version="1.2.0",
+    version="1.3.0",
     url="https://github.com/jazzband/dj-database-url";,
     license="BSD",
     author="Original Author: Kenneth Reitz, Maintained by: JazzBand Community",
@@ -14,7 +14,7 @@
     long_description=readme,
     long_description_content_type="text/x-rst",
     py_modules=["dj_database_url"],
-    install_requires=["Django>=3.2"],
+    install_requires=["Django>=3.2", "typing_extensions >= 3.10.0.0"],
     zip_safe=False,
     include_package_data=True,
     platforms="any",

Reply via email to