Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement black and isort-based style checks #549

Merged
merged 4 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
max-line-length = 79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the max is still 79?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I changed it back following discussion in other channels.

exclude = build
ignore = E266, W503
ignore = E203, E266, W503
per-file-ignores = */api.py:F401
20 changes: 20 additions & 0 deletions .github/workflows/check-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run style checks

on: [pull_request, workflow_dispatch]

jobs:
style:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '.github/workflows/style-requirements.txt'
- run: python -m pip install -r .github/workflows/style-requirements.txt
- run: |
python -m black --check --diff .
python -m isort --check --diff .
python -m flake8 .
4 changes: 4 additions & 0 deletions .github/workflows/style-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
black ~= 23.0
flake8
flake8-ets
isort
3 changes: 0 additions & 3 deletions .github/workflows/test-with-edm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ jobs:
run: python -m pip install -r .github/workflows/bootstrap-requirements.txt
- name: Install test environment
run: python etstool.py install --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
- name: Flake8
run: python etstool.py flake8 --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
if: runner.os == 'Linux' && matrix.toolkit == 'null'
- name: Run tests (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: xvfb-run -a python etstool.py test --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
Expand Down
9 changes: 5 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
.. |Message| replace:: :github-demo:`Message <MOTD/acme/motd/message.py>`
.. |messages.py| replace:: :github-demo:`message.py <MOTD/acme/motd/software_quotes/messages.py>`
.. |Message of the Day| replace:: :github-demo:`Message of the Day <MOTD>`
""" # noqa: E501
""" # noqa: E501

# Options for HTML output
# -----------------------
Expand Down Expand Up @@ -234,7 +234,8 @@
# -- Options for extlinks extension -------------------------------------------

extlinks = {
'github-demo': (
f'https://github.com/enthought/envisage/tree/{version}/envisage/examples/demo/%s', # noqa: E501
'')
"github-demo": (
f"https://github.com/enthought/envisage/tree/{version}/envisage/examples/demo/%s", # noqa: E501
"",
)
}
27 changes: 13 additions & 14 deletions envisage/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@

"""

from .application import Application
from .core_plugin import CorePlugin
from .egg_plugin_manager import EggPluginManager
from .extension_point import ExtensionPoint
from .extension_point_binding import (
bind_extension_point,
ExtensionPointBinding,
unbind_extension_point,
)
from .extension_point_changed_event import ExtensionPointChangedEvent
from .extension_provider import ExtensionProvider
from .extension_registry import ExtensionRegistry
from .i_application import IApplication
from .i_extension_point import IExtensionPoint
from .i_extension_point_user import IExtensionPointUser
Expand All @@ -76,28 +88,15 @@
from .i_plugin_activator import IPluginActivator
from .i_plugin_manager import IPluginManager
from .i_service_registry import IServiceRegistry

from .application import Application
from .core_plugin import CorePlugin
from .egg_plugin_manager import EggPluginManager
from .extension_registry import ExtensionRegistry
from .extension_point import ExtensionPoint
from .extension_point_binding import (
ExtensionPointBinding,
bind_extension_point,
unbind_extension_point,
)
from .extension_provider import ExtensionProvider
from .extension_point_changed_event import ExtensionPointChangedEvent
from .ids import (
BINDINGS,
COMMANDS,
PREFERENCES,
PREFERENCES_CATEGORIES,
PREFERENCES_PANES,
SERVICE_OFFERS,
TASK_EXTENSIONS,
TASKS,
TASK_EXTENSIONS
)
from .import_manager import ImportManager
from .plugin import Plugin
Expand Down
Loading