From faf2b32eb0170972c91d157b609de88970adc6a03cfa1ec196c543ef1303e667 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Sun, 14 Nov 2021 18:04:04 +0000 Subject: [PATCH] Accepting request 931415 from home:bnavigator:branches:devel:languages:python:jupyter - Update to 0.1.2 * fix license metadata in setuptools - check for errors in Example.ipynb with nbval OBS-URL: https://build.opensuse.org/request/show/931415 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-jupyterlab-pygments?expand=0&rev=7 --- Example.ipynb | 77 ++++++++++++++++++++++++++++++ jupyterlab_pygments-0.1.1.tar.gz | 3 -- jupyterlab_pygments-0.1.2.tar.gz | 3 ++ python-jupyterlab-pygments.changes | 7 +++ python-jupyterlab-pygments.spec | 15 ++++-- 5 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 Example.ipynb delete mode 100644 jupyterlab_pygments-0.1.1.tar.gz create mode 100644 jupyterlab_pygments-0.1.2.tar.gz diff --git a/Example.ipynb b/Example.ipynb new file mode 100644 index 0000000..a31044e --- /dev/null +++ b/Example.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from pygments import highlight\n", + "from pygments.lexers import PythonLexer\n", + "from pygments.formatters import HtmlFormatter\n", + "from jupyterlab_pygments import JupyterStyle" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "class PythonCode:\n", + " def __init__(self, value):\n", + " self.value = value\n", + " \n", + " def _repr_html_(self, **kwargs):\n", + " formatter = HtmlFormatter(style=JupyterStyle)\n", + " html = highlight(self.value, PythonLexer(), formatter)\n", + " css = formatter.get_style_defs('.highlight')\n", + " return f'
{html}
'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Rendering the previous cell in HTML with Pygments and JupyterStyle respects the JupyterLab theme" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "PythonCode(In[2])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/jupyterlab_pygments-0.1.1.tar.gz b/jupyterlab_pygments-0.1.1.tar.gz deleted file mode 100644 index f920d48..0000000 --- a/jupyterlab_pygments-0.1.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:19a0ccde7daddec638363cd3d60b63a4f6544c9181d65253317b2fb492a797b9 -size 4169 diff --git a/jupyterlab_pygments-0.1.2.tar.gz b/jupyterlab_pygments-0.1.2.tar.gz new file mode 100644 index 0000000..6ce3312 --- /dev/null +++ b/jupyterlab_pygments-0.1.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfcda0873626150932f438eccf0f8bf22bfa92345b814890ab360d666b254146 +size 4181 diff --git a/python-jupyterlab-pygments.changes b/python-jupyterlab-pygments.changes index 6cf3c5d..a6c7d31 100644 --- a/python-jupyterlab-pygments.changes +++ b/python-jupyterlab-pygments.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sun Nov 14 18:02:29 UTC 2021 - Ben Greiner + +- Update to 0.1.2 + * fix license metadata in setuptools +- check for errors in Example.ipynb with nbval + ------------------------------------------------------------------- Sat Apr 25 16:48:39 UTC 2020 - Arun Persaud diff --git a/python-jupyterlab-pygments.spec b/python-jupyterlab-pygments.spec index 635bfa3..c2571c8 100644 --- a/python-jupyterlab-pygments.spec +++ b/python-jupyterlab-pygments.spec @@ -1,7 +1,7 @@ # # spec file for package python-jupyterlab-pygments # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,20 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-jupyterlab-pygments -Version: 0.1.1 +Version: 0.1.2 Release: 0 Summary: Pygments theme for jupyterlab License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/jupyterlab/jupyterlab_pygments Source: https://files.pythonhosted.org/packages/source/j/jupyterlab_pygments/jupyterlab_pygments-%{version}.tar.gz +Source1: https://raw.githubusercontent.com/jupyterlab/jupyterlab_pygments/%{version}/notebooks/Example.ipynb +BuildRequires: %{python_module nbval} +BuildRequires: %{python_module pygments >= 2.4.1} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -47,10 +51,13 @@ of the JupyterLab CSS variables. %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%pytest --nbval-lax %{SOURCE1} + %files %{python_files} %license LICENSE %doc README.md %{python_sitelib}/jupyterlab_pygments -%{python_sitelib}/jupyterlab_pygments-%{version}-py*.egg-info +%{python_sitelib}/jupyterlab_pygments-%{version}*-info %changelog