Skip to content

Commit

Permalink
Merge pull request #257 from blink1073/adopt-precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Apr 1, 2022
2 parents 4b5bfad + 98a72cc commit 60a339b
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 23 deletions.
74 changes: 74 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
ci:
skip: [check-jsonschema]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.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.3.0
# hooks:
# - id: black
# args: ["--line-length", "100"]

# - repo: https://github.com/PyCQA/isort
# rev: 5.10.1
# hooks:
# - id: isort
# files: \.py$
# args: [--profile=black]

# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v2.6.1
# hooks:
# - id: prettier

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

- repo: https://github.com/PyCQA/doc8
rev: 0.11.0
hooks:
- id: doc8
args: [--max-line-length=200]

# - repo: https://github.com/pycqa/flake8
# rev: 4.0.1
# hooks:
# - id: flake8
# additional_dependencies:
# [
# "flake8-bugbear==20.1.4",
# "flake8-logging-format==0.6.0",
# "flake8-implicit-str-concat==0.2.0",
# ]

# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: v8.12.0
# hooks:
# - id: eslint

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.1
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ recursive-include nbformat *.txt
recursive-include nbformat *.json
recursive-include tests *.*
exclude scripts/jupyter-trust
exclude .pre-commit-config.yaml

# Javascript
include package.json
Expand Down
16 changes: 7 additions & 9 deletions docs/format_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,16 @@ adding only a ``execution_count`` field, which must be an integer.
error
*****

Failed execution may show a traceback

.. sourcecode:: python
Failed execution may show an error::

{
'output_type': 'error',
'ename' : str, # Exception name, as a string
'evalue' : str, # Exception value, as a string
'output_type': 'error',
'ename' : str, # Exception name, as a string
'evalue' : str, # Exception value, as a string

# The traceback will contain a list of frames,
# represented each as a string.
'traceback' : list,
# The traceback will contain a list of frames,
# represented each as a string.
'traceback' : list,
}

.. versionchanged:: nbformat 4.0
Expand Down
23 changes: 9 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@
# Distributed under the terms of the Modified BSD License.

from __future__ import print_function
import subprocess
import os
import sys
from glob import glob

# the name of the project
name = 'nbformat'

#-----------------------------------------------------------------------------
# Minimal Python version sanity check
#-----------------------------------------------------------------------------

import sys

#-----------------------------------------------------------------------------
# get on with it
#-----------------------------------------------------------------------------

import os
from glob import glob

from distutils.core import setup

pjoin = os.path.join
Expand Down Expand Up @@ -82,6 +73,10 @@

if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
import setuptools
subprocess.run([sys.executable, "-m", "pre_commit", "install"])
subprocess.run(
[sys.executable, "-m", "pre_commit", "install", "--hook-type", "pre-push"]
)

setuptools_args = {}
install_requires = setuptools_args['install_requires'] = [
Expand All @@ -92,7 +87,7 @@

extras_require = setuptools_args['extras_require'] = {
'fast': ['fastjsonschema'],
'test': ['check-manifest', 'fastjsonschema', 'testpath', 'pytest'],
'test': ['check-manifest', 'fastjsonschema', 'testpath', 'pytest', 'pre-commit'],
}

if 'setuptools' in sys.modules:
Expand Down

0 comments on commit 60a339b

Please sign in to comment.