Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

mypy doesn't work as expected #502

Open
KimiWu123 opened this issue Nov 26, 2023 · 1 comment
Open

mypy doesn't work as expected #502

KimiWu123 opened this issue Nov 26, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@KimiWu123
Copy link
Contributor

We do type checking by executing make type and the output is

MYPATH=src mypy .
Success: no issues found in 19 source files

There is no reason it only checks 19 files so I print the logs out by adding -v and it shows

...
LOG:  Cache Dir:              .mypy_cache
LOG:  Compiled:               True
LOG:  Exclude:                ["['build']"]
LOG:  Found source:           BuildSource(path='./tests/evm/test_comparator.py', module='test_comparator', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_create.py', module='test_create', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_oog_constant.py', module='test_error_oog_constant', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_oog_create.py', module='test_error_oog_create', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_oog_exp.py', module='test_error_oog_exp', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_oog_memory_copy.py', module='test_error_oog_memory_copy', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_oog_sha3.py', module='test_error_oog_sha3', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_error_stack.py', module='test_error_stack', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_exp.py', module='test_exp', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_gas.py', module='test_gas', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_memory.py', module='test_memory', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_not.py', module='test_not', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_pop.py', module='test_pop', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_sar.py', module='test_sar', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_sha3.py', module='test_sha3', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_sstore.py', module='test_sstore', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/evm/test_stop.py', module='test_stop', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests/evm', followed=False)
LOG:  Found source:           BuildSource(path='./tests/common.py', module='common', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests', followed=False)
LOG:  Found source:           BuildSource(path='./tests/conftest.py', module='conftest', has_text=False, base_dir='/Users/kimi/CODE/pse/zkevm-specs/tests', followed=False)
...

From the logs, we can see that mypy only checks some of testing files and no any circuit files are checked. It seems not fitting our expectation since our path is src (MYPATH=src). Besides, it only checks part of testing files not all testing files. We should investigate what happened.

@ChihChengLiang , could you help confirm if this issue makes sense to you?

@ChihChengLiang
Copy link
Collaborator

Hi @KimiWu123,
I can reproduce this issue on my local side. It looks like the fix in #430 no longer worked.
I also found that moving the configuration from setup.cfg to pyproject.toml fix the issue https://github.com/privacy-scaling-explorations/zkevm-specs/compare/fix-mypy?expand=1.
The fixed configuration introduces many typing errors that need to be fixed too, so it might be a good idea to leave the fix as a good first issue. For contributors, you can build on top of this commit, run make type, and then address errors reported by mypy.

@KimiWu123 KimiWu123 added the good first issue Good for newcomers label Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

2 participants