Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy adds 3k+ json files to the diff #2500

Closed
purva-thakre opened this issue Sep 11, 2024 · 7 comments
Closed

mypy adds 3k+ json files to the diff #2500

purva-thakre opened this issue Sep 11, 2024 · 7 comments
Labels
bug Something isn't working non-quantum Requires no knowledge of quantum physics to fix / work on.

Comments

@purva-thakre
Copy link
Contributor

purva-thakre commented Sep 11, 2024

There has been some change to the configuration settings of mypy. Whenever make check-types is run, json files are gradually added.

My local dev environment might also be causing this. 🤷🏾‍♀️

@purva-thakre purva-thakre mentioned this issue Sep 11, 2024
6 tasks
@purva-thakre purva-thakre added bug Something isn't working non-quantum Requires no knowledge of quantum physics to fix / work on. labels Sep 11, 2024
@cosenal
Copy link
Contributor

cosenal commented Sep 11, 2024

The .mypy_cache/, which is the one containing those json files, is created by mypy with a .gitignore file in it, which prevents those files showing up in git. Most likely this doesn't happen in your environment.
Closing as it's not an issue with Mitiq, but share more abour environment (OS, python version, mypy version, ..) and we'll try to debug.

@cosenal cosenal closed this as completed Sep 11, 2024
@purva-thakre
Copy link
Contributor Author

Closing as it's not an issue with Mitiq

@cosenal I created this issue because I think we have to add .mypy_cache/ to the gitignore file.

.DS_Store

@purva-thakre
Copy link
Contributor Author

purva-thakre commented Sep 11, 2024

Information about my local environment:

Mitiq Version:	0.40.0dev

Core Dependencies
-----------------
Cirq Version:	1.4.0
NumPy Version:	1.26.4
SciPy Version:	1.14.1

Optional Dependencies
---------------------
PyQuil Version:	3.5.4
Qiskit Version:	Not installed
Braket Version:	1.69.1

Python Version:	3.12.4
Platform Info:	Linux (x86_64)

Additional Python Environment Details (from pip freeze):

``` accessible-pygments==0.0.5 alabaster==1.0.0 amazon-braket-default-simulator==1.21.1 amazon-braket-schemas==1.20.2 amazon-braket-sdk==1.69.1 antlr4-python3-runtime==4.9.2 anyio==4.4.0 appdirs==1.4.4 asttokens==2.4.1 attrs==21.4.0 autograd==1.7.0 autoray==0.6.12 babel==2.16.0 backoff==2.2.1 beautifulsoup4==4.12.3 bleach==6.1.0 boltons==24.0.0 boto3==1.35.15 botocore==1.35.15 bqskit==1.1.1 bqskitrs==0.4.1 cachetools==5.5.0 certifi==2024.8.30 cffi==1.17.1 charset-normalizer==3.3.2 cirq-core==1.4.0 cirq-ionq==1.4.0 cirq-rigetti==1.4.0 click==8.1.7 cloudpickle==2.2.1 cma==3.4.0 comm==0.2.2 contourpy==1.3.0 coverage==7.6.1 cryptography==43.0.1 cycler==0.12.1 debugpy==1.8.5 decorator==5.1.1 defusedxml==0.7.1 Deprecated==1.2.14 deprecation==2.1.0 dill==0.3.8 docutils==0.21.2 duet==0.2.9 execnet==2.1.1 executing==2.1.0 fastjsonschema==2.20.0 fonttools==4.53.1 future==1.0.0 greenlet==3.0.3 h11==0.14.0 h5py==3.11.0 httpcore==0.16.3 httpx==0.23.3 hyperopt==0.2.7 ibm-cloud-sdk-core==3.20.6 ibm-platform-services==0.57.0 idna==3.8 imagesize==1.4.1 importlib_metadata==8.4.0 iniconfig==2.0.0 ipykernel==6.29.5 ipython==8.27.0 iso8601==1.1.0 jedi==0.19.1 Jinja2==3.1.4 jmespath==1.0.1 joblib==1.4.2 jsonschema==4.17.3 jupyter-cache==1.0.0 jupyter_client==8.6.2 jupyter_core==5.7.2 jupyterlab_pygments==0.3.0 jupytext==1.16.1 kiwisolver==1.4.7 lark==0.11.3 lark-parser==0.12.0 latexcodec==3.0.0 markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib==3.8.1 matplotlib-inline==0.1.7 mdit-py-plugins==0.4.2 mdurl==0.1.2 mistune==3.0.2 -e git+https://github.com/unitaryfund/mitiq.git@3db2817#egg=mitiq mpmath==1.3.0 msgpack==1.1.0 mypy==1.0.0 mypy-extensions==1.0.0 myst-nb==1.1.1 myst-parser==4.0.0 nbclient==0.10.0 nbconvert==7.16.4 nbformat==5.10.4 nbsphinx==0.9.3 nest-asyncio==1.6.0 networkx==3.3 numpy==1.26.4 openfermion==1.6.1 openfermionpyscf==0.5 openpulse==1.0.0 openqasm3==1.0.0 opt-einsum==3.3.0 oqpy==0.3.6 packaging==24.1 pandas==2.1.3 pandocfilters==1.5.1 parso==0.8.4 pbr==6.1.0 PennyLane==0.36.0 PennyLane-qiskit==0.36.0 PennyLane_Lightning==0.37.0 pexpect==4.9.0 pillow==10.4.0 platformdirs==4.3.2 pluggy==1.5.0 ply==3.11 prompt_toolkit==3.0.47 psutil==6.0.0 ptyprocess==0.7.0 PubChemPy==1.0.4 pure_eval==0.2.3 py4j==0.10.9.7 pybtex==0.24.0 pybtex-docutils==1.0.3 pycparser==2.22 pydantic==1.10.18 pydata-sphinx-theme==0.15.4 Pygments==2.18.0 PyJWT==2.9.0 pyparsing==3.1.4 pyqrack==1.30.22 pyquil==3.5.4 pyrsistent==0.20.0 pyscf==2.6.2 pyspnego==0.11.1 pytest==8.0.0 pytest-cov==5.0.0 pytest-xdist==3.0.2 python-dateutil==2.9.0.post0 python-rapidjson==1.20 pytz==2024.1 PyYAML==6.0.2 pyzmq==26.2.0 qcs-api-client==0.21.6 qibo==0.2.10 qiskit==1.2.0 qiskit-aer==0.15.0 qiskit-ibm-provider==0.11.0 qiskit-ibm-runtime==0.20.0 qulacs==0.6.4.1 requests==2.32.3 requests_ntlm==1.3.0 retrying==1.3.4 rfc3339==6.2 rfc3986==1.5.0 rpcq==3.11.0 ruamel.yaml==0.18.6 ruamel.yaml.clib==0.2.8 ruff==0.3.1 rustworkx==0.15.1 s3transfer==0.10.2 scipy==1.14.1 seaborn==0.13.0 semantic-version==2.10.0 setuptools==70.3.0 six==1.16.0 sniffio==1.3.1 snowballstemmer==2.2.0 sortedcontainers==2.4.0 soupsieve==2.6 Sphinx==8.0.2 sphinx-autodoc-typehints==2.0.0 sphinx-copybutton==0.5.2 sphinx-gallery==0.15.0 sphinx-tags==0.4 sphinx_design==0.6.1 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-bibtex==2.6.2 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 SQLAlchemy==2.0.34 stack-data==0.6.3 stevedore==5.3.0 stim==1.13.0 stimcirq==1.13.0 symengine==0.11.0 sympy==1.13.2 tabulate==0.9.0 tenacity==8.5.0 tinycss2==1.3.0 toml==0.10.2 tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 types-Deprecated==1.2.9.20240311 types-python-dateutil==2.9.0.20240906 types-retry==0.9.9.4 types-tabulate==0.9.0.20240106 typing_extensions==4.12.2 tzdata==2024.1 urllib3==2.2.2 wcwidth==0.2.13 webencodings==0.5.1 websocket-client==1.8.0 websockets==13.0.1 wheel==0.43.0 wrapt==1.16.0 zipp==3.20.1 ```

@cosenal
Copy link
Contributor

cosenal commented Sep 12, 2024

Closing as it's not an issue with Mitiq

@cosenal I created this issue because I think we have to add .mypy_cache/ to the gitignore file.

.DS_Store

There is no need for an explicit rule in the main .gitignore, since the .mypy_cache folder already includes its own .gitignore file by defailt, which is automatically generated by the MyPy tool.
On other other hand, if you want to add the rule explicitly in the main .gitignore, it won't hurt.

@purva-thakre
Copy link
Contributor Author

purva-thakre commented Sep 12, 2024

since the .mypy_cache folder already includes its own .gitignore file by default

I think I'm blind because I can't find this .gitignore file in #2501

Do you see this file generated locally? Maybe something is wrong with my local environment.

On other other hand, if you want to add the rule explicitly in the main .gitignore, it won't hurt.

Yes, I think this might be a better option. I see the repo for mypy does include mypy_cache/ in the main .gitignore file.

https://github.com/python/mypy/blob/0c1036717578b00e35625cc353a538e4eb63bc37/.gitignore#L14

@cosenal
Copy link
Contributor

cosenal commented Sep 12, 2024

I think I'm blind because I can't find this .gitignore file in #2501

Well, that's the problem. For some reasons, which I don't know, in your specific environment, that file is not generated. If it were, you wouldn't see any cache file at all in your git diff.
As I said in my previous comment, feel free to add a rule to the main .gitignore.

purva-thakre added a commit that referenced this issue Sep 12, 2024
@purva-thakre
Copy link
Contributor Author

Well, that's the problem. For some reasons, which I don't know, in your specific environment, that file is not generated.

I think this might be a mypy bug on linux. I found a similar issue for windows in the project repo.

python/mypy#8756

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-quantum Requires no knowledge of quantum physics to fix / work on.
Projects
None yet
Development

No branches or pull requests

2 participants