Black Mamba - IDE & Jump to definition
zrzka last edited by zrzka
As I stated before, Black Mamba's goal is not provide just shortcuts, but other useful features as well. Today I released version 0.0.23 which introduces package
blackmamba.project. How is the project defined from Black Mamba point of view?
Project is a folder which does contain
.blackmambafolder. If you open a file in Pythonista, hit
Cmd Shift D, it traverses parent directories until it finds
.blackmambaand that's the current project root folder. Then it indexes all Python files in the project and allows you to jump to definition. If Black Mamba finds definition (one), it opens file and scrolls to the definition location. If there're more locations, dialog appears and you can select location you want to scroll to. Here's the screenshot.
.blackmambafolder? Whenever I find project root folder (via
.gitfor example if
.blackmambadoesn't exist), I save definitions index file into this folder (
.blackmamba/index.pickle). Next time you would like to jump to definition, index is loaded. Also the whole project is reindexed every time you would like to jump to definition (max once a minute). No need to do it manually. This can be controller by config via
project.index.rate(default value is
If you'd like to try this feature and don't have
.gitfolder in any of your parent directories, just open StaSh and create empty
.blackmambafolder in your project root. Then it will work. I do not want index whole
I miss a lot things like this one. Current implementation is an experiment, should work, but can't guarantee it will work on slower / older devices. Using latest & greatest iPad Pro and I didn't care about memory & optimisation for this release (will care, don't worry).
Anyway, why I started separate topic. Anyone else does miss features from big IDEs (like PyCharm)? If so, let me know which ones and I'll add them.
JonB last edited by
I wonder, have you trid parsing the existing jedi data (used for autocomplete)?-- I forget whether the caches include folder info, or just module names.
zrzka last edited by
@JonB honestly, not yet. I never used Jedi and didn't have time to fully investigate how it works. It was faster to hack ast & pickle definitions. Not the perfect solution, but good enough to demonstrate the feature. That was the main goal for now, show this feature and get some feedback if people are missing things like this one in Pythonista or not. If so, I'll implement more robust solution with more features. Like find usages, etc. One thing which is unclear to me is that Jedi docs state that it's not thread safe. I have no clue how / when Pythonista does use it, do not want to cripple autocompletion. Another one is that I don't know how and when Pythonista does use Jedi to index files that are not a) opened, b) not referenced from current (= open) file (for find usages for example). You can pass sys_path for the script, but again, have to find what should I pass to make it index whole project. Basically, I like Jedi, I was thinking about it, but I have zero experience with it and it needs some time to fully understand how it exactly works internally. API is easy, but some other areas are still unclear to me.
zrzka last edited by
Okay, that was quick. Thanks @JonB of reminding me about Jedi and basically forcing me to investigate it more. Trashed
blackmamba.project, does use
jedinow and it's ... super cool! Thanks again :)