Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from jazzband:master #36

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
django-version: ["3.2", "4.2", "5.0"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
django-version: ["3.2", "4.2", "5.1"]
exclude:
# Python 3.7 is not compatible with 4.1
- python-version: "3.7"
Expand All @@ -17,19 +17,21 @@ jobs:
django-version: "3.2"
- python-version: "3.12"
django-version: "3.2"
# django 5.0 is not compatible with python 3.9 or lower
- python-version: "3.13"
django-version: "3.2"
# django 5.x is not compatible with python 3.9 or lower
- python-version: "3.7"
django-version: "5.0"
django-version: "5.1"
- python-version: "3.8"
django-version: "5.0"
django-version: "5.1"
- python-version: "3.9"
django-version: "5.0"
django-version: "5.1"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -39,9 +41,10 @@ jobs:
pip install -r requirements.txt
pip install "Django~=${{ matrix.django-version }}.0" .

- name: Run mypy
- name: Run type checking
run: |
python -m mypy dj_database_url
python -m pyright dj_database_url

- name: Run Tests
run: |
Expand All @@ -50,10 +53,11 @@ jobs:
coverage report
coverage xml

- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4

- name: Check mypy types installation
- name: Check types installation
run: |
pip install .
cd tests
python -m mypy .
python -m pyright .
6 changes: 3 additions & 3 deletions dj_database_url/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Register database schemes in URLs.
for key in SCHEMES.keys():
urlparse.uses_netloc.append(key)
del key
del key # pyright: ignore[reportPossiblyUnboundVariable]


# From https://docs.djangoproject.com/en/4.0/ref/settings/#databases
Expand Down Expand Up @@ -70,7 +70,7 @@ def config(
conn_health_checks: bool = False,
disable_server_side_cursors: bool = False,
ssl_require: bool = False,
test_options: Optional[Dict] = None,
test_options: Optional[Dict[str, Any]] = None,
) -> DBConfig:
"""Returns configured DATABASE dictionary from DATABASE_URL."""
s = os.environ.get(env, default)
Expand Down Expand Up @@ -101,7 +101,7 @@ def parse(
conn_health_checks: bool = False,
disable_server_side_cursors: bool = False,
ssl_require: bool = False,
test_options: Optional[dict] = None,
test_options: Optional[Dict[str, Any]] = None,
) -> DBConfig:
"""Parses a database URL."""
if url == "sqlite://:memory:":
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ show_error_codes=true
disallow_untyped_defs=true
disallow_untyped_calls=true
warn_redundant_casts=true

[tool.pyright]
typeCheckingMode = "strict"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage
mypy
pyright
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from setuptools import setup
from setuptools import setup # pyright: ignore[reportUnknownVariableType]

readme = Path("README.rst").read_text()

Expand Down Expand Up @@ -31,7 +31,7 @@
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
Expand All @@ -46,5 +46,6 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
)
2 changes: 2 additions & 0 deletions tests/test_dj_database_url.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pyright: reportTypedDictNotRequiredAccess=false

import os
import unittest
from unittest import mock
Expand Down
Loading