Giter VIP home page Giter VIP logo

Comments (7)

conanfanli avatar conanfanli commented on July 1, 2024

I can confirm that the plugin is not taking advantage of cache-dir.

from linter-mypy.

elarivie avatar elarivie commented on July 1, 2024

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.

@JBKahn

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.


@conanfanli

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.

JBKahn avatar JBKahn commented on July 1, 2024

@elarivie

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.

elarivie avatar elarivie commented on July 1, 2024

@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.

JBKahn avatar JBKahn commented on July 1, 2024

Works great for me

from linter-mypy.

elarivie avatar elarivie commented on July 1, 2024

@JBKahn, @conanfanli

This is now available in linter-mypy v2.6.0

from linter-mypy.

JBKahn avatar JBKahn commented on July 1, 2024

Thanks @elarivie

from linter-mypy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.