Comments (7)
I can confirm that the plugin is not taking advantage of cache-dir
.
from linter-mypy.
Hello @JBKahn and @conanfanli,
The current linter-mypy implementation handles cache-dir like that:
A unique cache-dir is currently being created in the OS temp folder for each file being linted (opened in a text editor) (it uses the md5 of the file path as a unique signature).
This way, any future lint call for a given file will use its cache data from previous call.
This strategy is maybe not fully optimal but:
- it works fine when multiple project folder are open by atom
- it correctly handle when a single file is opened by atom.
- there is no risk of mixing up cache with unrelated stuff.
Effectively with this strategy, the cache-dir folder is not shareable with other external tools.
I am curious to know what is your use case precisely.
How do you share cache dir?
- Do you use the defaults .mypy_cache being created by Mypy in every folder of your source?
- Do you use the same cache directory for all your projects on your computer (even if they are unrelated)?
- Do you use a single cache directory somewhere within your project tree?
Note: I am not a fan of tools polluting source code with temp/cache data so
that's why I implemented this strategy which benefits from cache data while
not creating cache data in the source of the project.
What exactly do you confirm? how did you come to that conclusion (one minute after the bug was created)?
- Did you check the mypy arguments being sent?
- Did you check the cache-dir content?
- Which OS, which Atom/Mypy/Python/linter-mypy version do you use?
- ...?
What exactly makes you conclude that "it is not taking advantage of cache-dir."? Which missing behavior would make it takes advantage of cache-dir?
from linter-mypy.
The problem with this strategy is that large projects with large numbers of files and imports don't share cache across the project. So each time I open a new file, it takes minutes to finish running. In an ideal world, and the way I try to use it is to have a mypy_cache
at the root of the folder for each project. Even if you didn't make it configurable, the default (making the md5 part optional) would cache this in a way that the rest of the files could make use of.
from linter-mypy.
@JBKahn
I added the possibility to specify the cache folder to use.
It now supports the following four options:
1- No cache data (by setting the path to "/dev/null")
2- Cache data in a unique temp folder for each file (by setting the path to empty string) 🡐 By Default
3- Using a specific folder (may use $PROJECT_PATH and $PROJECT_NAME to define the path)
- Note: If when linting the folder does not exists, it silently fallbacks to # 2
4- Mypy default behavior, by using/creating a folder named .mypy_cache in the same folder as the file being linted (by setting the path to a dot ".")
@JBKahn, Could you test to see if using the code present in the commit 3519521 works well for your setup.
If everything is good, I'll soon push a new release.
from linter-mypy.
Works great for me
from linter-mypy.
This is now available in linter-mypy v2.6.0
from linter-mypy.
Thanks @elarivie
from linter-mypy.
Related Issues (20)
- Feature request: Add $PROJECT_PATH and $PROJECT_NAME resolution for MYPYPATH setting. HOT 3
- Add option to only check repos where mypy.ini is present HOT 3
- Object.dirname is deprecated. HOT 2
- Doesn't find imports >= 5 levels deep HOT 1
- Unable to find installed modules HOT 3
- UnicodeEncodeError HOT 1
- Does not seem to work with pipenv HOT 2
- Can't detect mypy anymore HOT 9
- linter-mypy generating many duplicate errors HOT 2
- Read settings from setup.cfg HOT 2
- Does not recognise typed_ast package HOT 5
- Errors are shown on incorrect files HOT 3
- Option to start the mypy process from the (Atom) project directory? HOT 3
- Package is showing internal mypy errors although turned off HOT 6
- (semi-) colon separated Python Executable Path? HOT 5
- Are mypy plugins supported ? HOT 5
- Unable to find mypy, despite correct $PATH and settings HOT 3
- How can I set $MYPYPATH so that the linter will pick up on it? HOT 1
- $PROJECT_NAME is invalid in case project folder contains dot. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linter-mypy.