-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
--install-types can mask failure details #10768
Comments
I'd like to add that I had the same issue when |
…mypy cache directory)' (python/mypy#10768)
Minified example
If you create the cache directory (empty) then it has:
Why does this check even exist? |
Related to issue: python/mypy#10768
MyPy expects the cache directory to be there. We now remove it after each super-linter run to avoid leftovers, so we need to create it before runniny MyPy. See python/mypy#10768 and python/mypy#10863
MyPy expects the cache directory to be there. We now remove it after each super-linter run to avoid leftovers, so we need to create it before running MyPy. See python/mypy#10768 and python/mypy#10863
MyPy expects the cache directory to be there. We now remove it after each super-linter run to avoid leftovers, so we need to create it before running MyPy. See python/mypy#10768 and python/mypy#10863
Related to issue: python/mypy#10768
Still an issue with |
Hi there. Thanks for creating this issue ticket. We would like to add that the same problem is also tripping us on a CI/GHA integration. |
Hi there. Do we expect this issue to be resolved at any moment with any mypy releases? Or the only workaround now is to create .mypy_cache/ in our pipelines? Thanks! |
A follow-up to @jlin880 ...
|
* move py.typed to correct places https://peps.python.org/pep-0561/ says 'For namespace packages (see PEP 420), the py.typed file should be in the submodules of the namespace, to avoid conflicts and for clarity.'. Previously, when I added the py.typed file to this project, #382 , I was unaware this was a namespace package (although, curiously, it seems I had done it right initially and then changed to the wrong way). As PEP 561 warns us, this does create conflicts; other libraries in the databricks namespace package (such as, in my case, databricks-vectorsearch) are then treated as though they are typed, which they are not. This commit moves the py.typed file to the correct places, the submodule folders, fixing that problem. Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * change target of mypy to src/databricks instead of src. I think this might fix the CI code-quality checks failure, but unfortunately I can't replicate that failure locally and the error message is unhelpful Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * Possible workaround for bad error message 'error: --install-types failed (no mypy cache directory)'; see python/mypy#10768 (comment) Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * fix invalid yaml syntax Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * Best fix (#3) Fixes the problem by cding and supplying a flag to mypy (that mypy needs this flag is seemingly fixed/changed in later versions of mypy; but that's another pr altogether...). Also fixes a type error that was somehow in the arguments of the program (?!) (I guess this is because you guys are still using implicit optional) --------- Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * return the old result_links default (#5) Return the old result_links default, make the type optional, & I'm pretty sure the original problem is that add_file_links can't take a None, so these statements should be in the body of the if-statement that ensures it is not None Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> * Update src/databricks/sql/utils.py "self.download_manager is unconditionally used later, so must be created. Looks this part of code is totally not covered with tests 🤔" Co-authored-by: Levko Kravets <levko.ne@gmail.com> Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> --------- Signed-off-by: wyattscarpenter <wyattscarpenter@gmail.com> Co-authored-by: Levko Kravets <levko.ne@gmail.com>
It seems that if the mypy cache dir wasn't created, this code would do an exit, preventing the actual errors from being printed. So I've removed the exit.
I've created a pull request, #17485, that fixes this issue. Turns out it's as simple as removing an early exit. |
Bug Report
When no
.mypy_cache
folder exists and a user runsmypy --install-types --non-interactive ./
, mypy may fail on fundamental issues but suggest that the failure was because of "no mypy cache directory," confusing the user.To Reproduce
I've created a minimum reproducible example. Please find it here.
I summarize the example below.
Expected Behavior
For the source tree
where all files are empty except
main.py
, which might containwe expect running
mypy --install-types --non-interactive ./
at the root of the source tree to either (1) generate the.mypy_cache
and then report any typing errors or (2) explain why it cannot generate the cache.Actual Behavior
mypy fails because
b.lib
duplicatesa.lib
by name in the same module. However, mypy does not report the duplicate module error. Instead, it only reportserror: --install-types failed (no mypy cache directory)
.This behavior is particularly confusing in CI, where our environment has no preexisting
.mypy_cache
and where an unsuspecting user may accidentally cause the duplicate-module behavior. mypy fails and suggests it's because of the missing cache directory.(Deeper demonstration is in the reproducible example linked above. In short, if mypy finds an empty
.mypy_cache
folder, it will report the duplicate module issue. If we place__init__.py
ina
andb
and remove.mypy_cache
, mypy will install the cache correctly and report the typing error.)My Environment
Related to #10600 .
The text was updated successfully, but these errors were encountered: