python / python/mypy

pynamodb_mypy plugin issue

Open
#20,746 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-plugins
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report
Issue related to pynamodb_mypy:

Traceback (most recent call last):
  File "mypy/checkexpr.py", line 6103, in accept
  File "mypy/checkexpr.py", line 6138, in accept_maybe_cache
  File "mypy/nodes.py", line 2289, in accept
  File "mypy/checkexpr.py", line 508, in visit_call_expr
  File "mypy/checkexpr.py", line 645, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1496, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1589, in check_call
  File "mypy/checkexpr.py", line 1832, in check_callable_call
  File "mypy/checkexpr.py", line 1270, in apply_function_plugin
  File "/Users/style/cfa/d20-functions/.venv/lib/python3.12/site-packages/pynamodb_mypy/plugin.py", line 150, in _get_function_hook__pynamodb_attribute__init__
    self._inspect_pynamodb_attribute_init(ctx)
  File "/Users/style/cfa/d20-functions/.venv/lib/python3.12/site-packages/pynamodb_mypy/plugin.py", line 207, in _inspect_pynamodb_attribute_init
    attr_type = get_descriptor_access_type(ctx.context, internal_api, attr_instance)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/style/cfa/d20-functions/.venv/lib/python3.12/site-packages/pynamodb_mypy/_private_api.py", line 20, in get_descriptor_access_type
    mypy.checkmember.MemberContext(
TypeError: 'msg' is an invalid keyword argument for __init__()

Your Environment

  • Mypy version used: 1.19.1
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
packages = ['app', "slack_app", ]
python_version = "3.12"
strict = true
plugins = ['pynamodb_mypy']
exclude = [
    '.*/site-packages/.*',
    'otp',
    '^app/test',
    '^slack_app/test',
]
  • Python version used: 3.12.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with Python 3.12.2, mypy 1.19.1, the shown strict configuration, and --show-traceback. Then inspect pynamodb_mypy/plugin.py and pynamodb_mypy/_private_api.py around _inspect_pynamodb_attribute_init and get_descriptor_access_type, comparing the MemberContext call; done means the same check completes without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.