BradenM / micropy-cli

Micropython Project Management Tool with VSCode support, Linting, Intellisense, Dependency Management, and more!
https://micropy-cli.readthedocs.io
MIT License
314 stars 25 forks source link

Improve pylint path syntax and add ./src/lib #96

Closed Josverl closed 3 years ago

Josverl commented 4 years ago

Hi Braden,

I would like to suggest :

  1. a change in syntax to the generated .pylintrc file to make it cleared to read and modify.
  2. the addition of src/lib path as this is commonly used

current syntax (windows paths )

[MASTER]
# Loaded Stubs:  esp32-micropython-1.11.0 
init-hook='import sys;sys.path.insert(1, ".micropy\\BradenM-micropy-stubs-7a7d171\\frozen");sys.path.insert(1, ".micropy\\BradenM-micropy-stubs-452a204\\frozen");sys.path.insert(1, ".micropy\\BradenM-micropy-stubs-7a7d171\\stubs");sys.path.insert(1,"src\\lib");sys.path.insert(1,"src\\font")'

...

new syntax

[MASTER]
# Loaded Stubs:  esp32-micropython-1.11.0 
init-hook='import sys;sys.path[1:1] = ["src/lib", "src/fonts", ".micropy/BradenM-micropy-stubs-7a7d171/frozen", ".micropy/BradenM-micropy-stubs-452a204/frozen", ".micropy/BradenM-micropy-stubs-7a7d171/stubs",".micropy/thermo"]'
# Note:  when adding paths; also add these paths to: VSCode Preferences > Workspace > python.autoComplete.extraPaths

...

The new syntax has the paths in the right order , is shorter, is simpler to extend with additional paths.

For me this helps in organizing my modules. I think this should be useful to others as well.

/Jos

BradenM commented 4 years ago

Sure, I like this idea. I could also add an additional config option extraPaths that would take an array of paths to add to .pylintrc and python.autoComplete.extraPaths.

Thoughts?

Josverl commented 4 years ago

yes, such an extrapaths would be a nice to have. i think documentation is also relvant if adding that , as it haunted me for quite some time why my src/lib folder was not included while the scr folder was. it seems that the Python Language Service has some magic to add the top level scr folder to the extrapaths even if you do not specify it.

BradenM commented 4 years ago

Agreed. Documentation definitely needs some work. Will try and update it soon. Have not added the configuration option yet, but would love to hear your thoughts on #97. Thanks.