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

Format code using black #763

Merged
merged 6 commits into from
Sep 5, 2020
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# migrate code to black
f922e2e1e60e3a964dbd07597e7c44c068b7ba1d
Copy link
Member

Choose a reason for hiding this comment

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

Very nice

7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8']
python-version: ['3.6', '3.7', '3.8', '3.9.0-rc.1']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Install dependencies
run: |
pip install wheel
pip install --upgrade --upgrade-strategy=eager pytest pytest-asyncio "jupyterlab~=2.0"
pip install --upgrade --upgrade-strategy=eager "jupyterlab~=2.0"

- name: Test the extension
run: |
Expand All @@ -71,6 +71,9 @@ jobs:
pip install jupyterlab_git[test] --pre --no-index --find-links=dist --no-deps --no-cache-dir -v
# Install the extension dependencies based on the current setup.py
pip install jupyterlab_git[test]

# Python formatting checks
black . --check

# Run the Python tests
pytest jupyterlab_git -r ap
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ cd jupyterlab-git

# Install the server extension in development mode and enable it
pip install -e .[test]
pre-commit install
jupyter serverextension enable --py jupyterlab_git --sys-prefix

# Build and install your development version of the extension
Expand Down
15 changes: 7 additions & 8 deletions jupyterlab_git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from jupyterlab_git.handlers import setup_handlers
from jupyterlab_git.git import Git


class JupyterLabGit(Configurable):
"""
Config options for jupyterlab_git
Expand All @@ -16,26 +17,24 @@ class JupyterLabGit(Configurable):
"""

actions = Dict(
help='Actions to be taken after a git command. Each action takes a list of commands to execute (strings). Supported actions: post_init',
help="Actions to be taken after a git command. Each action takes a list of commands to execute (strings). Supported actions: post_init",
config=True,
trait=List(
trait=Unicode(),
help='List of commands to run. E.g. ["touch baz.py"]'
trait=Unicode(), help='List of commands to run. E.g. ["touch baz.py"]'
)
# TODO Validate
)


def _jupyter_server_extension_paths():
"""Declare the Jupyter server extension paths.
"""
"""Declare the Jupyter server extension paths."""
return [{"module": "jupyterlab_git"}]


def load_jupyter_server_extension(nbapp):
"""Load the Jupyter server extension.
"""
"""Load the Jupyter server extension."""

config = JupyterLabGit(config=nbapp.config)
git = Git(nbapp.web_app.settings['contents_manager'], config)
git = Git(nbapp.web_app.settings["contents_manager"], config)
nbapp.web_app.settings["git"] = git
setup_handlers(nbapp.web_app)
4 changes: 2 additions & 2 deletions jupyterlab_git/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Project Jupyter.
# Distributed under the terms of the Modified BSD License.

version_info = (0, 21, 1)
flag = ''
version_info = (0, 22, 0)
flag = "a0"

__version__ = ".".join(map(str, version_info)) + flag
Loading