9 Commits
Author SHA1 Message Date
Anders KaseorgandGitHub 41deee4ec6 Update utils.log.log_response type for Django 4.1 (#1183)
https://github.com/django/django/commit/90cf96326432df56a1cf981df215b83f4e993bfd

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-10-06 11:22:20 +03:00
Anders KaseorgandGitHub 9bd8aed1e1 Disable fallback to runtime types for Django settings (#1163)
This fallback to value.__class__ seems to be doing more harm than
good; see #312 and #1162.  Replace it with a clear error message that
suggests a way to fix the problem rather than incompletely papering
over it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-09-24 10:57:45 +03:00
Anders KaseorgandGitHub 041b66a6aa Prevent building an editable wheel with setuptools<64 (#1123)
This seems to be needed for passing CI now.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-08-26 11:55:41 +03:00
Anders KaseorgandGitHub 589f315926 Remove trailing whitespace in README to fix CI failure (#1084)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-08-02 11:07:21 +03:00
Anders KaseorgandGitHub 41804f0e8d Fix OutputWrapper.style_func type (#1080)
style_func has a setter that converts None to lambda x: x, so the
getter cannot return None.

https://github.com/django/django/blob/4.0.6/django/core/management/base.py#L141-L150

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-07-30 12:58:41 +03:00
Anders KaseorgandGitHub 20f0702f86 Tighten management.get_commands type (#1074)
get_commands has not actually returned BaseCommand items since Django
1.4.  See https://github.com/django/django/pull/15876.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-07-24 10:38:32 +03:00
Anders KaseorgandGitHub 3d8d900487 Fix overloads and remove PathLike in finders (#1063)
* Fix overloads in finders

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

* Remove PathLike from finders

Django really requires these paths to be str.  For example, in
FileSystemFinder, .find(path) calls .find_location(…, path, …) which
evaluates path.startswith(prefix) and path[len(prefix) :]; these don’t
work on arbitrary PathLike objects.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-07-22 10:35:24 +03:00
Anders KaseorgandGitHub 214b0c7439 Support cursor.execute(psycopg2.sql.Composable) (#1029)
In addition to str, PostgreSQL cursors accept the
psycopg2.sql.Composable type, which is useful for guarding against SQL
injections when building raw queries that can’t be parameterized in
the normal way (e.g. interpolating identifiers).

In order to avoid reintroducing a dependency on psycopg2, we define a
Protocol that matches psycopg2.sql.Composable.

Documentation: https://www.psycopg.org/docs/sql.html
Related: https://github.com/python/typeshed/pull/7494

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-06-28 23:44:20 +03:00
24a3b22c60 Move mypy version upper bound to a [compatible-mypy] extra (#979)
* Move mypy version upper bound to a [compatible-mypy] extra

Due to a bug in mypy 0.940 (#870), we made two changes in #871:

• pinned mypy==0.931 in requirements.txt (for running our tests);
• bounded mypy<0.940 in setup.py (for downstream users).

After the mypy bug was quickly fixed upstream in 0.941, our setup.py
bound has been repeatedly raised but not removed (#886, #939, #973).
The only changes in those commits have been to the precise wording of
error messages expected in our tests.  Those wording changes don’t
impact compatibility for downstream users, so it should be safe to go
back to allowing them to upgrade mypy independently.

Since mypy doesn’t yet guarantee backwards compatibility in the plugin
API (although in practice it has rarely been an issue), add a
django-stubs[compatible-mypy] extra for users who prefer a known-good
version of mypy even if it’s a little out of date.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

* Update setup.py

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-06-05 00:08:00 +03:00