mirror of
https://github.com/jazzband/dj-database-url.git
synced 2026-03-16 22:20:24 +00:00
Merge branch 'master' into ruff
This commit is contained in:
commit
51b51776a9
3 changed files with 35 additions and 47 deletions
58
CHANGELOG.md
58
CHANGELOG.md
|
|
@ -1,5 +1,11 @@
|
||||||
# CHANGELOG
|
# 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)
|
## v3.0.1 (2025-07-01)
|
||||||
* Drop dependency on `typing_extensions`.
|
* Drop dependency on `typing_extensions`.
|
||||||
|
|
||||||
|
|
@ -23,40 +29,33 @@
|
||||||
* Improved documentation
|
* Improved documentation
|
||||||
|
|
||||||
## v2.1.0 (2023-08-15)
|
## v2.1.0 (2023-08-15)
|
||||||
|
|
||||||
* Add value to int parsing when deconstructing url string.
|
* Add value to int parsing when deconstructing url string.
|
||||||
|
|
||||||
## v2.0.0 (2023-04-27)
|
## v2.0.0 (2023-04-27)
|
||||||
|
* Update project setup such that we now install it as a package.
|
||||||
* Update project setup such that we now install as a package.
|
|
||||||
|
|
||||||
_Notes_: while this does not alter the underlying application code, we are bumping to
|
_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)
|
## v1.3.0 (2023-03-27)
|
||||||
|
|
||||||
* Cosmetic changes to the generation of schemes.
|
* Cosmetic changes to the generation of schemes.
|
||||||
* Bump isort version - 5.11.5.
|
* Bump isort version - 5.11.5.
|
||||||
* raise warning message if database_url is not set.
|
* raise a warning message if `database_url` is not set.
|
||||||
* CONN_MAX_AGE fix type - Optional[int].
|
* `CONN_MAX_AGE` fix type - `Optional[int]`.
|
||||||
|
|
||||||
## v1.2.0 (2022-12-13)
|
## v1.2.0 (2022-12-13)
|
||||||
|
|
||||||
* Add the ability to add test databases.
|
* Add the ability to add test databases.
|
||||||
* Improve url parsing and encoding.
|
* 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)
|
## v1.1.0 (2022-12-12)
|
||||||
|
|
||||||
* Option for connection health checks parameter.
|
* Option for connection health checks parameter.
|
||||||
* Update supported version python 3.11.
|
* Update supported version python 3.11.
|
||||||
* Code changes, various improvements.
|
* Code changes, various improvements.
|
||||||
* Add project links to setup.py
|
* Add project links to `setup.py`.
|
||||||
|
|
||||||
## v1.0.0 (2022-06-18)
|
## v1.0.0 (2022-06-18)
|
||||||
|
Initial release of code, dj-database-urls is now part of [Jazzband](https://jazzband.co/).
|
||||||
Initial release of code now dj-database-urls is part of jazzband.
|
|
||||||
|
|
||||||
* Add support for cockroachdb.
|
* Add support for cockroachdb.
|
||||||
* Add support for the official MSSQL connector.
|
* Add support for the official MSSQL connector.
|
||||||
* Update License to be compatible with Jazzband.
|
* 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
|
* Update CI using pre-commit
|
||||||
|
|
||||||
## v0.5.0 (2018-03-01)
|
## v0.5.0 (2018-03-01)
|
||||||
|
|
||||||
- Use str port for mssql
|
- Use str port for mssql
|
||||||
- Added license
|
- Added license
|
||||||
- Add mssql to readme
|
- 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
|
- Added SpatiaLite in README.rst
|
||||||
|
|
||||||
## v0.4.1 (2016-04-06)
|
## v0.4.1 (2016-04-06)
|
||||||
|
|
||||||
- Enable CA providing for MySQL URIs
|
- Enable CA providing for MySQL URIs
|
||||||
- Update Readme
|
- Update Readme
|
||||||
- Update trove classifiers
|
- Update trove classifiers
|
||||||
- Updated setup.py description
|
- Updated setup.py description
|
||||||
|
|
||||||
## v0.4.0 (2016-02-04)
|
## v0.4.0 (2016-02-04)
|
||||||
|
|
||||||
- Update readme
|
- Update readme
|
||||||
- Fix for python3
|
- 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
|
- Add tox config to ease testing against multiple Python versions
|
||||||
- Simplified the querystring parse logic
|
- Simplified the querystring parse logic
|
||||||
- Cleaned up querystring parsing
|
- 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
|
- Added support for python mysql-connector
|
||||||
|
|
||||||
## v0.3.0 (2014-03-10)
|
## v0.3.0 (2014-03-10)
|
||||||
|
- Add `.gitignore` file
|
||||||
- Add .gitignore file
|
- Remove `.pyc` file
|
||||||
- Remove .pyc file
|
- Remove travis-ci unsupported python versions (Travis CI supports Python versions 2.6, 2.7, 3.2 and 3.3)
|
||||||
- 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"
|
|
||||||
- Fix cleardb test
|
- Fix cleardb test
|
||||||
- Add setup.cfg for wheel support
|
- Add `setup.cfg` for wheel support
|
||||||
- Add trove classifiers for python versions
|
- Add trove classifiers for python versions
|
||||||
- Replace Python 3.1 with Python 3.3
|
- Replace Python 3.1 with Python 3.3
|
||||||
- Add MySQL (GIS) support
|
- Add MySQL (GIS) support
|
||||||
- Ability to set different engine
|
- Ability to set different engine
|
||||||
|
|
||||||
## v0.2.2 (2013-07-17)
|
## v0.2.2 (2013-07-17)
|
||||||
|
|
||||||
- Added spatialite to uses_netloc too
|
- Added spatialite to uses_netloc too
|
||||||
- Added spatialite backend
|
- Added spatialite backend
|
||||||
- Replacing tab with spaces
|
- 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
|
- Empty sqlite path will now use a :memory: database
|
||||||
- Fixing test to actually use the result of the parse
|
- Fixing test to actually use the result of the parse
|
||||||
- Adding in tests to ensure sqlite in-memory databases work
|
- 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 :target: attribute to Travis status image in README
|
||||||
- Added docs for default argument to config
|
- Added docs for default argument to config
|
||||||
- Add "pgsql" as a PostgreSQL URL scheme.
|
- 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
|
- fixed url
|
||||||
|
|
||||||
## v0.2.1 (2012-06-19)
|
## v0.2.1 (2012-06-19)
|
||||||
|
|
||||||
- Add python3 support
|
- Add python3 support
|
||||||
- Adding travis status and tests
|
- Adding travis status and tests
|
||||||
- Adding test environment variables
|
- 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
|
- RedHat's OpenShift platform uses the 'postgresql' scheme
|
||||||
- Registered postgis URL scheme
|
- Registered postgis URL scheme
|
||||||
- Added `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)
|
## v0.2.0 (2012-05-30)
|
||||||
|
|
||||||
- Fix parse(s)
|
- Fix parse(s)
|
||||||
|
|
||||||
## v0.1.4 (2012-05-30)
|
## v0.1.4 (2012-05-30)
|
||||||
|
|
||||||
- Add defaults for env
|
- Add defaults for env
|
||||||
- Set the DATABASES dict rather than assigning to it
|
- Set the DATABASES dict rather than assigning to it
|
||||||
|
|
||||||
## v0.1.3 (2012-05-01)
|
## v0.1.3 (2012-05-01)
|
||||||
|
- Add a note to README on supported databases
|
||||||
- Add note to README on supported databases
|
|
||||||
- Add support for SQLite
|
- Add support for SQLite
|
||||||
- Clean dependencies
|
- Clean dependencies
|
||||||
|
|
||||||
## v0.1.2 (2012-04-30)
|
## v0.1.2 (2012-04-30)
|
||||||
|
|
||||||
- Update readme
|
- 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
|
## v0.1.1 (2012-04-30) First release
|
||||||
|
|
||||||
🐍 ✨
|
🐍 ✨
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import urllib.parse as urlparse
|
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"
|
DEFAULT_ENV = "DATABASE_URL"
|
||||||
ENGINE_SCHEMES: Dict[str, "Engine"] = {}
|
ENGINE_SCHEMES: dict[str, "Engine"] = {}
|
||||||
|
|
||||||
|
|
||||||
# From https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
# From https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
||||||
|
|
@ -17,16 +17,16 @@ class DBConfig(TypedDict, total=False):
|
||||||
ENGINE: str
|
ENGINE: str
|
||||||
HOST: str
|
HOST: str
|
||||||
NAME: str
|
NAME: str
|
||||||
OPTIONS: Dict[str, Any]
|
OPTIONS: dict[str, Any]
|
||||||
PASSWORD: str
|
PASSWORD: str
|
||||||
PORT: Union[str, int]
|
PORT: str | int
|
||||||
TEST: Dict[str, Any]
|
TEST: dict[str, Any]
|
||||||
TIME_ZONE: str
|
TIME_ZONE: str
|
||||||
USER: str
|
USER: str
|
||||||
|
|
||||||
|
|
||||||
PostprocessCallable = Callable[[DBConfig], None]
|
PostprocessCallable = Callable[[DBConfig], None]
|
||||||
OptionType = Union[int, str, bool]
|
OptionType = int | str | bool
|
||||||
|
|
||||||
|
|
||||||
class ParseError(ValueError):
|
class ParseError(ValueError):
|
||||||
|
|
@ -38,7 +38,7 @@ class ParseError(ValueError):
|
||||||
|
|
||||||
|
|
||||||
class UnknownSchemeError(ValueError):
|
class UnknownSchemeError(ValueError):
|
||||||
def __init__(self, scheme: str) -> None:
|
def __init__(self, scheme: str):
|
||||||
self.scheme = scheme
|
self.scheme = scheme
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
|
@ -59,7 +59,7 @@ class Engine:
|
||||||
self,
|
self,
|
||||||
backend: str,
|
backend: str,
|
||||||
postprocess: PostprocessCallable = default_postprocess,
|
postprocess: PostprocessCallable = default_postprocess,
|
||||||
) -> None:
|
):
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
self.postprocess = postprocess
|
self.postprocess = postprocess
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ def config(
|
||||||
conn_health_checks: bool = False,
|
conn_health_checks: bool = False,
|
||||||
disable_server_side_cursors: bool = False,
|
disable_server_side_cursors: bool = False,
|
||||||
ssl_require: bool = False,
|
ssl_require: bool = False,
|
||||||
test_options: Optional[Dict[str, Any]] = None,
|
test_options: Optional[dict[str, Any]] = None,
|
||||||
) -> DBConfig:
|
) -> DBConfig:
|
||||||
"""Returns configured DATABASE dictionary from DATABASE_URL."""
|
"""Returns configured DATABASE dictionary from DATABASE_URL."""
|
||||||
s = os.environ.get(env, default)
|
s = os.environ.get(env, default)
|
||||||
|
|
@ -162,7 +162,7 @@ def parse(
|
||||||
conn_health_checks: bool = False,
|
conn_health_checks: bool = False,
|
||||||
disable_server_side_cursors: bool = False,
|
disable_server_side_cursors: bool = False,
|
||||||
ssl_require: bool = False,
|
ssl_require: bool = False,
|
||||||
test_options: Optional[Dict[str, Any]] = None,
|
test_options: Optional[dict[str, Any]] = None,
|
||||||
) -> DBConfig:
|
) -> DBConfig:
|
||||||
"""Parses a database URL and returns configured DATABASE dictionary."""
|
"""Parses a database URL and returns configured DATABASE dictionary."""
|
||||||
settings = _convert_to_settings(
|
settings = _convert_to_settings(
|
||||||
|
|
@ -216,7 +216,7 @@ def parse(
|
||||||
return parsed_config
|
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]
|
parsed_values = [_parse_value(v) for v in values]
|
||||||
return parsed_values[0] if len(parsed_values) == 1 else parsed_values
|
return parsed_values[0] if len(parsed_values) == 1 else parsed_values
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ build-backend = "uv_build"
|
||||||
[tool.uv.build-backend]
|
[tool.uv.build-backend]
|
||||||
module-name = "dj_database_url"
|
module-name = "dj_database_url"
|
||||||
module-root = ""
|
module-root = ""
|
||||||
source-include = ["dj_database_url/py.typed"]
|
source-include = ["dj_database_url/py.typed", "tests"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue