utkarshgupta137 / atom-formatters-python

Python Formatters for Atom Editor

Home Page:https://atom.io/packages/formatters-python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow relative/multiple paths for formatter binaries.

SalomonSmeke opened this issue · comments

Hello! Just saw this package as an open issue on atom-isort; glad to have an active formatter package!

My main gripe with atom-isort is the lack of paths relative to the project for specifying binaries. Other packages like linter-pylint allow it like so:

Path to your pylint executable. This is useful if you have different versions of pylint for Python 2 and 3 or if you are using a virtualenv. Use %p for the current project (no trailing /).

If this sounds reasonable I can look into making a PR. Double bonus points for having a comma separated list of paths.

I guess the proper solution to this problem would be to have separately configurable local & global bin paths, like config file paths? But then we'll probably also want separate cmd args?
While I don't mind adding these options, it will make the package settings quite clobbered. I'd like to come up with a way to add these options while keeping the formatter settings streamlined.

Multiple paths certainly increases this. But does adding "%p" as a relative reference? You would still have the option of just not using it.

Yes, but at some point, someone will want a global alternative as a fallback.

Truth! Comma separated paths were intended to solve that. %p/env/bin/isort,isort; for example.

Either way. Perhaps that's puntable until someone does ask for the fallback.

If it's worth doing, it's worth doing it right.
I'll have a look at it soon.

Any news on this? It seems to be best practice in atom packages to be able to set fallback paths and use variables like %PROJECT and %PROJECT_NAME. It’s frustrating to have to change the path in the setting every time I’m working on a different project… Otherwise this package would fit my needs perfectly!

Hey, I've pushed a few commits that should add what you're asking. Can you test it to see if it covers what you asked?

Steps:

  • clone this repo
  • cd into it
  • npm i
  • apm link
  • restart atom

Closed with v1.2.0

@utkarshgupta137 FYI this new version works well for my use cases. Thank you.