Forum Archive

Black Mamba - releases

zrzka

Since I have no other way how to inform users about new Black Mamba features, I decided to create this topic. I will only post info about new releases here. Nothing else, to keep it short.

Thanks!

zrzka

Black Mamba 0.0.12 released:

  • Analyze shortcut renamed to Analyze & Check Style
  • Analyzer now runs both pyflakes & pep8 code style checks
  • Analyzer behavior can be modified via bm.settings.ANALYZER_* variables
  • Analyzer always scrolls to the first issue and does not show HUD
  • Analyzer shows HUD only if there're no issues
  • Cmd Shift K shortcut introduced - Clear Annotations
zrzka

Black Mamba 0.0.13 released:

  • flake8 checks on Travis CI (thanks to cclauss)
  • Fixed all style issues from flake8 report, down to zero now
  • Analyzer removes trailing white spaces & trailing blank lines before analysis is started (can be turned off via bm.settings...)
  • Fixed toggle comments script (#5)
  • Fixed file matching in Open Quickly... (#10)
  • Fixed Esc key code (27 = X, not Esc, Esc = 41) (#11)
zrzka

Black Mamba 0.0.14 released:

  • Since 0.0.14, the license was to changed to MIT
  • Seems no one does use PyPI for installation, .pyui files are now included :)
  • Comment line with # (hash space) instead of just # (#12)
  • Ctrl Tab (or Cmd Shift ]) selects next tab
  • Ctrl Shift Tab (or Cmd Shift [) selects previous tab
  • Cmd 1..9 selects specific tab

EXPERIMENTAL

Cmd U to run unit tests. Using pytest directly, because I'd like to add more unit tests features like - run unit tests for the whole package, file, test in a file, ... Works for the file now, but it has issues with some global states, reloading, ...

zrzka

Black Mamba 0.0.15 released:

  • Fix HUD message when there're no tests in the file
  • Removed unreliable PyPI package installation option
  • Removed package from PyPI
  • Custom installer alla StaSh
  • Removed settings module (moved to respective modules)
  • Removed script_picker.py (merged to file_picker.py)
  • Updated pythonista_startup.py sample
  • Pythonista version compatibility check

Installation

If you have already Black Mamba installed, remove it. Then open console, issue ...

import requests as r; exec(r.get('http://bit.ly/get-blackmamba').text)

... and that's it. GitHub installation is not user friendly and PyPI doesn't work.

Breaking Changes

Check pythonista_startup.py sample how to configure Black Mamba a how to start it. You have to call main() and that's all you have to do. Minimum is:

import blackmamba as bm
bm.main()

Why?

  • There's compatibility check with Pythonista and Black Mamba refuses to start (unless forced) with newer versions of Pythonista.
  • There's auto check for updates (daily, configurable, can be disabled). You'll be just informed with alert for now (till I write real updater).

It's based on GitHub releases. These releases will be stable, master branch is not stable at all.

zrzka

Black Mamba 0.0.16 released:

  • Allow to start Black Mamba even in untested version of Pythonista, just warn the user
  • Init messages are colored (orange=warn, red=error)
  • All print messages replaced with log.info (.error, .warn)
  • bm.log.level allows to set logging level (default INFO)
  • Do not bother user (mainly me) with alert about new version (just use console) in case the Black Mamba is not installed via installer (git for example)
  • Tested with latest Pythonista beta (3.1.1 - 311008), everything works as expected

You can install / update it with with:

import requests as r; exec(r.get('http://bit.ly/get-blackmamba').text)
Phuket2

@zrzka , I have had little time the last few days. A lot of overseas guests. But just installed 0.0.16. Very nice. I love the Analyse and combined check. I am still using the git pull to do upgrades. Is this the preferred method, or is itr better to switch to the requests statement?

zrzka

@Phuket2 depends ... The only mandatory thing is to place GitHub's blackmamba folder into site-packages-3. That's it. The difference between git & installer is ...

git

  • master branch is not stable, it can brake things
  • can be workarounded by checkout of specific tag (v0.0.16, etc.)
  • it doesn't tell you that there's new version available

installer

  • stable releases
  • it does inform you about new releases automatically (I do store installed version info in the ~/Documents/site-packages-3/blackmamba/.release.json) and check for updates regularly (during Pythonista startup)
  • if there's a new version, you'll see iOS alert and then you can issue same command you did use for installation to update Black Mamba

You can look at updates.check for more details.

IMO installer is more friendly if you do not want to develop it, because I'm going to add updater as well.

I'll put PyPI back when it starts working, because this is the most preferred way of installation. Sadly it doesn't work.

Also, please, discuss in another topic, this is just for releases. See the first post. Thanks for understanding.

zrzka

Black Mamba 0.0.18 released:

  • Installation command is copied to the clipboard when the alert about
    new version is shown. Just open console and paste it.
  • system.Pythonista and system.iOS decorators to limit functions
    execution under the specific Pythonista & iOS versions.
  • 0.0.17 skipped, because this version was used for testing & fixing pip
  • Outline Quickly... (Cmd Shift L) introduced

Outline Quickly mimicks Pythonista outline (Cmd L), but allows node filtering. On the other side, it does not contain annotations (yet).

ccc

Would it be possible to put this stuff into https://github.com/zrzka/blackmamba/releases ?

As someone who does not use an external keyboard with Pythonista, I find much of this discussion to be off topic. Is it just me or do others agree?

zrzka

I do not use Xcode Template for example, I find much of it to be off topic for me. Others do use Xcode Template, they don't consider it off topic, they're reading it, participating, ... So, I simply don't read Xcode Template related threads.

I understand that this thread can be off topic for some people, but for some of them not. Just don't read it as I or others don't read Xcode Template topics.

P.S. I have nothing against Xcode Template, it's just an example :)

Phuket2

@ccc , i dont agree. I normally agree with you. Sorry, in this case I dont. @zrzka has put a lot of effort into this and it works great. For those who use ext keyboards, its a gift from god. There are many subjects in Pythonista i have no interest in, I just skip them. No disrespect to you, but i think this is a great project. It's easy to skip over if you are not into it.

zrzka

Black Mamba 0.0.19 released:

  • Fixed unused import in action picker
  • Compatibility check with 3.1.1 (311009)
  • Introduced ide.scroll_to_line(line_number)
  • Ctrl L Jump to line... added
  • Cmd E to show Drag Provider (iOS 11 & iPad only)

What's the Drag Provider all about? See this video. You must have latest Working Copy beta, iOS beta and iPad. Otherwise it will not work for you.

wolf71

using pip install blackmamba

and then run:

#!python3

import blackmamba as bm
bm.main()

Error:
ImportError: No module named 'httplib'

zrzka

@wolf71 unfortunately, there's no pip3 in StaSh and Black Mamba is Python 3 only. As a workaround, you have to:

pip remove blackmamba
pip install blackmamba -d ~/Documents/site-packages-3

And ...

#!python3

import blackmamba as bm
bm.main()

... must be placed in the ~/Documents/site-packages-3/pythonista_startup.py file. Hope that helps. If not, please file an issue with more details (like how did you install it, which version was installed, pip installation console log, Pythonista version, default interpreter, ...). Thanks.

And you have to use dev StaSh (selfupdate -f dev).

P.S. Note the -3 suffix in installation path / python startup file path. Also I tried to reproduce your issue, but no luck (even if I change interpreter, omit -d in the pip command, ...).

zrzka

Black Mamba 0.0.21 released

  • Code cleanup (circular deps, ...)
  • Fixed analyzer where ignore_code=None means real None
  • Please, check sample pythonista_startup.py, breaking changes, sry
  • Config option to disable keyboard shortcuts registration

It's basically clean up release, because it was quickly written, there were lot of circular deps, ... Also configuration of Black Mamba is done via dict, not via modifying module variables. And option to disable keyboard shortcuts was introduced, because I'm planning to add stuff which is useful even without external keyboard.

How to update

Pythonista console

import requests as r; exec(r.get('http://bit.ly/get-blackmamba').text)`

pip

StaSh dev (selfupdate -f dev).

pip remove blackmamba
pip install blackmamba -d ~/Documents/site-packages-3

pip update doesn't honor -d from previous pip install command. Will file an issue and fix this.

zrzka

BlackMamba 0.0.22 released:

  • Toggle comments improved
    • Honors both tabs and spaces
    • Indented # if line is indented
    • Shortest indent is used for all lines # if commenting multiple of them
    • Empty lines are ignored
  • Fixed ide.run_action when script_name starts with /
zrzka

BlackMamba 0.0.23 released:

  • Jump to definition (Cmd Shift D)
zrzka

Black Mamba 0.0.24 released:

  • blackmamba.keyboard module added
  • Pickers (open, script, ... quickly)
    • Do not focus search field if HW keyboard is not connected
    • Show title bar instead of custom title to allow users to close dialogs with X button
  • ide.scroll_to_line optimized
  • Toggle comments various fixes
    • Line is properly commented when there's inline comment
    • Uncommented line -> whitespaces only -> 'n'
    • More test coverage to avoid future bugs
wolf71

@zrzka Thanks,it's work.

can add cmd+up cmd+down to page up and page down?

zrzka

@wolf71 please, file an issue for this.

zrzka

Black Mamba 0.0.25 released:

  • blackmamba.script introduced and it does contain following scripts
    • action_quickly.py, analyze.py, clear_annotations.py, close_all_tabs_except_current_one.py,
      drag_provider.py, jump_to_definition.py, jump_to_line.py, new_file.py, new_tab.py,
      open_quickly.py, outline_quickly.py, run_quickly.py, run_unit_tests.py, search_dash.py,
      toggle_comments.py
    • These scripts can be used in the wrench icon (action)
    • These scripts are binded to keyboard shortcuts, whenever you run it via wrench icon
      or via keyboard shortcut, same script is executed
    • It's still required to call blackmamba.main from within
      ~/Documents/site-packages-3/pythonista_startup.py file to properly configure it
      (even without external keyboard)
  • Drag Provider uses Pythonista title bar instead of custom title to allow users to close the
    the dialog without external keyboard
  • Unit tests (tester.py) moved from blackmamba.experimental to blackmamba
  • ide.run_script and ide.run_action has new args named delay, which defaults to None
  • Run Quickly & Action Quickly runs scripts with 1.0s delay and that's because
    both these actions are binded to scripts in the new script folder and if there's no
    delay, nothing happens if these scripts are Python 3 (basically it runs script from script,
    which doesn't ended yet)
  • Fixed #20 (Pythonista appex error)
    • Allow to run main
    • Do not check compatibility, updates
    • Do not register keyboard shortcuts
  • blackmamba.system.Pythonista decorator has new arg appex
    • Defaults to None
    • appex=True - run decorated function if it's running as application extension
    • appex=False - run decorated function if it's not running as application extension
    • appex=None - run in both case, just don't check
  • blackmamba.key_command.register_key_command is decorated with Pythonista(appex=False)
    to avoid shortcut registration if it's running as application extension
  • Page Up (Ctrl Up) and Page Down (Ctrl Down)
    • It jumps up / down by 40 lines by default
    • You can modify this value via general.page_line_count
    • See #395, it's recommended
      to hit Left / Right arrow key after page up / down to workaround iOS / Pythonista bug
zrzka

BTW if you've got beta version of Working Copy (build 3.0.9.16), you can use drag provider script to drag file or the folder to the Working Copy. Works flawlessly now and this version was already submitted to the app store. Will be available along with iOS 11 release. This is the only way how I commit & push now. See demonstration video.

zrzka

Black Mamba 0.0.26 released:

  • Jump to definition fixes
  • Jedi - ignore definitions if there's no path & line number
  • blackmamba.project trashed (replaced with Jedi, thanks to @JonB)
  • Jump to definition shortcut synced with Xcode (Control Command J)
  • Find usages added (script/find_usages.py & Control Command U)
  • Show documentation (script/show_documentation.py & Control Command ?)
    • Displayed as success annotation on the current line
    • You can clear annotation with Cmd Shift K (already there)
  • All these three featues does jedi now. Jedi is not thread safe and
    because I had not lot of time to investigate how and when is the Jedi
    used by Pythonista, I decided to disable these three features by
    default. To enable them, just set general.jedi to True when
    passing configuration to the main.

BTW this . notation is a shortcut for documentation and you have to pass
it as dictionary:

config = {
    'general': {
        'jedi': True
    }
}

blackmamba.main(config)
zrzka

Black Mamba 0.0.27 released:

  • Drag provider trashed (Cmd E)
  • Drag & Drop introduced (Cmd E)
    • Allows bidirectional drag & drop of files & folders & repos
    • List of ignored folders is configurable via drag_and_drop.ignored_folders, check config.py for default values
    • Can be used as wrench menu icon (script/drag_and_drop.py)

There's one limitation (will be fixed). Whenever you drop folder from Working Copy, UI isn't updated and you have to close Drag & Drop window and open it again to see this folder.

Here's demonstration video of Drag & Drop.

P.S. I did test this with latest Working Copy. You can drag file & folder from Pythoista, you can drag file & folder & repo from Working Copy. No more missed files in my commits :)

zrzka

Black Mamba 1.0.0 released:

  • Development status changed to 5 - Production/Stable
  • Fixed programming language classifier (Python 3.6)
  • Detailed documentation available at blackmamba.readthedocs.io
    • Contains About, User Guide, Reference, Contribution, Development and FAQ
    • If you're just Black Mamba user, read User Guide
    • If you'd like to use Black Mamba functions, read Reference
  • Dialogs
    • Keyboard shortcut to close dialogs (Ctrl [) replaced with Cmd . (Apple one)
    • Default width is 80% of window width (max 700)
    • Default height is 80% of window height
  • Open, run, action, ... dialogs
    • Properly sorted items (by lowercased file names)
    • Filtering works on folders too
      • bl __init matches any file where full path does contain bl and __init
      • Folders up to ~/Documents are not matched, only subfolders of ~/Documents
  • Drag & Drop
    • New way how a folder / file is provided
    • Works with Kaleidoscope for example
    • Still compatible with Working Copy
    • All opened files are listed in the dialog
  • Open Quickly
    • If file is already opened, tab with file is selected
  • Find usages
    • It actually did show definitions instead of usages, fixed
  • Some other bugfixes I can't recall now

And 1.0.1:

  • Fixed unit tests annotations

And 1.0.2:

  • Fixed Black Mamba for stable Pythonista version (Python 3.5)

Here's the gallery if you'd like to know what is this all about. Gallery is included in latest docs, not stable ones. Will be included in stable docs when the next version will be released.

zrzka

Black Mamba 1.1.0 released:

  • Dropped PyPI packaging
    • Black Mamba provides own / updated modules to provide new functionality
    • This is not compatible with pip at all, thus this installation method is no longer supported
    • Latest Black Mamba release in PyPI is 1.0.2
  • Find usages contains symbol name in the dialog title
  • Jump to definition contains symbol name in the dialog title
  • Show documentation contains symbol name in the dialog title
  • tab.open_file has new line argument
    • Jump to definition, Find usages utilizes tab.open_file instead of editor's one
  • Analyze script does use bundled flake8, mccabe, ...
    • See documentation to check how to configure it
    • First pass defaults are ['--select=E901,E999,F821,F822,F823']
    • Second pass defaults are ['--max-complexity=10', '--max-line-length=127']
  • Open quickly, ... filter is case insensitive

P.S. This bundled flake8, ... means that you can analyze your code even with f-strings like f'Hallo {sender.title}', etc.

enceladus

Is it possible for the users who do not have external keyboard to use the sidebar menu (see the link below) for running your scripts?
https://forum.omz-software.com/topic/3543/share-in-work-side-bar-replacement

zrzka

Black Mamba 1.2.0 released:

  • .uikit.overlay introduced which allows Black Mamba to display information as overlays
    • Overlays are Pythonista app overlays (visible in editor, console, ...)
  • .ide.theme introduced to get some theme functionality
  • Show documentation script leverages new overlays
    • Overlay can be closed via Ctrl W shortcut
    • Overlay can be moved (title bar)
    • Overlay can be resized (drag bottom left/right corner)
    • Script is configurable, see docs
    • See screenshot (reuse disabled)

P.S. If you don't see a new screenshot in the gallery (one with overlays), just force reload the page / image.

@enceladus please, use another topic for questions (see first post). Thanks. I don't know what the sidebar menu is, but I also don't see a reason why it wouldn't be possible. Just run them in the same way as Black Mamba does.

zrzka

Black Mamba 1.2.1 released:

  • Bundled packages links and licenses
  • ide.run_script respects delay argument (did contain hardcoded value)
  • Analyze script documentation mentions flake8
  • Drag & Drop script
    • Children nodes are lazy-loaded (faster)
    • Dropped folder reloads ...
      • Target row if not expanded (to display triangle)
      • Children nodes (dropped folder appears if it didn't exist before drop)
  • Show documentation
    • Do not show picker / docstring if symbol was found, but it has no docstring
zrzka

Black Mamba 1.2.2 released:

  • Bundled lib/pep8 removed, unused
  • Fixed get_actions (exception when user has no custom actions)
  • Pythonista 3.1.1 (311013)
    • Compatibility check with 311013
    • Shortcuts Cmd W, Ctrl Tab, Ctrl Shift Tab no longer work (1)
    • Shortcuts Cmd 1..9, Cmd Shift ], Cmd Shift [, Cmd Shift W still work

(1) Pythonista 311013 provides these shortcuts natively. Unfortunately, they do not work. Also these shortcuts are provided elsewhere in the responder chain, so, even if I register them via the Black Mamba, responder chain catches them sooner then Black Mamba and they do not work.

All these shortcuts do work prior to 311013. If you have 311013 installed, you can use Cmd Q to close tab (temporary) and Cmd Shift ] / Cmd Shift [ to show next / previous tab.

P.S. User documentation is not updated (for Cmd Q), because it's a temporary workaround. I do expect that these shortcuts (Cmd W, ...) will be fixed in the Pythonista and then Cmd Q will be removed.

zrzka

Black Mamba 1.3.0 released:

  • Pythonista 3.1.1 (311014)
    • Compatibility check with 311014
    • Shortcuts Cmd W, Ctrl [Shift] Tab work
  • Trashed Cmd Q shortcut (workaround for 311013)
  • Open Quickly supports File System Provider bookmarks
    • You can search / open files added to Pythonista via Open... (External files)
    • These files are added as bookmarks (iOS terminology)
    • If cell subtitle starts with Documents, it's a file from ~/Documents
    • If cell subtitle starts with Bookmark, it's a file from FSP
zrzka

Blackmamba 1.3.2 released:

  • Fixed exception when there's empty tab opened (#30)
  • Open quickly selects proper tab when the file is already opened
    and empty tab exists as well
  • Compatibility check with 311015
    • Cmd-Shift-], Cmd-Shift-[ registered only in Pythonista < 311015
    • These shortcuts are natively supported
  • flake8-3.5.0, pyflakes-1.6.0
    • Bare exception check
    • Ambigious identifier check
zrzka

Black Mamba 1.4.0 released:

  • Fixed keyboard shortcut selector name generator
  • Bundle refactoring introduced (includes rope)
  • Refactoring functions introduced
    • It's an EXPERIMENT. You should use version control system to avoid loosing data.
    • Cmd Option O - Organize imports
    • Cmd Option E - Expand star imports
    • Cmd Option R - Rename identifier
    • Can be used as scripts as well, see script/refactoring folder
    • Preview dialog can be closed with Cmd . / Esc, confirmed with Enter
  • Scroll back to initial cursor location if analyzer didn't find an issue, ugly, but better than end of the file

NOTE: As mentioned, refactoring is an experiment. It does use rope internally, but it seems that the rope is unable to cope with built-ins, etc. (in case of expand star imports). Rename and organize imports works. Here's the screenshot if you'd like to check it. Use with caution.

zrzka

Black Mamba 1.4.1 released:

  • Compatibility check with 3.1.1 (311016)
  • Bundle refactoring enhanced with future, libfuturize, libpasteurize modules
  • script/refactoring/futurize.py introduced (see Python Future)
    • Equivalent of futurize -1 --all-imports -n -w --add-suffix 3 $editor.get_path() (Stage 1 only)
    • When futurizer ends, editor text is replaced with content of the .py3 and .py3 is trashed
    • You can run futurizer script with Cmd Option F
  • Improved updates check
    • Console is not cluttered with local / latest release info (installer prints this)
    • Update check() doesn't ask if update should (not) be installer (installer also asks)
    • If there's new update available, installer is executed, you will still be asked (just once, not twice)
  • Script new_file.py modified
    • File opened
      • Asks for a file name (empty & Enter -> Cancel)
      • New file path is currently opened file dirname + entered file name
      • If file doesn't exist, new file is created and opened
      • If file exists, file is opened
    • No file opened
      • Same behavior as now
      • New tab created and New File... button tap emulated
  • Installer
    • Replaced ModuleNotFoundError (Python 3.6) with ImportError (Python 3.5)
zrzka

Black Mamba 1.5.0 released:

1.5.0 (2018-01-11)

  • Pass -p no:cacheprovider to fix operation not permitted for .cache directory (run unit tests script)
  • Documentation cleanup and rewrite to Markdown, which is easily editable in Pythonista compared to reST
  • blackmamba.framework.security introduced
  • blackmamba.uikit.keyboard
    • Camel case enum constant deprecated, will be removed in 2.0.0
    • Use UPPER_CASED versions, camel case still exists as aliases
  • with bundle() always unloads pkg_resources.* causing issues
    • Launch Pythonista, run Black Mamba Analyze - works vs
    • Launch Pythonista, run Pythonista unit tests, run Black Mamba Analyze - fails, because of pkg_resources