summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 05:05:33 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 05:05:33 +0000
commit9ff391e7329528317291cc6dc704fb766e74f9a1 (patch)
treeb972722a42a34b95c9f8f776dc7e17ff9c9d3c51
parentae6ba0c52ebaeb8f1284385aff57dd4d040693c2 (diff)
automatic import of python-rec-avro
-rw-r--r--.gitignore1
-rw-r--r--python-rec-avro.spec228
-rw-r--r--sources1
3 files changed, 230 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c7ca58e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/rec-avro-0.0.4.tar.gz
diff --git a/python-rec-avro.spec b/python-rec-avro.spec
new file mode 100644
index 0000000..8608eca
--- /dev/null
+++ b/python-rec-avro.spec
@@ -0,0 +1,228 @@
+%global _empty_manifest_terminate_build 0
+Name: python-rec-avro
+Version: 0.0.4
+Release: 1
+Summary: Avro schema and data converters supporting storing arbitrary nested python data structures.
+License: MIT
+URL: https://github.com/bmizhen/rec-avro
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e4/c1/6f85a5b6fce4f04bd5e1546e02ccb99c3699cc7d96e2826be044a5e395bb/rec-avro-0.0.4.tar.gz
+BuildArch: noarch
+
+
+%description
+# rec-avro:
+Avro support for JSON and other nested data structures.
+
+Rec-avro provides a generic Avro schema and converter functions that allow for storing nested python data structures in avro.
+
+Tested in Python 3 only.
+
+## Installation:
+```sh
+$ pip3 install rec-avro
+```
+
+## Usage:
+### With fastavro:
+```python
+
+from fastavro import writer, reader, schema
+from rec_avro import to_rec_avro_destructive, from_rec_avro_destructive, rec_avro_schema
+
+def json_objects():
+ return [{'a': 'a'}, {'b':'b'}]
+
+# For efficiency, to_rec_avro_destructive() destroys rec, and reuses it's
+# data structures to construct avro_objects
+avro_objects = (to_rec_avro_destructive(rec) for rec in json_objects())
+
+# store records in avro
+with open('json_in_avro.avro', 'wb') as f_out:
+ writer(f_out, schema.parse_schema(rec_avro_schema()), avro_objects)
+
+#load records from avro
+with open('json_in_avro.avro', 'rb') as f_in:
+ # For efficiency, from_rec_avro_destructive(rec) destroys rec, and
+ # reuses it's data structures to construct it's output
+ loaded_json = [from_rec_avro_destructive(rec) for rec in reader(f_in)]
+
+assert loaded_json == json_objects()
+```
+
+## Development:
+```sh
+# Running all tests:
+$ python setup.py pytest
+
+# Running tests manually
+$ pip3 install fastavro pytest
+$ python setup.py develop
+$ pytest tests/test_rec_avro.py
+```
+
+
+
+
+
+%package -n python3-rec-avro
+Summary: Avro schema and data converters supporting storing arbitrary nested python data structures.
+Provides: python-rec-avro
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-rec-avro
+# rec-avro:
+Avro support for JSON and other nested data structures.
+
+Rec-avro provides a generic Avro schema and converter functions that allow for storing nested python data structures in avro.
+
+Tested in Python 3 only.
+
+## Installation:
+```sh
+$ pip3 install rec-avro
+```
+
+## Usage:
+### With fastavro:
+```python
+
+from fastavro import writer, reader, schema
+from rec_avro import to_rec_avro_destructive, from_rec_avro_destructive, rec_avro_schema
+
+def json_objects():
+ return [{'a': 'a'}, {'b':'b'}]
+
+# For efficiency, to_rec_avro_destructive() destroys rec, and reuses it's
+# data structures to construct avro_objects
+avro_objects = (to_rec_avro_destructive(rec) for rec in json_objects())
+
+# store records in avro
+with open('json_in_avro.avro', 'wb') as f_out:
+ writer(f_out, schema.parse_schema(rec_avro_schema()), avro_objects)
+
+#load records from avro
+with open('json_in_avro.avro', 'rb') as f_in:
+ # For efficiency, from_rec_avro_destructive(rec) destroys rec, and
+ # reuses it's data structures to construct it's output
+ loaded_json = [from_rec_avro_destructive(rec) for rec in reader(f_in)]
+
+assert loaded_json == json_objects()
+```
+
+## Development:
+```sh
+# Running all tests:
+$ python setup.py pytest
+
+# Running tests manually
+$ pip3 install fastavro pytest
+$ python setup.py develop
+$ pytest tests/test_rec_avro.py
+```
+
+
+
+
+
+%package help
+Summary: Development documents and examples for rec-avro
+Provides: python3-rec-avro-doc
+%description help
+# rec-avro:
+Avro support for JSON and other nested data structures.
+
+Rec-avro provides a generic Avro schema and converter functions that allow for storing nested python data structures in avro.
+
+Tested in Python 3 only.
+
+## Installation:
+```sh
+$ pip3 install rec-avro
+```
+
+## Usage:
+### With fastavro:
+```python
+
+from fastavro import writer, reader, schema
+from rec_avro import to_rec_avro_destructive, from_rec_avro_destructive, rec_avro_schema
+
+def json_objects():
+ return [{'a': 'a'}, {'b':'b'}]
+
+# For efficiency, to_rec_avro_destructive() destroys rec, and reuses it's
+# data structures to construct avro_objects
+avro_objects = (to_rec_avro_destructive(rec) for rec in json_objects())
+
+# store records in avro
+with open('json_in_avro.avro', 'wb') as f_out:
+ writer(f_out, schema.parse_schema(rec_avro_schema()), avro_objects)
+
+#load records from avro
+with open('json_in_avro.avro', 'rb') as f_in:
+ # For efficiency, from_rec_avro_destructive(rec) destroys rec, and
+ # reuses it's data structures to construct it's output
+ loaded_json = [from_rec_avro_destructive(rec) for rec in reader(f_in)]
+
+assert loaded_json == json_objects()
+```
+
+## Development:
+```sh
+# Running all tests:
+$ python setup.py pytest
+
+# Running tests manually
+$ pip3 install fastavro pytest
+$ python setup.py develop
+$ pytest tests/test_rec_avro.py
+```
+
+
+
+
+
+%prep
+%autosetup -n rec-avro-0.0.4
+
+%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-rec-avro -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.4-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..4a1d219
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fe5fafe88deaa2d521db473c02dc1109 rec-avro-0.0.4.tar.gz