diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dde7c4..78e5810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## v3.1.0 (2026-01-03) +* Add support for Django 6.0 +* Update CI structure. +* Migrate to UV for dependency management and builds. +* Python >3.10 support. + ## v3.0.1 (2025-07-01) * Drop dependency on `typing_extensions`. @@ -23,40 +29,33 @@ * Improved documentation ## v2.1.0 (2023-08-15) - * Add value to int parsing when deconstructing url string. ## v2.0.0 (2023-04-27) - -* Update project setup such that we now install as a package. +* Update project setup such that we now install it as a package. _Notes_: while this does not alter the underlying application code, we are bumping to -2.0 incase there are unforeseen knock on use-case issues. +2.0 incase there are unforeseen knock-on use-case issues. ## v1.3.0 (2023-03-27) - * Cosmetic changes to the generation of schemes. * Bump isort version - 5.11.5. -* raise warning message if database_url is not set. -* CONN_MAX_AGE fix type - Optional[int]. +* raise a warning message if `database_url` is not set. +* `CONN_MAX_AGE` fix type - `Optional[int]`. ## v1.2.0 (2022-12-13) - * Add the ability to add test databases. * Improve url parsing and encoding. -* Fix missing parameter conn_health_check in check function. +* Fix missing parameter `conn_health_check` in check function. ## v1.1.0 (2022-12-12) - * Option for connection health checks parameter. * Update supported version python 3.11. * Code changes, various improvements. -* Add project links to setup.py +* Add project links to `setup.py`. ## v1.0.0 (2022-06-18) - -Initial release of code now dj-database-urls is part of jazzband. - +Initial release of code, dj-database-urls is now part of [Jazzband](https://jazzband.co/). * Add support for cockroachdb. * Add support for the official MSSQL connector. * Update License to be compatible with Jazzband. @@ -65,7 +64,6 @@ Initial release of code now dj-database-urls is part of jazzband. * Update CI using pre-commit ## v0.5.0 (2018-03-01) - - Use str port for mssql - Added license - Add mssql to readme @@ -85,17 +83,15 @@ Initial release of code now dj-database-urls is part of jazzband. - Added SpatiaLite in README.rst ## v0.4.1 (2016-04-06) - - Enable CA providing for MySQL URIs - Update Readme - Update trove classifiers - Updated setup.py description ## v0.4.0 (2016-02-04) - - Update readme - Fix for python3 -- Handle search path config in connect url for postgres +- Handle search path config in connection url for postgres - Add tox config to ease testing against multiple Python versions - Simplified the querystring parse logic - Cleaned up querystring parsing @@ -112,27 +108,25 @@ Initial release of code now dj-database-urls is part of jazzband. - Added support for python mysql-connector ## v0.3.0 (2014-03-10) - -- Add .gitignore file -- Remove .pyc file -- Remove travis-ci unsupported python version Per docs http://docs.travis-ci.com/user/languages/python/ "Travis CI support Python versions 2.6, 2.7, 3.2 and 3.3" +- Add `.gitignore` file +- Remove `.pyc` file +- Remove travis-ci unsupported python versions (Travis CI supports Python versions 2.6, 2.7, 3.2 and 3.3) - Fix cleardb test -- Add setup.cfg for wheel support +- Add `setup.cfg` for wheel support - Add trove classifiers for python versions - Replace Python 3.1 with Python 3.3 - Add MySQL (GIS) support - Ability to set different engine ## v0.2.2 (2013-07-17) - - Added spatialite to uses_netloc too - Added spatialite backend - Replacing tab with spaces -- Handling special case of sqlite://:memory: +- Handling special case of `sqlite://:memory:` - Empty sqlite path will now use a :memory: database - Fixing test to actually use the result of the parse - Adding in tests to ensure sqlite in-memory databases work -- Fixed too-short title underline +- Fixed a too-short title underline - Added :target: attribute to Travis status image in README - Added docs for default argument to config - Add "pgsql" as a PostgreSQL URL scheme. @@ -140,7 +134,6 @@ Initial release of code now dj-database-urls is part of jazzband. - fixed url ## v0.2.1 (2012-06-19) - - Add python3 support - Adding travis status and tests - Adding test environment variables @@ -152,28 +145,23 @@ Initial release of code now dj-database-urls is part of jazzband. - RedHat's OpenShift platform uses the 'postgresql' scheme - Registered postgis URL scheme - Added `postgis://` url scheme -- Use get() on os.environ instead of an if +- Use `get()` on `os.environ` instead of an `if`. ## v0.2.0 (2012-05-30) - - Fix parse(s) ## v0.1.4 (2012-05-30) - - Add defaults for env - Set the DATABASES dict rather than assigning to it ## v0.1.3 (2012-05-01) - -- Add note to README on supported databases +- Add a note to README on supported databases - Add support for SQLite - Clean dependencies ## v0.1.2 (2012-04-30) - - Update readme -- Refactor config and use new parse function +- Refactor config and use a new parse function ## v0.1.1 (2012-04-30) First release - 🐍 ✨ diff --git a/dj_database_url/__init__.py b/dj_database_url/__init__.py index e93712c..2e79ece 100644 --- a/dj_database_url/__init__.py +++ b/dj_database_url/__init__.py @@ -1,10 +1,10 @@ import logging import os import urllib.parse as urlparse -from typing import Any, Callable, Dict, List, Optional, TypedDict, Union +from typing import Any, Callable, Optional, TypedDict DEFAULT_ENV = "DATABASE_URL" -ENGINE_SCHEMES: Dict[str, "Engine"] = {} +ENGINE_SCHEMES: dict[str, "Engine"] = {} # From https://docs.djangoproject.com/en/stable/ref/settings/#databases @@ -17,16 +17,16 @@ class DBConfig(TypedDict, total=False): ENGINE: str HOST: str NAME: str - OPTIONS: Dict[str, Any] + OPTIONS: dict[str, Any] PASSWORD: str - PORT: Union[str, int] - TEST: Dict[str, Any] + PORT: str | int + TEST: dict[str, Any] TIME_ZONE: str USER: str PostprocessCallable = Callable[[DBConfig], None] -OptionType = Union[int, str, bool] +OptionType = int | str | bool class ParseError(ValueError): @@ -38,7 +38,7 @@ class ParseError(ValueError): class UnknownSchemeError(ValueError): - def __init__(self, scheme: str) -> None: + def __init__(self, scheme: str): self.scheme = scheme def __str__(self) -> str: @@ -59,7 +59,7 @@ class Engine: self, backend: str, postprocess: PostprocessCallable = default_postprocess, - ) -> None: + ): self.backend = backend self.postprocess = postprocess @@ -131,7 +131,7 @@ def config( conn_health_checks: bool = False, disable_server_side_cursors: bool = False, ssl_require: bool = False, - test_options: Optional[Dict[str, Any]] = None, + test_options: Optional[dict[str, Any]] = None, ) -> DBConfig: """Returns configured DATABASE dictionary from DATABASE_URL.""" s = os.environ.get(env, default) @@ -162,7 +162,7 @@ def parse( conn_health_checks: bool = False, disable_server_side_cursors: bool = False, ssl_require: bool = False, - test_options: Optional[Dict[str, Any]] = None, + test_options: Optional[dict[str, Any]] = None, ) -> DBConfig: """Parses a database URL and returns configured DATABASE dictionary.""" settings = _convert_to_settings( @@ -216,7 +216,7 @@ def parse( return parsed_config -def _parse_option_values(values: List[str]) -> Union[OptionType, List[OptionType]]: +def _parse_option_values(values: list[str]) -> OptionType | list[OptionType]: parsed_values = [_parse_value(v) for v in values] return parsed_values[0] if len(parsed_values) == 1 else parsed_values diff --git a/pyproject.toml b/pyproject.toml index b65d219..8e224eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ build-backend = "uv_build" [tool.uv.build-backend] module-name = "dj_database_url" module-root = "" -source-include = ["dj_database_url/py.typed"] +source-include = ["dj_database_url/py.typed", "tests"] [tool.ruff] line-length = 88