summaryrefslogtreecommitdiff
path: root/python-slicer.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-slicer.spec')
-rw-r--r--python-slicer.spec420
1 files changed, 420 insertions, 0 deletions
diff --git a/python-slicer.spec b/python-slicer.spec
new file mode 100644
index 0000000..8c594a1
--- /dev/null
+++ b/python-slicer.spec
@@ -0,0 +1,420 @@
+%global _empty_manifest_terminate_build 0
+Name: python-slicer
+Version: 0.0.7
+Release: 1
+Summary: A small package for big slicing.
+License: MIT License
+URL: https://github.com/interpretml/slicer
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5f/1a/0388801c10441b1060f7e9dbb540544e602e6fe774359c6fa5c17df9679e/slicer-0.0.7.tar.gz
+BuildArch: noarch
+
+
+%description
+# slicer [alpha]
+![License](https://img.shields.io/github/license/interpretml/slicer.svg?style=flat-square)
+![Python Version](https://img.shields.io/pypi/pyversions/slicer.svg?style=flat-square)
+![Package Version](https://img.shields.io/pypi/v/slicer.svg?style=flat-square)
+![Build Status](https://img.shields.io/azure-devops/build/ms/interpret/405/master?style=flat-square)
+![Coverage](https://img.shields.io/azure-devops/coverage/ms/interpret/405/master.svg?style=flat-square)
+![Maintenance](https://img.shields.io/maintenance/yes/2020.svg?style=flat-square)
+
+*(Equal Contribution) Samuel Jenkins & Harsha Nori & Scott Lundberg*
+
+**slicer** wraps tensor-like objects and provides a uniform slicing interface via `__getitem__`.
+
+<br/>
+It supports many data types including:
+
+&nbsp;&nbsp;
+[numpy](https://github.com/numpy/numpy) |
+[pandas](https://github.com/pandas-dev/pandas) |
+[scipy](https://docs.scipy.org/doc/scipy/reference/sparse.html) |
+[pytorch](https://github.com/pytorch/pytorch) |
+[list](https://github.com/python/cpython) |
+[tuple](https://github.com/python/cpython) |
+[dict](https://github.com/python/cpython)
+
+And enables upgraded slicing functionality on its objects:
+```python
+# Handles non-integer indexes for slicing.
+S(df)[:, ["Age", "Income"]]
+
+# Handles nested slicing in one call.
+S(nested_list)[..., :5]
+```
+
+It can also simultaneously slice many objects at once:
+```python
+# Gets first elements of both objects.
+S(first=df, second=ar)[0, :]
+```
+
+This package has **0** dependencies. Not even one.
+
+## Installation
+
+Python 3.6+ | Linux, Mac, Windows
+```sh
+pip install slicer
+```
+
+## Getting Started
+
+Basic anonymous slicing:
+```python
+from slicer import Slicer as S
+li = [[1, 2, 3], [4, 5, 6]]
+S(li)[:, 0:2].o
+# [[1, 2], [4, 5]]
+di = {'x': [1, 2, 3], 'y': [4, 5, 6]}
+S(di)[:, 0:2].o
+# {'x': [1, 2], 'y': [4, 5]}
+```
+
+Basic named slicing:
+```python
+import pandas as pd
+import numpy as np
+df = pd.DataFrame({'A': [1, 3], 'B': [2, 4]})
+ar = np.array([[5, 6], [7, 8]])
+sliced = S(first=df, second=ar)[0, :]
+sliced.first
+# A 1
+# B 2
+# Name: 0, dtype: int64
+sliced.second
+# array([5, 6])
+```
+
+Real example:
+```python
+from slicer import Slicer as S
+from slicer import Alias as A
+
+data = [[1, 2], [3, 4]]
+values = [[5, 6], [7, 8]]
+identifiers = ["id1", "id1"]
+instance_names = ["r1", "r2"]
+feature_names = ["f1", "f2"]
+full_name = "A"
+
+slicer = S(
+ data=data,
+ values=values,
+ # Aliases are objects that also function as slicing keys.
+ # A(obj, dim) where dim informs what dimension it can be sliced on.
+ identifiers=A(identifiers, 0),
+ instance_names=A(instance_names, 0),
+ feature_names=A(feature_names, 1),
+ full_name=full_name,
+)
+
+sliced = slicer[:, 1] # Tensor-like parallel slicing on all objects
+assert sliced.data == [2, 4]
+assert sliced.instance_names == ["r1", "r2"]
+assert sliced.feature_names == "f2"
+assert sliced.values == [6, 8]
+
+sliced = slicer["r1", "f2"] # Example use of aliasing
+assert sliced.data == 2
+assert sliced.feature_names == "f2"
+assert sliced.instance_names == "r1"
+assert sliced.values == 6
+```
+
+## Contact us
+Raise an issue on GitHub, or contact us at interpret@microsoft.com
+
+
+
+
+%package -n python3-slicer
+Summary: A small package for big slicing.
+Provides: python-slicer
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-slicer
+# slicer [alpha]
+![License](https://img.shields.io/github/license/interpretml/slicer.svg?style=flat-square)
+![Python Version](https://img.shields.io/pypi/pyversions/slicer.svg?style=flat-square)
+![Package Version](https://img.shields.io/pypi/v/slicer.svg?style=flat-square)
+![Build Status](https://img.shields.io/azure-devops/build/ms/interpret/405/master?style=flat-square)
+![Coverage](https://img.shields.io/azure-devops/coverage/ms/interpret/405/master.svg?style=flat-square)
+![Maintenance](https://img.shields.io/maintenance/yes/2020.svg?style=flat-square)
+
+*(Equal Contribution) Samuel Jenkins & Harsha Nori & Scott Lundberg*
+
+**slicer** wraps tensor-like objects and provides a uniform slicing interface via `__getitem__`.
+
+<br/>
+It supports many data types including:
+
+&nbsp;&nbsp;
+[numpy](https://github.com/numpy/numpy) |
+[pandas](https://github.com/pandas-dev/pandas) |
+[scipy](https://docs.scipy.org/doc/scipy/reference/sparse.html) |
+[pytorch](https://github.com/pytorch/pytorch) |
+[list](https://github.com/python/cpython) |
+[tuple](https://github.com/python/cpython) |
+[dict](https://github.com/python/cpython)
+
+And enables upgraded slicing functionality on its objects:
+```python
+# Handles non-integer indexes for slicing.
+S(df)[:, ["Age", "Income"]]
+
+# Handles nested slicing in one call.
+S(nested_list)[..., :5]
+```
+
+It can also simultaneously slice many objects at once:
+```python
+# Gets first elements of both objects.
+S(first=df, second=ar)[0, :]
+```
+
+This package has **0** dependencies. Not even one.
+
+## Installation
+
+Python 3.6+ | Linux, Mac, Windows
+```sh
+pip install slicer
+```
+
+## Getting Started
+
+Basic anonymous slicing:
+```python
+from slicer import Slicer as S
+li = [[1, 2, 3], [4, 5, 6]]
+S(li)[:, 0:2].o
+# [[1, 2], [4, 5]]
+di = {'x': [1, 2, 3], 'y': [4, 5, 6]}
+S(di)[:, 0:2].o
+# {'x': [1, 2], 'y': [4, 5]}
+```
+
+Basic named slicing:
+```python
+import pandas as pd
+import numpy as np
+df = pd.DataFrame({'A': [1, 3], 'B': [2, 4]})
+ar = np.array([[5, 6], [7, 8]])
+sliced = S(first=df, second=ar)[0, :]
+sliced.first
+# A 1
+# B 2
+# Name: 0, dtype: int64
+sliced.second
+# array([5, 6])
+```
+
+Real example:
+```python
+from slicer import Slicer as S
+from slicer import Alias as A
+
+data = [[1, 2], [3, 4]]
+values = [[5, 6], [7, 8]]
+identifiers = ["id1", "id1"]
+instance_names = ["r1", "r2"]
+feature_names = ["f1", "f2"]
+full_name = "A"
+
+slicer = S(
+ data=data,
+ values=values,
+ # Aliases are objects that also function as slicing keys.
+ # A(obj, dim) where dim informs what dimension it can be sliced on.
+ identifiers=A(identifiers, 0),
+ instance_names=A(instance_names, 0),
+ feature_names=A(feature_names, 1),
+ full_name=full_name,
+)
+
+sliced = slicer[:, 1] # Tensor-like parallel slicing on all objects
+assert sliced.data == [2, 4]
+assert sliced.instance_names == ["r1", "r2"]
+assert sliced.feature_names == "f2"
+assert sliced.values == [6, 8]
+
+sliced = slicer["r1", "f2"] # Example use of aliasing
+assert sliced.data == 2
+assert sliced.feature_names == "f2"
+assert sliced.instance_names == "r1"
+assert sliced.values == 6
+```
+
+## Contact us
+Raise an issue on GitHub, or contact us at interpret@microsoft.com
+
+
+
+
+%package help
+Summary: Development documents and examples for slicer
+Provides: python3-slicer-doc
+%description help
+# slicer [alpha]
+![License](https://img.shields.io/github/license/interpretml/slicer.svg?style=flat-square)
+![Python Version](https://img.shields.io/pypi/pyversions/slicer.svg?style=flat-square)
+![Package Version](https://img.shields.io/pypi/v/slicer.svg?style=flat-square)
+![Build Status](https://img.shields.io/azure-devops/build/ms/interpret/405/master?style=flat-square)
+![Coverage](https://img.shields.io/azure-devops/coverage/ms/interpret/405/master.svg?style=flat-square)
+![Maintenance](https://img.shields.io/maintenance/yes/2020.svg?style=flat-square)
+
+*(Equal Contribution) Samuel Jenkins & Harsha Nori & Scott Lundberg*
+
+**slicer** wraps tensor-like objects and provides a uniform slicing interface via `__getitem__`.
+
+<br/>
+It supports many data types including:
+
+&nbsp;&nbsp;
+[numpy](https://github.com/numpy/numpy) |
+[pandas](https://github.com/pandas-dev/pandas) |
+[scipy](https://docs.scipy.org/doc/scipy/reference/sparse.html) |
+[pytorch](https://github.com/pytorch/pytorch) |
+[list](https://github.com/python/cpython) |
+[tuple](https://github.com/python/cpython) |
+[dict](https://github.com/python/cpython)
+
+And enables upgraded slicing functionality on its objects:
+```python
+# Handles non-integer indexes for slicing.
+S(df)[:, ["Age", "Income"]]
+
+# Handles nested slicing in one call.
+S(nested_list)[..., :5]
+```
+
+It can also simultaneously slice many objects at once:
+```python
+# Gets first elements of both objects.
+S(first=df, second=ar)[0, :]
+```
+
+This package has **0** dependencies. Not even one.
+
+## Installation
+
+Python 3.6+ | Linux, Mac, Windows
+```sh
+pip install slicer
+```
+
+## Getting Started
+
+Basic anonymous slicing:
+```python
+from slicer import Slicer as S
+li = [[1, 2, 3], [4, 5, 6]]
+S(li)[:, 0:2].o
+# [[1, 2], [4, 5]]
+di = {'x': [1, 2, 3], 'y': [4, 5, 6]}
+S(di)[:, 0:2].o
+# {'x': [1, 2], 'y': [4, 5]}
+```
+
+Basic named slicing:
+```python
+import pandas as pd
+import numpy as np
+df = pd.DataFrame({'A': [1, 3], 'B': [2, 4]})
+ar = np.array([[5, 6], [7, 8]])
+sliced = S(first=df, second=ar)[0, :]
+sliced.first
+# A 1
+# B 2
+# Name: 0, dtype: int64
+sliced.second
+# array([5, 6])
+```
+
+Real example:
+```python
+from slicer import Slicer as S
+from slicer import Alias as A
+
+data = [[1, 2], [3, 4]]
+values = [[5, 6], [7, 8]]
+identifiers = ["id1", "id1"]
+instance_names = ["r1", "r2"]
+feature_names = ["f1", "f2"]
+full_name = "A"
+
+slicer = S(
+ data=data,
+ values=values,
+ # Aliases are objects that also function as slicing keys.
+ # A(obj, dim) where dim informs what dimension it can be sliced on.
+ identifiers=A(identifiers, 0),
+ instance_names=A(instance_names, 0),
+ feature_names=A(feature_names, 1),
+ full_name=full_name,
+)
+
+sliced = slicer[:, 1] # Tensor-like parallel slicing on all objects
+assert sliced.data == [2, 4]
+assert sliced.instance_names == ["r1", "r2"]
+assert sliced.feature_names == "f2"
+assert sliced.values == [6, 8]
+
+sliced = slicer["r1", "f2"] # Example use of aliasing
+assert sliced.data == 2
+assert sliced.feature_names == "f2"
+assert sliced.instance_names == "r1"
+assert sliced.values == 6
+```
+
+## Contact us
+Raise an issue on GitHub, or contact us at interpret@microsoft.com
+
+
+
+
+%prep
+%autosetup -n slicer-0.0.7
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-slicer -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.7-1
+- Package Spec generated