Skip to content

Commit

Permalink
Remove restriction on Sphinx<2.0 (#92)
Browse files Browse the repository at this point in the history
Changes include:

- implement `HTML2JSONParser` and `pytest-regressions` for testing HTML documents

Rather then searching for specific bits of text, we convert the document to a json object, stripping out sections irrelevant for testing (like the header, footer and scripts that can change between versions). and test with the `data_regression` fixture

- Add pre_commit configuration
- Update .travis.yml to test python 3.7 rather than 3.4 (which is deprecated)
- Update RTD configuration
- version bump

fixes #76
  • Loading branch information
chrisjsewell committed Jul 23, 2019
1 parent 707d239 commit 8b4f1ac
Show file tree
Hide file tree
Showing 30 changed files with 2,576 additions and 366 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
max-line-length = 120
exclude =
setup.py,
ipypublish/scripts/ipynb_latex_setup.py,
Expand Down
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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']
3 changes: 3 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[style]
based_on_style = google
column_limit = 120
98 changes: 51 additions & 47 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,66 @@ matrix:
env: TEST_TYPE="pytest"
- os: linux
sudo: required
python: 3.4
python: 3.5
dist: trusty
env: TEST_TYPE="pytest"
- os: linux
sudo: required
python: 3.5
dist: trusty
env: TEST_TYPE="pytest"
- os: osx
language: generic
python: 3.7
dist: xenial
env: TEST_TYPE="pytest"
before_install:
- travis_wait brew update
# TODO currently by default python 2.7 is already installed (see https://github.com/travis-ci/travis-ci/issues/9929)
# - brew install python3
# - brew upgrade python
# - pip install virtualenv
# - virtualenv env -p python3
# - source env/bin/activate
# - alias pip="pip3"
- brew install pandoc
- brew upgrade wget
- travis_retry sudo wget http://mirror.ctan.org/systems/mac/mactex/BasicTeX.pkg
-O BasicTeX.pkg
- sudo installer -pkg BasicTeX.pkg -target /
- export PATH=$PATH:/usr/texbin:/Library/TeX/texbin
- travis_retry sudo tlmgr update --self
- travis_retry sudo tlmgr install babel
- travis_retry sudo tlmgr install translations
- travis_retry sudo tlmgr install latexmk
- travis_retry sudo tlmgr install adjustbox
- travis_retry sudo tlmgr install collectbox
- travis_retry sudo tlmgr install ucs
- travis_retry sudo tlmgr install enumitem
- travis_retry sudo tlmgr install placeins
- travis_retry sudo tlmgr install todonotes
- travis_retry sudo tlmgr install chngcntr
- travis_retry sudo tlmgr install doi
- travis_retry sudo tlmgr install mdframed
- travis_retry sudo tlmgr install cleveref
- travis_retry sudo tlmgr install biblatex
- travis_retry sudo tlmgr install needspace
- travis_retry sudo tlmgr install collection-fontsrecommended
# glossaries dependencies
- travis_retry sudo tlmgr install glossaries # NB: for different languages glossaries-<language>
- travis_retry sudo tlmgr install mfirstuc # see https://tex.stackexchange.com/questions/268216/usepackageglossaries-wont-work-after-miktex-update-reinstallation
- travis_retry sudo tlmgr install xfor
- travis_retry sudo tlmgr install datatool
- travis_retry sudo tlmgr install substr
# TODO this takes too long to install
# - os: osx
# language: generic
# env: TEST_TYPE="pytest"
# before_install:
# - travis_wait brew update
# # TODO currently by default python 2.7 is already installed (see https://github.com/travis-ci/travis-ci/issues/9929)
# # - brew install python3
# # - brew upgrade python
# # - pip install virtualenv
# # - virtualenv env -p python3
# # - source env/bin/activate
# # - alias pip="pip3"
# - brew install pandoc
# - brew upgrade wget
# - travis_retry sudo wget http://mirror.ctan.org/systems/mac/mactex/BasicTeX.pkg
# -O BasicTeX.pkg
# - sudo installer -pkg BasicTeX.pkg -target /
# - export PATH=$PATH:/usr/texbin:/Library/TeX/texbin
# - travis_retry sudo tlmgr update --self
# - travis_retry sudo tlmgr install babel
# - travis_retry sudo tlmgr install translations
# - travis_retry sudo tlmgr install latexmk
# - travis_retry sudo tlmgr install adjustbox
# - travis_retry sudo tlmgr install collectbox
# - travis_retry sudo tlmgr install ucs
# - travis_retry sudo tlmgr install enumitem
# - travis_retry sudo tlmgr install placeins
# - travis_retry sudo tlmgr install todonotes
# - travis_retry sudo tlmgr install chngcntr
# - travis_retry sudo tlmgr install doi
# - travis_retry sudo tlmgr install mdframed
# - travis_retry sudo tlmgr install cleveref
# - travis_retry sudo tlmgr install biblatex
# - travis_retry sudo tlmgr install needspace
# - travis_retry sudo tlmgr install collection-fontsrecommended
# # glossaries dependencies
# - travis_retry sudo tlmgr install glossaries # NB: for different languages glossaries-<language>
# - travis_retry sudo tlmgr install mfirstuc # see https://tex.stackexchange.com/questions/268216/usepackageglossaries-wont-work-after-miktex-update-reinstallation
# - travis_retry sudo tlmgr install xfor
# - travis_retry sudo tlmgr install datatool
# - travis_retry sudo tlmgr install substr
allow_failures:
- os: linux
sudo: required
python: 3.4
python: 3.5
dist: trusty
env: TEST_TYPE="pytest"
- os: linux
sudo: required
python: 3.5
dist: trusty
python: 3.7
dist: xenial
env: TEST_TYPE="pytest"
- os: osx
language: generic
Expand Down Expand Up @@ -113,6 +114,9 @@ before_install:
sudo wget http://mirrors.ctan.org/install/macros/latex/contrib/koma-script.tds.zip
sudo unzip koma-script.tds.zip -d ~/texmf/
sudo apt-get install -y latexmk
if [[ "$TRAVIS_DIST" == "xenial" ]]; then
sudo apt-get install -y texlive-generic-recommended
fi
fi
install:
Expand Down
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"**/*.pyc": true,
"**/__pycache__": true
},
"python.pythonPath": "/anaconda/envs/lsr/bin/python",
"python.pythonPath": "/anaconda/envs/ipypublish_dev/bin/python",
"restructuredtext.confPath": "${workspaceFolder}/docs/source",
"restructuredtext.builtDocumentationPath": "${workspaceFolder}/docs/build/html",
"restructuredtext.preview.scrollEditorWithPreview": false,
Expand All @@ -26,7 +26,7 @@
"python.linting.pylamaEnabled": false,
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"latex-workshop.latex.autoBuild.onSave.enabled": false,
"python.formatting.provider": "yapf",
"cSpell.words": [
"Jupyter",
"docutils",
Expand Down Expand Up @@ -65,7 +65,7 @@
"yaml.format.enable": true,

"markdown-preview-enhanced.usePandocParser": true,
"markdown-preview-enhanced.pandocPath": "/anaconda/envs/lsr/bin/pandoc",
"markdown-preview-enhanced.pandocArguments": "--filter=/anaconda/envs/lsr/bin/ipubpandoc",
"markdown-preview-enhanced.pandocPath": "/anaconda/envs/ipypublish_dev/bin/pandoc",
"markdown-preview-enhanced.pandocArguments": "--filter=/anaconda/envs/ipypublish_dev/bin/ipubpandoc",
"markdown-preview-enhanced.enableScriptExecution": true
}
5 changes: 5 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
find . -name "*.pyc" -delete;
find . -name "*.pyo" -delete;
find . -name "__pycache__" -delete;
find . -name ".pytest_cache" -delete;
50 changes: 50 additions & 0 deletions conda_dev_env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Usage:
# $ conda env create -n ipypublish_dev -f conda_dev_env.yaml
# $ conda activate ipypublish_dev
# $ pip install --no-deps -e .
---
name: ipypublish_dev
channels:
- conda-forge
dependencies:
- pip
- python =3.6

