You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy investment_transaction.py --show-traceback bombs with INTERNAL ERROR on line 35. Line 35 of the file is
class InvestmentTransaction(db.Base):
There are dozens of files with this same class inheritance pattern. This particular class (a sqlalchemy model) has both id and type members, but that's not been a problem before.
Traceback
src/moneykit_core/core/models/investment_transaction.py:35: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.9.0+dev.91be28552e062601adc2a07075263994c102d5cc
Traceback (most recent call last):
File "/Users/michael/dev/moneykit/moneykit-api/.venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/main.py", line 100, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/main.py", line 182, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/build.py", line 191, in build
result = _build(
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/build.py", line 265, in _build
graph = dispatch(sources, manager, stdout)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/build.py", line 2943, in dispatch
process_graph(graph, manager)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/build.py", line 3341, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/build.py", line 3436, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal_main.py", line 93, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal_main.py", line 220, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal_main.py", line 349, in semantic_analyze_target
analyzer.refresh_partial(
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 597, in refresh_partial
self.refresh_top_level(node)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 608, in refresh_top_level
self.accept(d)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 6539, in accept
node.accept(self)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/nodes.py", line 1142, in accept
return visitor.visit_class_def(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 1612, in visit_class_def
self.analyze_class(defn)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 1697, in analyze_class
self.analyze_class_body_common(defn)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 1731, in analyze_class_body_common
self.apply_class_plugin_hooks(defn)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/mypy/semanal.py", line 1816, in apply_class_plugin_hooks
hook(ClassDefContext(defn, base_expr, self))
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/plugin.py", line 258, in _base_cls_hook
decl_class.scan_declarative_assignments_and_apply_types(ctx.cls, ctx.api)
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/decl_class.py", line 96, in scan_declarative_assignments_and_apply_types
_scan_declarative_assignment_stmt(
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/decl_class.py", line 459, in _scan_declarative_assignment_stmt
python_type_for_type = infer.infer_type_from_right_hand_nameexpr(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/infer.py", line 52, in infer_type_from_right_hand_nameexpr
python_type_for_type = _infer_type_from_decl_column(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/infer.py", line 410, in _infer_type_from_decl_column
return _infer_type_from_left_and_inferred_right(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michael/dev/moneykit/moneykit-api/.venv/lib/python3.11/site-packages/sqlalchemy/ext/mypy/infer.py", line 457, in _infer_type_from_left_and_inferred_right
format_type(orig_left_hand_type),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: format_type() missing 1 required positional argument: 'options'
src/moneykit_core/core/models/investment_transaction.py:35: : note: use --pdb to drop into pdb
To Reproduce
mypy {that file} generates the error. It bombs on v1.5.1, v.1.7.1, and the latest dev version. I can't share the source file, unfortunately.
My Environment
Mypy version used: 1.5.1, 1.7.1, and latest mypy 1.9.0+dev.91be28552e062601adc2a07075263994c102d5cc
sqlalchemy2-stubs version: 0.0.2a37
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
Python version used: 3.11.5
Operating system and version: MacOS 14.1.2
The text was updated successfully, but these errors were encountered:
that's a SQLAlchemy mypy-plugin error that was resolved in SQLAlchemy 1.4.49 and 2.0.17. It is specific to using Mypy 1.4 or above. so you want to upgrade to one of those SQLAlchemy versions if you are on mypy 1.4 or greater (which you should be unless this is some very legacy environment).
Crash Report
mypy investment_transaction.py --show-traceback
bombs with INTERNAL ERROR on line 35. Line 35 of the file isThere are dozens of files with this same class inheritance pattern. This particular class (a sqlalchemy model) has both id and type members, but that's not been a problem before.
Traceback
To Reproduce
mypy {that file}
generates the error. It bombs on v1.5.1, v.1.7.1, and the latest dev version. I can't share the source file, unfortunately.My Environment
mypy 1.9.0+dev.91be28552e062601adc2a07075263994c102d5cc
The text was updated successfully, but these errors were encountered: