# # spec file for package python-sparklines # # Copyright (c) 2025 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/ # %define skip_python311 1 %define skip_python312 1 %define short_name sparklines Name: python-sparklines Version: 0.7.0 Release: 0 Summary: Generate sparklines for numbers using Unicode characters only License: MIT URL: https://github.com/deeplook/sparklines Source: https://files.pythonhosted.org/packages/source/s/sparklines/sparklines-%{version}.tar.gz Source99: %{name}-rpmlintrc BuildRequires: python-rpm-macros BuildRequires: %{python_module pytest} BuildRequires: %{python_module hatchling} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: fdupes Requires(post): update-alternatives Requires(postun): update-alternatives Requires: python3-termcolor BuildArch: noarch %python_subpackages %description Text-based sparklines for the command line mimicking those of Edward Tufte. This Python package implements Edward Tufte's concept of sparklines, but limited to text only e.g. like this: ▃▁▄▁▅█▂▅ (this I likely not displayed correctly in every browser). You can find more information about sparklines on Wikipedia. This code was mainly developed for running simple plausibility tests in sensor networks as shown in fig. 1 below: https://raw.githubusercontent.com/deeplook/sparklines/main/example_sensors.png Due to limitations of available Unicode characters this works best when all values are positive. And even then true sparklines that look more like lines and less like bars are a real challenge, because they would need multiple characters with a single horizontal line on different vertical positions. This would work only with a dedicated font, which is way beyond the scope of this tool and which would significantly complicate its usage. So we stick to these characters: "▁▂▃▄▅▆▇█", and use a blank for missing values. This code was tested ok at some point for Python 2.6 and 2.7, but no longer supports Python 2 after it reached end-of-life. Now Python 3.5 to 3.8 as well as PyPy 3 are all tested via Travis-CI. %prep %autosetup -p1 -n sparklines-%{version} find . -type f -exec sed -i 's@#!%{_bindir}/env python$@#!%{_bindir}/python@' {} + find . -type f -exec sed -i 's@#!%{_bindir}/env python3$@#!%{_bindir}/python3@' {} + %build %pyproject_wheel %install %pyproject_install %python_clone -a %{buildroot}%{_bindir}/sparklines #%%python_expand mv -v %%{buildroot}%%{$python_sitelib}/tests %%{buildroot}%%{$python_sitelib}/sparklines/tests %python_expand mv -v %{_builddir}/%{short_name}-%{version}/tests %{buildroot}%{$python_sitelib}/sparklines/tests %python_expand cp -v %{_builddir}/%{short_name}-%{version}/pyproject.toml %{buildroot}%{$python_sitelib}/sparklines/pyproject.toml %python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/%{short_name}/__init__.py %python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/%{short_name}/__main__.py %python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/%{short_name}/sparklines.py %python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/%{short_name}/tests/test_sparkline.py %python_expand %fdupes -sr %{buildroot}%{$python_sitelib} %post %python_install_alternative sparklines %postun %python_uninstall_alternative sparklines %check %pytest %{buildroot}%{$python_sitelib}/sparklines/tests # -k 'not (test_main_version)' %files %{python_files} %python_alternative %{_bindir}/sparklines %{python_sitelib}/sparklines %{python_sitelib}/sparklines-%{version}.dist-info %exclude %{python_sitelib}/sparklines/pyproject.toml %exclude %{python_sitelib}/sparklines/.pytest_cache %changelog