commit 5b8663c225ccf52e6a43f116a9ba156c86445c35a1d8b8227946c6c80d30ef4d Author: Benjamin Greiner Date: Thu Feb 27 12:57:55 2025 +0000 - Add %{?sle15_python_module_pythons} OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-jupyterlab-pygments?expand=0&rev=22 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Example.ipynb b/Example.ipynb new file mode 100644 index 0000000..7516a78 --- /dev/null +++ b/Example.ipynb @@ -0,0 +1,72 @@ +{ + "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": [ + "mycode = \"\"\"\n", + "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", + " return f'
{html}
'\n", + "\"\"\"\n", + "exec(mycode)" + ] + }, + { + "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(mycode)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.10.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..ec2fdbb --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + \ No newline at end of file diff --git a/jupyterlab_pygments-0.3.0.tar.gz b/jupyterlab_pygments-0.3.0.tar.gz new file mode 100644 index 0000000..ac24b61 --- /dev/null +++ b/jupyterlab_pygments-0.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:721aca4d9029252b11cfa9d185e5b5af4d54772bb8072f9b7036f4170054d35d +size 512900 diff --git a/python-jupyterlab-pygments.changes b/python-jupyterlab-pygments.changes new file mode 100644 index 0000000..c616b28 --- /dev/null +++ b/python-jupyterlab-pygments.changes @@ -0,0 +1,72 @@ +------------------------------------------------------------------- +Thu Feb 27 12:52:36 UTC 2025 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Thu May 9 06:59:50 UTC 2024 - Daniel Garcia + +- Build from source not whl from pypi. + +------------------------------------------------------------------- +Thu Mar 7 11:17:46 UTC 2024 - Ben Greiner + +- Skip testing with python39: no longer supported since ipython + 8.19 (nbval) + +------------------------------------------------------------------- +Sat Dec 23 20:13:55 UTC 2023 - Ben Greiner + +- Update to 0.3.0 + * no release notes + +------------------------------------------------------------------- +Thu Feb 2 17:16:28 UTC 2023 - Ben Greiner + +- Modify Example.ipynb because nbval 0.10 abolished saving the + input history + +------------------------------------------------------------------- +Sun Dec 25 11:39:59 UTC 2022 - Ben Greiner + +- Find the license in any installed sitelib: we might not have + python3 flavor (:backports) + +------------------------------------------------------------------- +Mon Aug 1 20:29:07 UTC 2022 - Ben Greiner + +- Update to v0.2.2 + * no release notes +- Add labextensions subpackage + +------------------------------------------------------------------- +Mon Nov 15 19:01:14 UTC 2021 - Ben Greiner + +- Avoid buildcycle with test multibuild + +------------------------------------------------------------------- +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 + +- specfile: + * update copyright year + * be more specific in %files section + +- update to version 0.1.1: + * no changelog available + +------------------------------------------------------------------- +Wed Nov 13 19:11:00 UTC 2019 - Todd R + +- Make python3-only because jupyterlab is python3-only + +------------------------------------------------------------------- +Wed Jun 12 20:58:26 UTC 2019 - Todd R + +- Initial version diff --git a/python-jupyterlab-pygments.spec b/python-jupyterlab-pygments.spec new file mode 100644 index 0000000..62ab9f3 --- /dev/null +++ b/python-jupyterlab-pygments.spec @@ -0,0 +1,98 @@ +# +# spec file for package python-jupyterlab-pygments +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%define skip_python39 1 +%else +%define psuffix %{nil} +%bcond_with test +%endif + +%define distversion 0.3 + +%{?sle15_python_module_pythons} +Name: python-jupyterlab-pygments%{psuffix} +Version: 0.3.0 +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 +# Slightly modified from https://github.com/jupyterlab/jupyterlab_pygments/blob/0.2.2/notebooks/Example.ipynb +Source1: Example.ipynb +BuildRequires: %{python_module base >= 3.8} +BuildRequires: %{python_module hatch-jupyter-builder} +BuildRequires: %{python_module hatch-nodejs-version} +BuildRequires: %{python_module hatchling} +BuildRequires: %{python_module pip} +BuildRequires: fdupes +BuildRequires: jupyter-rpm-macros +BuildRequires: python-rpm-macros +Requires: jupyter-jupyterlab-pygments = %{version} +BuildArch: noarch +%if %{with test} +BuildRequires: %{python_module jupyterlab-pygments = %{version}} +BuildRequires: %{python_module nbval} +BuildRequires: %{python_module pytest} +%endif +%python_subpackages + +%description +This package contains a syntax coloring theme for pygments making use +of the JupyterLab CSS variables. + +%package -n jupyter-jupyterlab-pygments +Summary: Pygments theme for jupyterlab -- Jupyterlab extension files +Requires: python3dist(jupyterlab-pygments) = %{distversion} + +%description -n jupyter-jupyterlab-pygments +This package contains the Jupyterlab extension files for python-jupyterlab-pygments + +%prep +%autosetup -p1 -n jupyterlab_pygments-%{version} + +%build +%{pyproject_wheel} + +%if !%{with test} +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +find %{buildroot}%{_prefix} -path '*/site-packages/jupyterlab_pygments-%{version}.dist-info/licenses/LICENSE' -exec cp {} . ';' -quit +%endif + +%if %{with test} +%check +%pytest --nbval-lax %{SOURCE1} +%endif + +%if !%{with test} +%files %{python_files} +%license LICENSE +%{python_sitelib}/jupyterlab_pygments +%{python_sitelib}/jupyterlab_pygments-%{version}.dist-info + +%files -n jupyter-jupyterlab-pygments +%{_jupyter_labextensions_dir3}/jupyterlab_pygments +%endif + +%changelog