Skip to content

Commit

Permalink
Merge pull request #109 from chrisjsewell/display-widgets
Browse files Browse the repository at this point in the history
- Add sphinx compatibility with ipywidgets
- Reformat code with black, and add pre-commit test to travis-ci
- Fix some minor bugs/warnings
  • Loading branch information
chrisjsewell authored Nov 10, 2019
2 parents a837db2 + fcf2d4e commit 63cbc9d
Show file tree
Hide file tree
Showing 215 changed files with 6,858 additions and 4,768 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[run]
omit =
omit =
ipypublish/scripts/nb_setup.py
7 changes: 5 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -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
ipypublish/tests/test_files/basic_nb/expected/python_with_meta.py
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
82 changes: 46 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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']
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ python:
# builder: html
# configuration: conf.py
# fail_on_warning: true

3 changes: 0 additions & 3 deletions .style.yapf

This file was deleted.

25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions .vscode/jinja2-latex.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -73,4 +73,4 @@
],
"description": "if-else condition"
}
}
}
6 changes: 3 additions & 3 deletions .vscode/jinja2.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -73,4 +73,4 @@
],
"description": "if-else condition"
}
}
}
64 changes: 0 additions & 64 deletions .vscode/launch.json

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -57,7 +58,7 @@
"todo-tree.highlights.defaultHighlight": {
"icon": "alert",
"type": "tag",
"foreground": "orange",
"foreground": "#FFA500",
"background": "white",
"opacity": 10
},
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ from one or more Jupyter Notebooks.

**Documentation**: [ipypublish.readthedocs.io](http://ipypublish.readthedocs.io)

[![Build Status](https://travis-ci.org/chrisjsewell/ipypublish.svg?branch=master)](https://travis-ci.org/chrisjsewell/ipypublish)
[![Coverage Status](https://coveralls.io/repos/github/chrisjsewell/ipypublish/badge.svg?branch=master)](https://coveralls.io/github/chrisjsewell/ipypublish?branch=master)
[![CI Build](https://travis-ci.org/chrisjsewell/ipypublish.svg?branch=master)](https://travis-ci.org/chrisjsewell/ipypublish)
[![Coverage](https://coveralls.io/repos/github/chrisjsewell/ipypublish/badge.svg?branch=master)](https://coveralls.io/github/chrisjsewell/ipypublish?branch=master)
[![PyPI](https://img.shields.io/pypi/v/ipypublish.svg)](https://pypi.python.org/pypi/ipypublish/)
[![DOI](https://zenodo.org/badge/96322423.svg)](https://zenodo.org/badge/latestdoi/96322423)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/ipypublish/badges/version.svg)](https://anaconda.org/conda-forge/ipypublish)
[![Conda](https://anaconda.org/conda-forge/ipypublish/badges/version.svg)](https://anaconda.org/conda-forge/ipypublish)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
<!-- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/243d0038a2f543e7a9c47a781ca3cbf5)](https://www.codacy.com/app/chrisj_sewell/ipypublish?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=chrisjsewell/ipypublish&amp;utm_campaign=Badge_Grade) -->

>**Attention**:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bandit.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
skips: ['B101'] # TODO this should only skip in test files, see https://github.com/PyCQA/bandit/issues/346
skips: ['B101'] # TODO this should only skip in test files, see https://github.com/PyCQA/bandit/issues/346
1 change: 1 addition & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dependencies:
- pandas
- sympy
- pillow
- ipywidgets
4 changes: 2 additions & 2 deletions conda_dev_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- ruamel.yaml
- setuptools
- six
- sphinx >=1.6
- sphinx >=1.8
- sphinxcontrib-bibtex
- texsoup <0.2
- tornado
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pytest_plugins = 'sphinx.testing.fixtures'
pytest_plugins = "sphinx.testing.fixtures"
3 changes: 1 addition & 2 deletions converted/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,4 @@ TSWLatexianTemp*

# added by CJS
.DS_Store
*.frm

*.frm
2 changes: 1 addition & 1 deletion converted/Example.html
Original file line number Diff line number Diff line change
Expand Up @@ -21619,4 +21619,4 @@ <h1 id="Embed-interactive-HTML-(like-ipywidgets)">Embed interactive HTML (like i

</body>

</html>
</html>
Loading

0 comments on commit 63cbc9d

Please sign in to comment.