Compare commits

...

35 commits

Author SHA1 Message Date
dependabot[bot]
b73ad6d9c9
Bump django from 5.2.11 to 5.2.12 (#299)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
Bumps [django](https://github.com/django/django) from 5.2.11 to 5.2.12.
- [Commits](https://github.com/django/django/compare/5.2.11...5.2.12)

---
updated-dependencies:
- dependency-name: django
  dependency-version: 5.2.12
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-05 11:29:02 +00:00
pre-commit-ci[bot]
088b969573
[pre-commit.ci] pre-commit autoupdate (#298)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.1 → v0.15.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.1...v0.15.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-03 10:50:11 +00:00
pre-commit-ci[bot]
e77149f799
[pre-commit.ci] pre-commit autoupdate (#297)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.0 → v0.15.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.0...v0.15.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-18 20:23:54 +00:00
Matt Seymour
6beffe6de6 Fix a regression in adding tests/ dir to source package 2026-02-18 20:22:03 +00:00
dependabot[bot]
f9c31305ae
Bump wheel from 0.45.1 to 0.46.2 (#296)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
Bumps [wheel](https://github.com/pypa/wheel) from 0.45.1 to 0.46.2.
- [Release notes](https://github.com/pypa/wheel/releases)
- [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.45.1...0.46.2)

---
updated-dependencies:
- dependency-name: wheel
  dependency-version: 0.46.2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-16 16:20:30 +00:00
dependabot[bot]
5337838ac3
Bump urllib3 from 2.6.2 to 2.6.3 (#295)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.2 to 2.6.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.2...2.6.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.6.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-16 14:37:21 +00:00
dependabot[bot]
6fc366459f
Bump django from 5.2.9 to 5.2.11 (#294)
Bumps [django](https://github.com/django/django) from 5.2.9 to 5.2.11.
- [Commits](https://github.com/django/django/compare/5.2.9...5.2.11)

---
updated-dependencies:
- dependency-name: django
  dependency-version: 5.2.11
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-16 14:33:26 +00:00
dependabot[bot]
19805c97f3
Bump cryptography from 46.0.3 to 46.0.5 (#293)
Bumps [cryptography](https://github.com/pyca/cryptography) from 46.0.3 to 46.0.5.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/46.0.3...46.0.5)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 46.0.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-16 14:31:12 +00:00
Matt Seymour
1b102cd428
Update project URLs in pyproject.toml 2026-02-16 14:28:06 +00:00
pre-commit-ci[bot]
e41afda72b
[pre-commit.ci] pre-commit autoupdate (#291)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.13 → v0.15.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.13...v0.15.0)
- [github.com/crate-ci/typos: v1.42.0 → v1](https://github.com/crate-ci/typos/compare/v1.42.0...v1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-09 19:36:23 +00:00
Matt Seymour
dba6077081
Update .pre-commit-config.yaml to use pinned version numbers. (#289)
Some checks failed
test / formatting (push) Has been cancelled
test / typecheck (push) Has been cancelled
test / test (4.2, 3.10) (push) Has been cancelled
test / test (4.2, 3.11) (push) Has been cancelled
test / test (4.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.10) (push) Has been cancelled
test / test (5.2, 3.11) (push) Has been cancelled
test / test (5.2, 3.12) (push) Has been cancelled
test / test (5.2, 3.13) (push) Has been cancelled
test / test (5.2, 3.14) (push) Has been cancelled
test / test (6.0, 3.12) (push) Has been cancelled
test / test (6.0, 3.13) (push) Has been cancelled
test / test (6.0, 3.14) (push) Has been cancelled
2026-01-19 10:20:19 +00:00
Matt Seymour
e6f4ccc49d Add pytest to dependencies 2026-01-08 10:58:17 +00:00
Aarni Koskela
a87f12185e Enable annotations future; use futuristic annotations 2026-01-08 10:58:17 +00:00
Fábio C. Barrionuevo da Luz
1ca8ccf7db
Add project URLs to pyproject.toml (#287) 2026-01-08 10:12:50 +00:00
Matt Seymour
afad969e94 Merge branch 'ruff' 2026-01-05 10:41:27 +00:00
Matt Seymour
6273af6660 Simplify release workflow by removing created event type. 2026-01-05 10:41:03 +00:00
Matt Seymour
0a59175489 Add formatting step to workflow, integrate ruff check, and update job dependencies 2026-01-05 10:40:44 +00:00
Matt Seymour
51b51776a9
Merge branch 'master' into ruff 2026-01-05 10:29:27 +00:00
Yohaan Narayanan
d8f63c8801
Add tests directory to source distribution (#285) 2026-01-04 16:19:05 -08:00
Matt Seymour
36ec238b03 Update CHANGELOG.md 2026-01-03 09:53:03 +00:00
Matt Seymour
84fd0508ff Switch to modern dict type hints for improved readability and consistency. 2025-12-19 13:14:11 +00:00
Aarni Koskela
2bf2118232 Add crate-ci/typos to pre-commit; fix typos 2025-12-19 12:06:17 +02:00
Aarni Koskela
527962ec04 Switch linting and formatting from flake8+isort+black to ruff 2025-12-19 12:05:33 +02:00
Matt Seymour
992999193d Merge branch 'akx/ci-split' 2025-12-19 09:19:01 +00:00
Matt Seymour
59b3cd6283 Update workflow to be uv compatable 2025-12-19 09:17:33 +00:00
Matt Seymour
37b252e678 Migrate release workflow to release events, update actions, and integrate uv for builds. 2025-12-16 15:54:59 +00:00
Matt Seymour
a01d6b1551 Update project to use uv. 2025-12-16 14:18:42 +00:00
Matt Seymour
989429838a Expand test matrix to support Python 3.14 and Django 6.0, update compatibility exclusions 2025-12-15 16:15:57 +00:00
GabrielBarrantes
438ec393ab
Update license to BSD-3-Clause in setup.py (#279) 2025-12-15 15:58:23 +00:00
pre-commit-ci[bot]
8a3c372deb
[pre-commit.ci] pre-commit autoupdate (#278)
updates:
- [github.com/pycqa/isort: 6.0.1 → 7.0.0](https://github.com/pycqa/isort/compare/6.0.1...7.0.0)
- https://github.com/psf/blackhttps://github.com/psf/black-pre-commit-mirror
- [github.com/psf/black-pre-commit-mirror: 25.9.0 → 25.12.0](https://github.com/psf/black-pre-commit-mirror/compare/25.9.0...25.12.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-12-15 15:56:33 +00:00
pre-commit-ci[bot]
390d524112
[pre-commit.ci] pre-commit autoupdate (#276)
updates:
- [github.com/psf/black: 25.1.0 → 25.9.0](https://github.com/psf/black/compare/25.1.0...25.9.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-22 18:45:50 +01:00
Aarni Koskela
58ed5a2276 CI: run typechecks only once, not for each Django/Python version 2025-08-20 12:15:31 +03:00
pre-commit-ci[bot]
7cc1121b29
[pre-commit.ci] pre-commit autoupdate (#270)
updates:
- [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-11 21:06:04 +01:00
Matt Seymour
0819957676 Allow conn_max_age to accept None for flexibility in configuration 2025-07-11 17:15:17 +01:00
pre-commit-ci[bot]
34170b5aef
[pre-commit.ci] pre-commit autoupdate (#268)
updates:
- [github.com/pycqa/flake8: 7.2.0 → 7.3.0](https://github.com/pycqa/flake8/compare/7.2.0...7.3.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-11 16:22:42 +01:00
12 changed files with 1233 additions and 187 deletions

View file

@ -1,5 +0,0 @@
[flake8]
max-line-length = 88
extend-ignore = E203
per-file-ignores=
tests/test_dj_database_url.py: E501, E265

View file

@ -1,9 +1,8 @@
name: Release name: Release
on: on:
push: release:
tags: types: [published]
- '*'
jobs: jobs:
build: build:
@ -11,28 +10,29 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Python - name: Set version from release/tag
uses: actions/setup-python@v5 id: version
with:
python-version: '3.10'
- name: Install dependencies
run: | run: |
python -m pip install -U pip VERSION=${GITHUB_REF#refs/*/}
python -m pip install -U setuptools wheel twine VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: astral-sh/setup-uv@v7
with:
python-version: 3.12
- name: Build package - name: Build package
run: | run: |
python setup.py --version uv version ${{ env.VERSION }}
python setup.py sdist --format=gztar bdist_wheel uv build
twine check dist/* uvx twine check dist/*
- name: Upload packages to Jazzband - name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: jazzband user: jazzband

View file

@ -1,56 +1,74 @@
name: test name: test
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
- name: Run ruff
run: uvx ruff check
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
- name: Run mypy
run: uvx mypy dj_database_url
- name: Run pyright
run: uvx pyright dj_database_url
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [formatting, typecheck]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
django-version: ["4.2", "5.1"] django-version: ["4.2", "5.2", "6.0"]
exclude: exclude:
# Python 3.11 is not compatible with 3.2 # django 4.x is not compatible with python 3.13 or higher
- python-version: "3.11"
django-version: "3.2"
- python-version: "3.12"
django-version: "3.2"
- python-version: "3.13" - python-version: "3.13"
django-version: "3.2" django-version: "4.2"
# django 5.x is not compatible with python 3.9 or lower - python-version: "3.14"
- python-version: "3.9" django-version: "4.2"
django-version: "5.1" # django 6.x is not compatible with python 3.11 or lower
- python-version: "3.10"
django-version: "6.0"
- python-version: "3.11"
django-version: "6.0"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Install uv and set the Python version
uses: actions/setup-python@v5 uses: astral-sh/setup-uv@v7
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: 'pip' activate-environment: 'true'
- name: Install dependencies - name: Install dependencies
run: | run: |
pip install -r requirements.txt uv pip install "Django~=${{ matrix.django-version }}.0"
pip install "Django~=${{ matrix.django-version }}.0" .
- name: Run type checking
run: |
python -m mypy dj_database_url
python -m pyright dj_database_url
- name: Run Tests - name: Run Tests
run: | run: |
echo "$(python --version) / Django $(django-admin --version)" echo "$(python --version) / Django $(django-admin --version)"
coverage run --source=dj_database_url --branch -m unittest discover -v uvx coverage run --source=dj_database_url --branch -m unittest discover -v
coverage report uvx coverage report
coverage xml uvx coverage xml
- uses: codecov/codecov-action@v4 - uses: codecov/codecov-action@v4
- name: Check types installation
run: |
pip install .
cd tests
python -m mypy .
python -m pyright .

View file

@ -1,2 +0,0 @@
[settings]
profile = black

View file

@ -1,23 +1,21 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v6.0.0
hooks: hooks:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/pycqa/isort - repo: https://github.com/astral-sh/ruff-pre-commit
rev: "6.0.1" rev: v0.15.4
hooks: hooks:
- id: isort - id: ruff-check
args: ["--profile", "black"] args:
- --fix
- id: ruff-format
args:
- --quiet
- repo: https://github.com/psf/black - repo: https://github.com/crate-ci/typos
rev: 25.1.0 rev: v1
hooks: hooks:
- id: black - id: typos
args: [--target-version=py38]
- repo: https://github.com/pycqa/flake8
rev: '7.2.0'
hooks:
- id: flake8

View file

@ -1,11 +1,17 @@
# 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`.
## v3.0.0 (2025-05-18) ## v3.0.0 (2025-05-18)
> Bumping to version 3; changes to code do break some API compatability. > Bumping to version 3; changes to code do break some API compatibility.
* Implement a new decorator registry pattern to impement checks on database connection string. * Implement a new decorator registry pattern to implement checks on database connection string.
* You can now support and implement your own database strings by extending the @register functionality. * You can now support and implement your own database strings by extending the @register functionality.
* Update supported python versions and django versions. * Update supported python versions and django versions.
@ -18,54 +24,46 @@
## v2.2.0 (2024-05-28) ## v2.2.0 (2024-05-28)
* Add disable_server_side_cursors parameter * Add disable_server_side_cursors parameter
* Enhance Query String Parsing for Server-Side Binding in Django 4.2 with psycopg 3.1.8+ * Enhance Query String Parsing for Server-Side Binding in Django 4.2 with psycopg 3.1.8+
* Update django 5.0 python compatability by @mattseymour in #239 * Update django 5.0 python compatibility by @mattseymour in #239
* Improved internals * Improved internals
* 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 improvments. * 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 offical MSSQL connector. * Add support for the official MSSQL connector.
* Update License to be compatible with Jazzband. * Update License to be compatible with Jazzband.
* Remove support for Python < 3.5 including Python 2.7 * Remove support for Python < 3.5 including Python 2.7
* Update source code to Black format. * Update source code to Black format.
* 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
🐍 ✨ 🐍 ✨

View file

@ -1,32 +1,33 @@
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 collections.abc import Callable
from typing import Any, 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
class DBConfig(TypedDict, total=False): class DBConfig(TypedDict, total=False):
ATOMIC_REQUESTS: bool ATOMIC_REQUESTS: bool
AUTOCOMMIT: bool AUTOCOMMIT: bool
CONN_MAX_AGE: Optional[int] CONN_MAX_AGE: int | None
CONN_HEALTH_CHECKS: bool CONN_HEALTH_CHECKS: bool
DISABLE_SERVER_SIDE_CURSORS: bool DISABLE_SERVER_SIDE_CURSORS: bool
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 +39,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 +60,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
@ -125,13 +126,13 @@ def apply_current_schema(parsed_config: DBConfig) -> None:
def config( def config(
env: str = DEFAULT_ENV, env: str = DEFAULT_ENV,
default: Optional[str] = None, default: str | None = None,
engine: Optional[str] = None, engine: str | None = None,
conn_max_age: int = 0, conn_max_age: int | None = 0,
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: dict[str, Any] | None = 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)
@ -157,12 +158,12 @@ def config(
def parse( def parse(
url: str, url: str,
engine: Optional[str] = None, engine: str | None = None,
conn_max_age: int = 0, conn_max_age: int | None = 0,
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: dict[str, Any] | None = 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 +217,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
@ -230,12 +231,12 @@ def _parse_value(value: str) -> OptionType:
def _convert_to_settings( def _convert_to_settings(
engine: Optional[str], engine: str | None,
conn_max_age: int, conn_max_age: int | None,
conn_health_checks: bool, conn_health_checks: bool,
disable_server_side_cursors: bool, disable_server_side_cursors: bool,
ssl_require: bool, ssl_require: bool,
test_options: Optional[dict[str, Any]], test_options: dict[str, Any] | None,
) -> DBConfig: ) -> DBConfig:
settings: DBConfig = { settings: DBConfig = {
"CONN_MAX_AGE": conn_max_age, "CONN_MAX_AGE": conn_max_age,

View file

@ -1,5 +1,61 @@
[tool.black] [project]
skip-string-normalization = 1 name = "dj-database-url"
version = "0.0.0"
description = "Use Database URLs in your Django Application."
authors = [
{ name = "Jazzband community" }
]
readme = "README.rst"
requires-python = ">=3.10"
license = "BSD-3-Clause"
license-files = ["LICENSE"]
dependencies = [
"django>=4.2",
]
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",
"Framework :: Django :: 6",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
[project.urls]
Homepage = "https://jazzband.co/projects/dj-database-url"
Changelog = "https://github.com/jazzband/dj-database-url/blob/master/CHANGELOG.md"
Funding = "https://psfmember.org/civicrm/contribute/transact/?reset=1&id=34"
Bug = "https://github.com/jazzband/dj-database-url/issues"
[build-system]
requires = ["uv_build>=0.9.17,<0.10.0"]
build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "dj_database_url"
module-root = ""
source-include = ["dj_database_url/py.typed", "tests/**"]
[tool.ruff]
line-length = 88
[tool.ruff.lint]
extend-select = ["B", "I"]
[tool.ruff.format]
quote-style = "preserve"
[tool.mypy] [tool.mypy]
show_error_codes=true show_error_codes=true
@ -9,3 +65,15 @@ warn_redundant_casts=true
[tool.pyright] [tool.pyright]
typeCheckingMode = "strict" typeCheckingMode = "strict"
[dependency-groups]
dev = [
"coverage>=7.13.0",
"mypy>=1.19.1",
"pyright>=1.1.407",
"pytest>=9.0.2",
"ruff>=0.14.10",
"setuptools>=80.9.0",
"twine>=6.2.0",
"wheel>=0.45.1",
]

View file

@ -1,3 +0,0 @@
coverage
mypy
pyright

View file

@ -1,50 +0,0 @@
from pathlib import Path
from setuptools import setup # pyright: ignore[reportUnknownVariableType]
readme = Path("README.rst").read_text()
setup(
name="dj-database-url",
version="3.0.1",
url="https://github.com/jazzband/dj-database-url",
license="BSD",
author="Original Author: Kenneth Reitz, Maintained by: JazzBand Community",
description="Use Database URLs in your Django Application.",
long_description=readme,
long_description_content_type="text/x-rst",
packages=["dj_database_url"],
install_requires=["Django>=4.2"],
include_package_data=True,
package_data={
"dj_database_url": ["py.typed"],
},
platforms="any",
project_urls={
"GitHub": "https://github.com/jazzband/dj-database-url/",
"Release log": (
"https://github.com/jazzband/dj-database-url/blob/master/CHANGELOG.md"
),
},
classifiers=[
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
)

View file

@ -266,8 +266,8 @@ class DatabaseTestSuite(unittest.TestCase):
assert url["CONN_MAX_AGE"] == conn_max_age assert url["CONN_MAX_AGE"] == conn_max_age
def test_config_conn_max_age_setting(self) -> None: def test_config_conn_max_age_setting_none(self) -> None:
conn_max_age = 600 conn_max_age = None
with mock.patch.dict( with mock.patch.dict(
os.environ, os.environ,
{ {
@ -680,9 +680,9 @@ class DatabaseTestSuite(unittest.TestCase):
def test_options_int_values(self) -> None: def test_options_int_values(self) -> None:
"""Ensure that options with integer values are parsed correctly.""" """Ensure that options with integer values are parsed correctly."""
url = dj_database_url.parse( url = dj_database_url.parse(
"mysql://user:pw@127.0.0.1:15036/db?connect_timout=3" "mysql://user:pw@127.0.0.1:15036/db?connect_timeout=3"
) )
assert url["OPTIONS"] == {'connect_timout': 3} assert url["OPTIONS"] == {'connect_timeout': 3}
@mock.patch.dict( @mock.patch.dict(
os.environ, os.environ,

1033
uv.lock Normal file

File diff suppressed because it is too large Load diff