dj-database-url icon indicating copy to clipboard operation
dj-database-url copied to clipboard

Use typing.Dict type

Open akx opened this issue 4 months ago • 5 comments

15ac40b0a78484575cb41f7a1e1ab6cdceea9e3a had added a Optional[dict[str, Any]] annotation (notice the non-capital d), which inadvertently caused this project to not be compatible with Python 3.8, where dict the type is not subscriptable until 3.9, which causes build problems in downstream packages since there is no official requires_python marker in the package metadata for 3.x, so old Pythons will happily try to install the newer versions.

This PR applies the minimal fix for this that makes this package again importable on Python 3.8 – I would recommend releasing this as dj-database-url==3.0.2 to minimize downstream user misery, then follow up with fixing things properly.

akx avatar Aug 20 '25 08:08 akx

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 100.00%. Comparing base (7cc1121) to head (c44e599). :warning: Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #271   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          130       130           
  Branches        14        14           
=========================================
  Hits           130       130           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Aug 20 '25 08:08 codecov[bot]

Hi @akx this project no longer supports 3.8 as it's out of support. Hence we are using dict over Dict. Unless there is a really compelling reason I see no reason to make this change.

mattseymour avatar Sep 02 '25 08:09 mattseymour

Please see the PR description. The current latest released version on PyPI doesn't declare it's 3.9+, so it will be installed on 3.8 Pythons, and then fail at runtime.

akx avatar Sep 02 '25 08:09 akx

Ah sorry missed that, in that case the issue is with the metadata in the support of python versions; the support of versions should be fixed instead.

mattseymour avatar Sep 02 '25 08:09 mattseymour

@mattseymour Yes, that's #273. But it doesn't fix that there are versions out there on PyPI that claim to work on 3.8, but don't.

In particular, if any of the projects depending on this package haven't pinned their dj-database-url version (shame on them) and are still on 3.8, they'll get a non-working project.

akx avatar Sep 02 '25 10:09 akx