- bibtexparser
- docutils
- jinja2
- jsonextended >=0.7
- jsonschema
- jupytext
- nbconvert
- nbformat
- ordered-set
- pandoc =2.6
- panflute
- ruamel.yaml
- setuptools
- six
- sphinx >=1.6
- sphinxcontrib-bibtex
- texsoup <0.2
- tornado
- traitlets
# testing
- pytest >=3.6
- pytest-regressions
- nbsphinx
- pillow
- ipykernel
# style
- autopep8
- doc8
- flake8 <3.8.0,>=3.7.0
- rope
- pre_commit =1.14.4
- yapf =0.26.0
# docs
- sphinx_rtd_theme
- jupyter
- matplotlib
- pandas
- sympy <1.3
7 changes: 2 additions & 5 deletions docs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ channels:
- conda-forge
dependencies:
- python =3.6
# TODO pip>=10 fails du to this issue https://github.com/pypa/pip/issues/5247
# raises error `Cannot uninstall 'docutils'. It is a distutils installed project`
# even though docutils appear to already be at the correct version (0.14)!?
- pip <10.0
- pandoc
- pandoc =2.6
- docutils =0.15
43 changes: 40 additions & 3 deletions docs/source/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ Releases
Version 0.10
------------

v0.10.5
~~~~~~~

