Skip to content
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
4 changes: 1 addition & 3 deletions .github/actions/pr-script/pr_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import shlex
import shutil
from pathlib import Path
from subprocess import CalledProcessError
from subprocess import check_output
from subprocess import PIPE
from subprocess import PIPE, CalledProcessError, check_output

from ghapi.core import GhApi

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from ghapi.core import GhApi

gh = GhApi("blink1073", "test-python-project")
user = os.environ['ACTOR']
user = os.environ["ACTOR"]
collab_level = gh.repos.get_collaborator_permission_level(user)
print(collab_level["permission"] == "admin")
25 changes: 22 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
name: Check
on:
push:
branches: "main"
branches: ["main"]
pull_request:
branches: "*"
jobs:
# Run "pre-commit run --all-files"
# Run "pre-commit run --all-files --hook-stage=manual"
pre-commit:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: pre-commit/action@v2.0.0
with:
extra_args: --all-files --hook-stage=manual
- name: Help message if pre-commit fail
if: ${{ failure() }}
run: |
echo "You can install pre-commit hooks to automatically run formatting"
echo "on each commit with:"
echo " pre-commit install"
echo "or you can run by hand on staged files with"
echo " pre-commit run"
echo "or after-the-fact on already committed files with"
echo " pre-commit run --all-files --hook-stage=manual"

test:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ on:
type: boolean
jobs:
prep_release:
permissions:
contents: write
permissions: write-all
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:

jobs:
publish_release:
permissions:
contents: write
permissions: write-all
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
default_language_version:
node: system

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: forbid-new-submodules
- id: check-builtin-literals
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
files: \.py$

- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/PyCQA/doc8
rev: v1.0.0
hooks:
- id: doc8
args: [--max-line-length=200]
exclude: docs/source/other/full-config.rst
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.18.3
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
3 changes: 1 addition & 2 deletions test_python_project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import base_function
from .base import BaseClass
from .base import BaseClass, base_function

__all__ = ["BaseClass", "base_function"]
__version__ = "0.1.12"
3 changes: 1 addition & 2 deletions test_python_project/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse # pragma: no cover

from . import base_function
from . import BaseClass
from . import BaseClass, base_function


def main() -> None: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest

from test_python_project import base_function
from test_python_project import BaseClass
from test_python_project import BaseClass, base_function

given = pytest.mark.parametrize

Expand Down