diff --git a/.coveragerc b/.coveragerc index ad6dc16..5187b38 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,3 @@ [run] -omit = +omit = ipypublish/scripts/nb_setup.py diff --git a/.flake8 b/.flake8 index 884318a..ae89533 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,9 @@ [flake8] max-line-length = 120 -exclude = +ignore = + E203, # not compatible with black + W503 # not compatible with black +exclude = setup.py, ipypublish/scripts/ipynb_latex_setup.py, - ipypublish/tests/test_files/basic_nb/expected/python_with_meta.py \ No newline at end of file + ipypublish/tests/test_files/basic_nb/expected/python_with_meta.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4a902d7..464ca6f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,7 @@ Steps to reproduce the behavior: 1. step 1 2. step 2 - + (for extended explanation, use the additional context section) ## Minimal Notebook Example diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9491db8..c382d5c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,39 +1,49 @@ # Install pre-commit hooks via # pre-commit install -- repo: git://github.com/pre-commit/pre-commit-hooks - sha: v2.2.3 - hooks: - - id: check-json - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace - - id: double-quote-string-fixer - - id: flake8 - -- repo: local - hooks: - - - id: yapf - name: Yet Another Python Formatter - entry: yapf - language: system - types: [python] - args: ["-i", "-vv"] - exclude: > - (?x)^( - setup.py - )$ - - - id: doc8 - name: RST Linting - entry: doc8 - language: system - types: [rst] - - # - id: travis-linter - # name: Travis Lint - # entry: travis lint - # files: .travis.yml - # language: ruby - # additional_dependencies: ['travis'] +exclude: >- + (?x)^( + .vscode/settings.json| + docs/build/.*| + example/.*| + ipypublish/tests/test_files/.*| + ipypublish/sphinx/tests/sourcedirs/.*| + ipypublish/sphinx/config.yaml| + docs/source/custom_export_config.rst + )$ + + # TODO docs/source/custom_export_config.rst is excleded because doc8 + # complains about :linenos: in code-block + +repos: + + - repo: git://github.com/pre-commit/pre-commit-hooks + sha: v2.2.3 + hooks: + - id: check-json + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: flake8 + + - repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black + + - repo: local + hooks: + + - id: doc8 + name: RST Linting + entry: doc8 + language: system + exclude: docs/build/* + types: [rst] + + # - id: travis-linter + # name: Travis Lint + # entry: travis lint + # files: .travis.yml + # language: ruby + # additional_dependencies: ['travis'] diff --git a/.readthedocs.yml b/.readthedocs.yml index 1e18a7e..253d50b 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -16,4 +16,3 @@ python: # builder: html # configuration: conf.py # fail_on_warning: true - diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index b3d849f..0000000 --- a/.style.yapf +++ /dev/null @@ -1,3 +0,0 @@ -[style] -based_on_style = google -column_limit = 120 diff --git a/.travis.yml b/.travis.yml index 69ae187..082d9f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: sudo: required python: 3.6 dist: trusty - env: TEST_TYPE="flake8" + env: TEST_TYPE="pre-commit" - os: linux sudo: required python: 3.6 @@ -18,18 +18,18 @@ matrix: env: TEST_TYPE="pytest" PYPI_DEPLOY=true - os: linux sudo: required - python: 2.7 - dist: trusty + python: 3.7 + dist: xenial env: TEST_TYPE="pytest" - os: linux sudo: required - python: 3.5 + python: 2.7 dist: trusty env: TEST_TYPE="pytest" - os: linux sudo: required - python: 3.7 - dist: xenial + python: 3.5 + dist: trusty env: TEST_TYPE="pytest" # TODO this takes too long to install # - os: osx @@ -76,13 +76,13 @@ matrix: allow_failures: - os: linux sudo: required - python: 3.5 + python: 2.7 dist: trusty env: TEST_TYPE="pytest" - os: linux sudo: required - python: 3.7 - dist: xenial + python: 3.5 + dist: trusty env: TEST_TYPE="pytest" - os: osx language: generic @@ -123,13 +123,16 @@ install: - pip install -U pip setuptools wheel - if [[ "$TEST_TYPE" == "pytest" ]]; then travis_wait pip install .[tests] ; fi - if [[ "$TEST_TYPE" == "pytest" ]]; then pip install --quiet coveralls ; fi -- if [[ "$TEST_TYPE" == "flake8" ]]; then travis_wait pip install "flake8(>=3.7,<3.8)" ; fi +- if [[ "$TEST_TYPE" == "pre-commit" ]]; then pip install -e .[code_style]; fi - if [[ "$TEST_TYPE" == "rtd" ]]; then travis_wait pip install .[rtd] ; fi script: - if [[ "$TEST_TYPE" == "pytest" ]]; then pytest -v --cov=ipypublish --cov-config .coveragerc --cov-report= ipypublish ; fi - if [[ "$TEST_TYPE" == "pytest" ]]; then nbpublish -pdf --pdf-debug -log debug example/notebooks/Example.ipynb ; fi -- if [[ "$TEST_TYPE" == "flake8" ]]; then flake8 . ; fi +- | + if [[ "$TEST_TYPE" == "pre-commit" ]]; then + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) + fi - if [[ "$TEST_TYPE" == "rtd" ]]; then cd docs; make ; fi after_success: diff --git a/.vscode/jinja2-latex.code-snippets b/.vscode/jinja2-latex.code-snippets index 3d5e90d..08d2fe3 100644 --- a/.vscode/jinja2-latex.code-snippets +++ b/.vscode/jinja2-latex.code-snippets @@ -10,13 +10,13 @@ "scope": "jinja-latex", "body": "((* set ${1:name} = ${2:value} *))", "description": "set variable" - }, + }, "print": { "prefix": "print", "scope": "inja-latex", "body": "((( ${1:variable} )))", "description": "print variable" - }, + }, "block": { "prefix": "block", "scope": "jinja-latex", @@ -73,4 +73,4 @@ ], "description": "if-else condition" } -} \ No newline at end of file +} diff --git a/.vscode/jinja2.code-snippets b/.vscode/jinja2.code-snippets index 4615ac8..e4840fb 100644 --- a/.vscode/jinja2.code-snippets +++ b/.vscode/jinja2.code-snippets @@ -10,13 +10,13 @@ "scope": "jinja,jinja-yaml,jinja-html", "body": "{% set ${1:name} = ${2:value} %}", "description": "set variable" - }, + }, "print": { "prefix": "print", "scope": "jinja,jinja-yaml,jinja-html", "body": "{{ ${1:variable} }}", "description": "print variable" - }, + }, "block": { "prefix": "block", "scope": "jinja,jinja-yaml,jinja-html", @@ -73,4 +73,4 @@ ], "description": "if-else condition" } -} \ No newline at end of file +} diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 2ead2a6..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Current File (Integrated Terminal)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal" - }, - { - "name": "Python: Attach", - "type": "python", - "request": "attach", - "port": 5678, - "host": "localhost" - }, - { - "name": "Python: Module", - "type": "python", - "request": "launch", - "module": "enter-your-module-name-here", - "console": "integratedTerminal" - }, - { - "name": "Python: Django", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/manage.py", - "console": "integratedTerminal", - "args": [ - "runserver", - "--noreload", - "--nothreading" - ], - "django": true - }, - { - "name": "Python: Flask", - "type": "python", - "request": "launch", - "module": "flask", - "env": { - "FLASK_APP": "app.py" - }, - "args": [ - "run", - "--no-debugger", - "--no-reload" - ], - "jinja": true - }, - { - "name": "Python: Current File (External Terminal)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "externalTerminal" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 010f705..5708289 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,12 +26,13 @@ "python.linting.pylamaEnabled": false, "python.linting.enabled": true, "python.linting.flake8Enabled": true, - "python.formatting.provider": "yapf", + "python.formatting.provider": "black", "cSpell.words": [ "Jupyter", "docutils", "ipynb", "ipypublish", + "ipywidgets", "jupytext", "nbconvert", "nbpresent", @@ -39,33 +40,33 @@ "placeholders", "plugins" ], - "todo-tree.tags": [ - "TODO", - "todo::", - "FIXME", - "NOTE" - ], - "todo-tree.regex": "((//|#-?| >**Attention**: @@ -28,7 +29,7 @@ For an example of the potential input/output, see: Or, for a practical example of the ipypublish capability, see these documents on Atomic 3D Visualisation: [Notebook](https://github.com/chrisjsewell/chrisjsewell.github.io/blob/master/3d_atomic/3D%20Atomic%20Visualisation.ipynb), [PDF](https://chrisjsewell.github.io/3d_atomic/converted/3D%20Atomic%20Visualisation.view_pdf.html), -[HTML](https://chrisjsewell.github.io/3d_atomic/converted/3D%20Atomic%20Visualisation.html) or +[HTML](https://chrisjsewell.github.io/3d_atomic/converted/3D%20Atomic%20Visualisation.html) or [Reveal.JS slideshow](https://chrisjsewell.github.io/3d_atomic/converted/3D%20Atomic%20Visualisation.slides.html). ## Design Philosophy diff --git a/bandit.yml b/bandit.yml index 11d2e06..e96b97a 100644 --- a/bandit.yml +++ b/bandit.yml @@ -1 +1 @@ -skips: ['B101'] # TODO this should only skip in test files, see https://github.com/PyCQA/bandit/issues/346 \ No newline at end of file +skips: ['B101'] # TODO this should only skip in test files, see https://github.com/PyCQA/bandit/issues/346 diff --git a/binder/environment.yml b/binder/environment.yml index b397ce2..7cdf2f7 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -8,3 +8,4 @@ dependencies: - pandas - sympy - pillow + - ipywidgets diff --git a/conda_dev_env.yaml b/conda_dev_env.yaml index 3227323..5c52c1e 100644 --- a/conda_dev_env.yaml +++ b/conda_dev_env.yaml @@ -24,7 +24,7 @@ dependencies: - ruamel.yaml - setuptools - six -- sphinx >=1.6 +- sphinx >=1.8 - sphinxcontrib-bibtex - texsoup <0.2 - tornado @@ -41,7 +41,7 @@ dependencies: - flake8 <3.8.0,>=3.7.0 - rope - pre_commit =1.14.4 -- yapf =0.26.0 +- black =19.3b0 # docs - sphinx_rtd_theme - jupyter diff --git a/conftest.py b/conftest.py index 1ece6b4..970578a 100644 --- a/conftest.py +++ b/conftest.py @@ -1 +1 @@ -pytest_plugins = 'sphinx.testing.fixtures' +pytest_plugins = "sphinx.testing.fixtures" diff --git a/converted/.gitignore b/converted/.gitignore index 08924fd..d918ff6 100644 --- a/converted/.gitignore +++ b/converted/.gitignore @@ -250,5 +250,4 @@ TSWLatexianTemp* # added by CJS .DS_Store -*.frm - +*.frm diff --git a/converted/Example.html b/converted/Example.html index 631083e..28e086e 100644 --- a/converted/Example.html +++ b/converted/Example.html @@ -21619,4 +21619,4 @@