Remove requirement for sphinx < 2.0

v0.10.4
~~~~~~~

Fix image reference clashes in rst files (see chrisjsewell/ipypublish#90)

v0.10.3
~~~~~~~

Minor Improvements to `ipypublish.sphinx.notebook`:

- remove ``sphinx.ext.imgconverter`` from sphinx auto-builds
- add additional known sphinx roles

v0.10.2
~~~~~~~

Update dependency requirements:

- Only require backport dependencies
for python version older than their implementation
- use ``ordered-set``, instead of ``oset`` dependency,
since it is better maintained

v0.10.1
~~~~~~~

Minor Improvements to `ipypublish.sphinx.notebook`:

- Formatting of the execution_count is now inserted by:
``ipysphinx_input_prompt.format(count=execution_count)``
- Use "Code Cell Output" as placeholder for output image caption

v0.10.0
~~~~~~~

Expand All @@ -29,7 +66,7 @@ v0.10.0
of Sphinx extensions (using the Sphinx pytest fixtures) and creation of the
``IpyTestApp`` fixture

- fixed `tornado version restriction <https://github.com/chrisjsewell/ipypublish/issues/71>`_
- fixed `tornado version restriction <https://github.com/chrisjsewell/ipypublish/issues/71>`_

Back-compatibility breaking changes:

Expand All @@ -38,7 +75,8 @@ Back-compatibility breaking changes:
(see :ref:`sphinx_ext_notebook`)

- :py:meth:`ipypublish.postprocessors.base.IPyPostProcessor.run_postprocess`
input signature changed (and consequently it has changes for all post-processors)
input signature changed
(and consequently it has changes for all post-processors)

v0.9

Expand Down Expand Up @@ -302,4 +340,3 @@ Version 0.1
-----------

Initial release, before changing latex meta tag convention

2 changes: 1 addition & 1 deletion ipypublish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ipypublish.scripts import nb_setup # noqa: F401

__version__ = '0.10.4'
__version__ = '0.10.5'
2 changes: 1 addition & 1 deletion ipypublish/convert/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class IpyPubMain(Configurable):
).tag(config=True)

plugin_folder_paths = T.Set(
T.Unicode,
T.Unicode(),
default_value=(),
help="a list of folders containing conversion configurations"
).tag(config=True)
Expand Down

0 comments on commit 8b4f1ac

Please sign in to comment.