Giter VIP home page Giter VIP logo

Comments (5)

elarivie avatar elarivie commented on September 28, 2024

Hello @keisuke-nakata

  1. Your request is highly similar to this other request: elarivie/atom-python-linters#6 (comment)

The solution is to create a python wrapper script which embed the logic for your specific use case.

  1. When editing the linter-mypy settings for the Python Executable Path you have the possibility to use the variables $PROJECT_PATH and $PROJECT_NAME
    so you can specify different executable per project using those

Using the above two points you can adapt python calls to your specific use case

Note: linter-mypy does not have the concept of default python but this could be a logic that you implement in a python wrapper script.

Let me know if it solves your issue

from linter-mypy.

keisuke-nakata avatar keisuke-nakata commented on September 28, 2024

@elarivie
Great! It looks pretty smart, however, on my Atom, $PROJECT_NAME was not available in the wrapper script.
It seems that the $PROJECT_NAME is only used for resolving Python Executable Path itself and not passed into the Python Executable.

from linter-mypy.

keisuke-nakata avatar keisuke-nakata commented on September 28, 2024

I tried setting PROJECT_NAME=$PROJECT_NAME /some/path/to/pythonwrapper.sh as Python Executable Path, but it didn't work. (linter-mypy regards it as a command containing a space)

from linter-mypy.

keisuke-nakata avatar keisuke-nakata commented on September 28, 2024

I never think this is the optimal, but setting some/path/to/pythonwrapper.sh as Python Executable Path and $PROJECT_NAME as Mypy Path worked.
(Because I'm not using MYPYPATH right now 🙄 )

pythonwrapper.sh:

#!/bin/sh

PROJECT_NAME=$MYPYPATH
unset $MYPYPATH
PYENVDIR="/Users/keisuke.nakata/.pyenv/versions/${PROJECT_NAME}"

if [ -d ${PYENVDIR} ]; then
  PYTHONEXECUTABLE=${PYENVDIR}/bin/python
else
  PYTHONEXECUTABLE=python
fi

$PYTHONEXECUTABLE "$@"

exit $?

from linter-mypy.

elarivie avatar elarivie commented on September 28, 2024

Hello @keisuke-nakata,

I am glad that you now have a solution for your specific use case.

About MYPYPATH, if you ever need it you'll be able to add it directly within the wrapper script just before calling the real python executable.

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.