diff options
Diffstat (limited to 'python-mpu.spec')
| -rw-r--r-- | python-mpu.spec | 396 |
1 files changed, 396 insertions, 0 deletions
diff --git a/python-mpu.spec b/python-mpu.spec new file mode 100644 index 0000000..0cfae89 --- /dev/null +++ b/python-mpu.spec @@ -0,0 +1,396 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mpu +Version: 0.23.1 +Release: 1 +Summary: Martins Python Utilities +License: MIT +URL: https://github.com/MartinThoma/mpu +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f8/b2/8a346462daf65a6ed9ee41d9f8308f56ef83d0fd6778b144d7b5cd71193a/mpu-0.23.1.tar.gz +BuildArch: noarch + +Requires: python3-pandas +Requires: python3-magic +Requires: python3-pytz +Requires: python3-Pillow +Requires: python3-tzlocal +Requires: python3-boto3 +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-pytest-mccabe +Requires: python3-pytest-flake8 +Requires: python3-simplejson +Requires: python3-boto3 +Requires: python3-pytz +Requires: python3-Pillow +Requires: python3-pytz +Requires: python3-tzlocal +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-pytest-mccabe +Requires: python3-pytest-flake8 +Requires: python3-simplejson + +%description +[](https://badge.fury.io/py/mpu) +[](https://pypi.org/project/mpu/) +[](http://mpu.readthedocs.io/en/latest/?badge=latest) +[](https://travis-ci.org/MartinThoma/mpu) +[](https://coveralls.io/github/MartinThoma/mpu?branch=master) + +# mpu +Martins Python Utilities (mpu) is a collection of utility functions and classes +with no other dependencies. + +The total size of the package will never be bigger than 10 MB and currently it +is 15.7 kB in zipped form. This makes it a candidate to include into AWS Lambda +projects. + + +## Installation + +```bash +$ pip install git+https://github.com/MartinThoma/mpu.git +``` + +It can, of course, also be installed via PyPI. + + +## Usage + +### Datastructures + +```python-repl +>>> from mpu.datastructures import EList + +>>> l = EList([2, 1, 0]) +>>> l[2] +0 + +>>> l[[2, 0]] +[0, 2] + +>>> l[l] +[0, 1, 2] +``` + +### Shell + +To enhance your terminals output, you might want to do something like: + +```python +from mpu.shell import Codes + +print("{c.GREEN}{c.UNDERLINED}Works{c.RESET_ALL}".format(c=Codes)) +``` + + +### Quick Examples + +Creating small example datastructures is a task I encounter once in a while +for StackExchange answers. + +```python +from mpu.pd import example_df + +df = example_df() +print(df) +``` + +gives + +``` + country population population_time EUR +0 Germany 82521653.0 2016-12-01 True +1 France 66991000.0 2017-01-01 True +2 Indonesia 255461700.0 2017-01-01 False +3 Ireland 4761865.0 NaT True +4 Spain 46549045.0 2017-06-01 True +5 Vatican NaN NaT True +``` + + +### Money + +```python +import mpu +from fractions import Fraction + +gross_income = mpu.units.Money("2345.10", "EUR") +net_income = gross_income * Fraction("0.80") +apartment = mpu.units.Money("501.23", "EUR") +savings = net_income - apartment +print(savings) +``` + +prints `1375.31 Euro` + + +### IO + +* Download files with `mpu.io.download(source, sink)` +* Read CSV, JSON and pickle with `mpu.io.read(filepath)` +* Write CSV, JSON and pickle with `mpu.io.write(filepath, data)` + + + + +%package -n python3-mpu +Summary: Martins Python Utilities +Provides: python-mpu +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mpu +[](https://badge.fury.io/py/mpu) +[](https://pypi.org/project/mpu/) +[](http://mpu.readthedocs.io/en/latest/?badge=latest) +[](https://travis-ci.org/MartinThoma/mpu) +[](https://coveralls.io/github/MartinThoma/mpu?branch=master) + +# mpu +Martins Python Utilities (mpu) is a collection of utility functions and classes +with no other dependencies. + +The total size of the package will never be bigger than 10 MB and currently it +is 15.7 kB in zipped form. This makes it a candidate to include into AWS Lambda +projects. + + +## Installation + +```bash +$ pip install git+https://github.com/MartinThoma/mpu.git +``` + +It can, of course, also be installed via PyPI. + + +## Usage + +### Datastructures + +```python-repl +>>> from mpu.datastructures import EList + +>>> l = EList([2, 1, 0]) +>>> l[2] +0 + +>>> l[[2, 0]] +[0, 2] + +>>> l[l] +[0, 1, 2] +``` + +### Shell + +To enhance your terminals output, you might want to do something like: + +```python +from mpu.shell import Codes + +print("{c.GREEN}{c.UNDERLINED}Works{c.RESET_ALL}".format(c=Codes)) +``` + + +### Quick Examples + +Creating small example datastructures is a task I encounter once in a while +for StackExchange answers. + +```python +from mpu.pd import example_df + +df = example_df() +print(df) +``` + +gives + +``` + country population population_time EUR +0 Germany 82521653.0 2016-12-01 True +1 France 66991000.0 2017-01-01 True +2 Indonesia 255461700.0 2017-01-01 False +3 Ireland 4761865.0 NaT True +4 Spain 46549045.0 2017-06-01 True +5 Vatican NaN NaT True +``` + + +### Money + +```python +import mpu +from fractions import Fraction + +gross_income = mpu.units.Money("2345.10", "EUR") +net_income = gross_income * Fraction("0.80") +apartment = mpu.units.Money("501.23", "EUR") +savings = net_income - apartment +print(savings) +``` + +prints `1375.31 Euro` + + +### IO + +* Download files with `mpu.io.download(source, sink)` +* Read CSV, JSON and pickle with `mpu.io.read(filepath)` +* Write CSV, JSON and pickle with `mpu.io.write(filepath, data)` + + + + +%package help +Summary: Development documents and examples for mpu +Provides: python3-mpu-doc +%description help +[](https://badge.fury.io/py/mpu) +[](https://pypi.org/project/mpu/) +[](http://mpu.readthedocs.io/en/latest/?badge=latest) +[](https://travis-ci.org/MartinThoma/mpu) +[](https://coveralls.io/github/MartinThoma/mpu?branch=master) + +# mpu +Martins Python Utilities (mpu) is a collection of utility functions and classes +with no other dependencies. + +The total size of the package will never be bigger than 10 MB and currently it +is 15.7 kB in zipped form. This makes it a candidate to include into AWS Lambda +projects. + + +## Installation + +```bash +$ pip install git+https://github.com/MartinThoma/mpu.git +``` + +It can, of course, also be installed via PyPI. + + +## Usage + +### Datastructures + +```python-repl +>>> from mpu.datastructures import EList + +>>> l = EList([2, 1, 0]) +>>> l[2] +0 + +>>> l[[2, 0]] +[0, 2] + +>>> l[l] +[0, 1, 2] +``` + +### Shell + +To enhance your terminals output, you might want to do something like: + +```python +from mpu.shell import Codes + +print("{c.GREEN}{c.UNDERLINED}Works{c.RESET_ALL}".format(c=Codes)) +``` + + +### Quick Examples + +Creating small example datastructures is a task I encounter once in a while +for StackExchange answers. + +```python +from mpu.pd import example_df + +df = example_df() +print(df) +``` + +gives + +``` + country population population_time EUR +0 Germany 82521653.0 2016-12-01 True +1 France 66991000.0 2017-01-01 True +2 Indonesia 255461700.0 2017-01-01 False +3 Ireland 4761865.0 NaT True +4 Spain 46549045.0 2017-06-01 True +5 Vatican NaN NaT True +``` + + +### Money + +```python +import mpu +from fractions import Fraction + +gross_income = mpu.units.Money("2345.10", "EUR") +net_income = gross_income * Fraction("0.80") +apartment = mpu.units.Money("501.23", "EUR") +savings = net_income - apartment +print(savings) +``` + +prints `1375.31 Euro` + + +### IO + +* Download files with `mpu.io.download(source, sink)` +* Read CSV, JSON and pickle with `mpu.io.read(filepath)` +* Write CSV, JSON and pickle with `mpu.io.write(filepath, data)` + + + + +%prep +%autosetup -n mpu-0.23.1 + +%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-mpu -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.23.1-1 +- Package Spec generated |
