Skip to content

Commit

Permalink
Normalize the sample notebooks (#1003)
Browse files Browse the repository at this point in the history
* Version 1.14.2-dev

* Normalize the sample notebooks (#1002)

* Fix issues that `normalize` did not fix

* Remove outputs and metadata when they exist

* Use Path rather than path

* Test that text notebooks are normalized

* Regenerate mirror text notebooks
Following the normalization of ipynb notebooks

* Skip test if recent nbformat is not available

* Add Python 3.11 + Use Py3.9 for conda

* Update CHANGELOG.md

* Jupytext is tested against Python 3.10 and 3.11 on the CI

* Don't include test failure in coverage
  • Loading branch information
mwouts authored Oct 31, 2022
1 parent 12964ef commit be9b65b
Show file tree
Hide file tree
Showing 25 changed files with 297 additions and 255 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9
- uses: pre-commit/[email protected]

analyse:
Expand All @@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
# a pull request then we can check out the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
Expand All @@ -64,7 +64,7 @@ jobs:
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
strategy:
matrix:
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
python-version: [ 3.7 ]
python-version: [ 3.9 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
strategy:
matrix:
python-version: [ 3.7 ]
python-version: [ 3.9 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -200,7 +200,7 @@ jobs:
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
strategy:
matrix:
python-version: [ 3.7 ]
python-version: [ 3.9 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -224,7 +224,7 @@ jobs:
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
strategy:
matrix:
python-version: [ 3.7 ]
python-version: [ 3.9 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -254,10 +254,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9
- name: Build package
run: |
pip install wheel jupyter-packaging jupyterlab>=3
Expand All @@ -280,10 +280,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9
- name: Build package
run: |
pip install wheel jupyter-packaging jupyterlab>=3
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
comment:
after_n_builds: 11
after_n_builds: 12

coverage:
status:
Expand Down
13 changes: 13 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Jupytext ChangeLog
==================

1.14.2-dev (2022-10-??)
-------------------

**Fixed**
- The sample notebooks have been normalized with `nbformat.validator.normalize` ([#1002](https://github.com/mwouts/jupytext/issues/1002)).

**Changed**
- The CI uses Python 3.9 rather than 3.7 when testing conda environments

**Added**
- We now test Jupytext against Python 3.6 to 3.11 on the CI


1.14.1 (2022-07-29)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = "1.14.1"
__version__ = "1.14.2-dev"
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
]
},
"metadata": {},
"output_type": "display_data",
"source": "R display func"
"output_type": "display_data"
}
],
"source": [
Expand Down
3 changes: 1 addition & 2 deletions tests/notebooks/ipynb_clojure/html-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"source": [
"# Clojupyter Demo\n",
"\n",
"This example notebook is from the [Clojupyter](https://github.com/clojupyter/clojupyter/blob/1637f6b2557f01db1e35bae5389bc38522eefe9a/examples/html-demo.ipynb) project.",
"\n",
"This example notebook is from the [Clojupyter](https://github.com/clojupyter/clojupyter/blob/1637f6b2557f01db1e35bae5389bc38522eefe9a/examples/html-demo.ipynb) project.\n",
"This notebook demonstrates some of the more advanced features of Clojupyter."
]
},
Expand Down
38 changes: 21 additions & 17 deletions tests/notebooks/ipynb_ocaml/ocaml_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,61 @@
"cells": [
{
"cell_type": "markdown",
"id": "0ce05620",
"metadata": {},
"source": [
"# Example of an OCaml notebook"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 3,
"source": [
"let sum x y = x + y"
],
"id": "5c62301c",
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"val sum : int -> int -> int = <fun>\n"
]
},
"execution_count": 3,
"metadata": {},
"execution_count": 3
"output_type": "execute_result"
}
],
"metadata": {}
"source": [
"let sum x y = x + y"
]
},
{
"cell_type": "markdown",
"id": "f89c9670",
"metadata": {},
"source": [
"Let's try our function:"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 4,
"source": [
"sum 3 4 = 7 + 0"
],
"id": "d2b696e3",
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"- : bool = true\n"
]
},
"execution_count": 4,
"metadata": {},
"execution_count": 4
"output_type": "execute_result"
}
],
"metadata": {}
"source": [
"sum 3 4 = 7 + 0"
]
}
],
"metadata": {
Expand All @@ -76,4 +80,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
2 changes: 1 addition & 1 deletion tests/notebooks/ipynb_ps1/powershell.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cells": [
"cells": [
{
"cell_type": "markdown",
"metadata": {},
Expand Down
4 changes: 3 additions & 1 deletion tests/notebooks/ipynb_py/jupyter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {"scrolled":true},
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
Expand Down
4 changes: 2 additions & 2 deletions tests/notebooks/ipynb_py/notebook_with_complex_metadata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
},
},
"widgets": {
"state": {
"a65a11f142ca44eebc913788d256adcb": {
Expand All @@ -37,7 +37,7 @@
}
]
}
},
},
"version": "1.2.0"
}
},
Expand Down
Loading

0 comments on commit be9b65b

Please sign in to comment.