From: Daniele Varrazzo Date: Fri, 27 Dec 2024 01:44:43 +0000 (+0100) Subject: chore: ignore certain files from mypy linting X-Git-Tag: 3.2.4~7^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1485b6940eb420f08d5fe8c5e5bc07bbd006b765;p=thirdparty%2Fpsycopg.git chore: ignore certain files from mypy linting Something weird happens. Certain files pass mypy lint on their own, but not in combination. This is mostly related to `psycopg/pq/pq_ctypes.py` and `psycopg/pq/_pq_ctypes.py`. This problem seems largely related to incomplete ctypes definitions. --- diff --git a/docs/lib/libpq_docs.py b/docs/lib/libpq_docs.py index b638c63b4..a5488d151 100644 --- a/docs/lib/libpq_docs.py +++ b/docs/lib/libpq_docs.py @@ -1,3 +1,4 @@ +# mypy: ignore-errors """ Sphinx plugin to link to the libpq documentation. diff --git a/docs/lib/pg3_docs.py b/docs/lib/pg3_docs.py index 674f2d7c0..07fcea27c 100644 --- a/docs/lib/pg3_docs.py +++ b/docs/lib/pg3_docs.py @@ -1,3 +1,4 @@ +# mypy: ignore-errors """ Customisation for docs generation. """ diff --git a/docs/lib/sql_role.py b/docs/lib/sql_role.py index a40c9f404..e87d6f5be 100644 --- a/docs/lib/sql_role.py +++ b/docs/lib/sql_role.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# mypy: ignore-errors """ sql role ~~~~~~~~ diff --git a/psycopg/psycopg/pq/pq_ctypes.py b/psycopg/psycopg/pq/pq_ctypes.py index 8335f87f7..27f0b0fed 100644 --- a/psycopg/psycopg/pq/pq_ctypes.py +++ b/psycopg/psycopg/pq/pq_ctypes.py @@ -1,3 +1,5 @@ +# mypy: ignore-errors + """ libpq Python wrapper using ctypes bindings. diff --git a/psycopg_c/setup.py b/psycopg_c/setup.py index eeea1c945..b122ee2ec 100644 --- a/psycopg_c/setup.py +++ b/psycopg_c/setup.py @@ -42,7 +42,7 @@ class psycopg_build_ext(build_ext): # In the sdist there are not .pyx, only c, so we don't need Cython. # Otherwise Cython is a requirement and it is used to compile pyx to c. if os.path.exists("psycopg_c/_psycopg.pyx"): - from Cython.Build import cythonize + from Cython.Build import cythonize # type: ignore # Add include and lib dir for the libpq. includedir = get_config("includedir") @@ -97,5 +97,5 @@ pqext = Extension( setup( ext_modules=[pgext, pqext], - cmdclass={"build_ext": psycopg_build_ext}, + cmdclass={"build_ext": psycopg_build_ext}, # type: ignore ) diff --git a/pyproject.toml b/pyproject.toml index 64d9ae427..4e76bc8e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,18 +37,23 @@ show_error_codes = true disable_bytearray_promotion = true disable_memoryview_promotion = true strict = true +exclude = '''(?x)( + ^ build/ + | docs/lib/.*\.py + | psycopg/build/ + | psycopg_binary/build/ + | psycopg_c/build/ + | psycopg_pool/build/ + | tools/build/pg_config_vcpkg_stub/build/ +)''' [[tool.mypy.overrides]] module = [ - "shapely.*", "numpy.*", + "shapely.*", ] ignore_missing_imports = true -[[tool.mypy.overrides]] -module = "uvloop" -ignore_missing_imports = true - [[tool.mypy.overrides]] module = "tests.*" check_untyped_defs = true diff --git a/tools/update_backer.py b/tools/update_backer.py index 00885276d..35cfc48fe 100755 --- a/tools/update_backer.py +++ b/tools/update_backer.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -r"""Add or edit github users in the backers file +# mypy: ignore-errors +"""Add or edit github users in the backers file """ import sys