• Sign In



  • Categories

    Extension Details



    Readme

    Blake: a Nova extension for linting your Python source code with Flake8, and formatting your code with Black.

    Blake runs Flake8 when you save a Python file, and reports any warnings and errors in Nova's issues sidebar. You can also choose to format your code with Black every time you save, or just using the EditorFormat Source Code with Black menu item whenever you wish (shortcut: ⌘⇧B).

    Prerequisites

    Before using Blake you need to install Flake8 and Black. The recommended method is to use Homebrew and Pipx.

    1. Install Homebrew
    2. Install Pipx
    3. Install Flake8: pipx install flake8
    4. Install Black: pipx install black

    If everything goes to plan, the flake8 and black CLIs will be available globally.

    If you do use Pipx to install Flake8 you can later install your favourite Flake8 plugins by injecting them into the virtual environment. For example, to install the flake8-docstrings plugin: pipx inject flake8 flake8-docstrings. The extra warnings and violations provided by the plugin will be immediately and automatically available to both Blake and the flake8 CLI.

    Installation

    You can install Blake from Nova's online extension library, or you can install it from within Nova itself (select Extension Library... from the Extensions menu and search for "blake").

    If you want to install a version for development, clone the GitHub repo, open the code in Nova, and select Activate Project as Extension from the Extensions menu. Any changes you make to the code will be reflected in the extension for the duration of your Nova session.

    Preferences

    By default Flake8 will be run using /usr/bin/env flake8, and Black using /usr/bin/env black. However you can configure this either for one particular project or for all Python projects within Nova.

    • To configure an individual project: select Project Settings... from the Project menu, and look for the Blake environment
    • To configure all Python projects: select Extension Library... from the Extensions menu, look for Blake under Installed Extensions in the sidebar, and click Settings

    An individual project's settings will override the global preferences. Blake's preferences also allow you to:

    • Format your source files every time you save (off by default)
    • Set preferred maximum line length (default unset, meaning Black decides)
    • Use Black's preview style (off by default)

    For further configuration, you can configure Flake8 and set your Black preferences using the standard config files.

    Release Notes

    Version 0.7.1

    Released 17th March 2023

    • Document the support got global preferences
    • Document the new "Black preview style" preference

    Version 0.7.0

    Released 17th March 2023

    • Global preferences are now available as well as per-project preferences. A global preference will be used when it hasn't been set at the project level
    • Support Black's preview style

    Version 0.6.0

    Released 20th January 2023

    • Refactor for asynchronous saving (see #4)
    • Add per-project setting for setting maximum line length

    Version 0.5.1

    Released 1st June 2021

    • Bug fix: improve detection of Flake8 config (commit f1404e9c and PR #2)

    Version 0.5.0

    Released 8th February 2021

    • Bug fix: fail gracefully when the Black or Flake8 Python libraries aren't available (f35f2d27)
    • Improvement: document "Format Source Code with Black" menu item (7053ac08)

    Version 0.4.2

    Released 27th September 2020

    • Add the extension to the formatters category
    • Clarify docs on using Flake8 plugins

    Version 0.4.1

    Released 26th September 2020

    • Update installation instructions

    Version 0.4.0

    Released 26th September 2020

    • Remove trailing comma in extension manifest
    • Add instructions for installing from GitHub
    • Update GitHub URLs in extension manifest
    • Fix minor grammar error in extension description
    • Move extension code up to top level of repo

    Version 0.3.0

    Released 22nd September 2020

    • Add support for using Black to format Python code
    • Log Flake8 stderr output as single console string
    • Move .gitignore to the root of the repo

    Version 0.2.0

    Released 21st September 2020

    • Explain in README how to use Flake8 plugins if you install it via Pipx
    • Fix bug where the last issue wasn't removed from the list after it was fixed
    • Remove unused code that streams from stdin

    Version 0.1.0

    Released 20th September 2020

    Initial public release.