From 9694c5c6e42033ec7d4a17bbf27e097d214c76f1 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 05:51:52 +0000 Subject: automatic import of python-marshmallow-peewee --- .gitignore | 1 + python-marshmallow-peewee.spec | 662 +++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 664 insertions(+) create mode 100644 python-marshmallow-peewee.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..8215906 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/marshmallow_peewee-4.2.2.tar.gz diff --git a/python-marshmallow-peewee.spec b/python-marshmallow-peewee.spec new file mode 100644 index 0000000..d7890fd --- /dev/null +++ b/python-marshmallow-peewee.spec @@ -0,0 +1,662 @@ +%global _empty_manifest_terminate_build 0 +Name: python-marshmallow-peewee +Version: 4.2.2 +Release: 1 +Summary: Peewee ORM integration with the Marshmallow (de)serialization library +License: MIT +URL: https://github.com/klen/marshmallow-peewee +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/72/522004e117fcab9c3167ebcaaf9c371492869033a6857258dddba0ab3007/marshmallow_peewee-4.2.2.tar.gz +BuildArch: noarch + +Requires: python3-marshmallow +Requires: python3-peewee + +%description +# Marshmallow-Peewee + +Marshmallow-Peewee -- [Peewee ORM](https://github.com/coleifer/peewee) +integration with the +[Marshmallow](https://github.com/marshmallow-code/marshmallow) +(de)serialization library. + +[![Tests Status](https://github.com/klen/marshmallow-peewee/workflows/tests/badge.svg)](https://github.com/klen/marshmallow-peewee/actions) +[![PYPI Version](https://img.shields.io/pypi/v/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) +[![Python Versions](https://img.shields.io/pypi/pyversions/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) + + +## Requirements + +* python >= 3.7 + +## Installation + +**marshmallow-peewee** should be installed using pip: + +```shell +$ pip install marshmallow-peewee +``` + +### Quickstart + +```python + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + model = User + + role = Role.create() + user = User.create(name='Mike', role=role) + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:27:18.600034+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': 1, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert result.name == 'Mike' + + from marshmallow_peewee import Related + + class UserSchema(ModelSchema): + + role = Related() + + class Meta: + model = User + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:30:32.767483+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': {'id': 5, 'name': 'user'}, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert isinstance(result.role, Role) +``` + +## Usage + +```python + + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + + # model: Bind peewee.Model to the Schema + model = User + + # model_converter: Use custom model_converter + # model_converter = marshmallow_peewee.DefaultConverter + + # dump_only_pk: Primary key is dump only + # dump_only_pk = True + + # string_keys: Convert keys to strings + # string_keys = True + + # id_keys: serialize (and deserialize) ForeignKey fields with _id suffix + # id_keys = False +``` + +You may set global options for `marshmallow-peewee`: + +```python + +from marshmallow_peewee import setup + +setup(id_keys=True, string_keys=False) # Set options for all schemas + +class UserSchema(ModelSchema): + # ... + +``` + +Customize fields convertion: + +```python + +from marshmallow_peewee import DefaultConverter + +# Customize global + +# Serialize boolean as string +DefaultConverter.register(peewee.BooleanField, marshmallow.fields.String) + +# Alternative method +@DefaultConverter.register(peewee.BooleanField) +def build_field(field: peewee.Field, opts, **field_params): + return marshmallow.fields.String(**params) + +# Customize only for a scheme + +class CustomConverter(DefaultConverter): + pass + + +CustomConverter.register(...) + + +class CustomSchema(ModelSchema): # may be inherited + class Meta: + model_converter = CustomConverter + + +```` + +## Bug tracker + +If you have any suggestions, bug reports or annoyances please report them to +the issue tracker at https://github.com/klen/marshmallow-peewee/issues + + +## Contributing + +Development of the project happens at: https://github.com/klen/marshmallow-peewee + + +## License + +Licensed under a [MIT License](http://opensource.org/licenses/MIT) + + +%package -n python3-marshmallow-peewee +Summary: Peewee ORM integration with the Marshmallow (de)serialization library +Provides: python-marshmallow-peewee +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-marshmallow-peewee +# Marshmallow-Peewee + +Marshmallow-Peewee -- [Peewee ORM](https://github.com/coleifer/peewee) +integration with the +[Marshmallow](https://github.com/marshmallow-code/marshmallow) +(de)serialization library. + +[![Tests Status](https://github.com/klen/marshmallow-peewee/workflows/tests/badge.svg)](https://github.com/klen/marshmallow-peewee/actions) +[![PYPI Version](https://img.shields.io/pypi/v/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) +[![Python Versions](https://img.shields.io/pypi/pyversions/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) + + +## Requirements + +* python >= 3.7 + +## Installation + +**marshmallow-peewee** should be installed using pip: + +```shell +$ pip install marshmallow-peewee +``` + +### Quickstart + +```python + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + model = User + + role = Role.create() + user = User.create(name='Mike', role=role) + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:27:18.600034+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': 1, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert result.name == 'Mike' + + from marshmallow_peewee import Related + + class UserSchema(ModelSchema): + + role = Related() + + class Meta: + model = User + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:30:32.767483+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': {'id': 5, 'name': 'user'}, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert isinstance(result.role, Role) +``` + +## Usage + +```python + + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + + # model: Bind peewee.Model to the Schema + model = User + + # model_converter: Use custom model_converter + # model_converter = marshmallow_peewee.DefaultConverter + + # dump_only_pk: Primary key is dump only + # dump_only_pk = True + + # string_keys: Convert keys to strings + # string_keys = True + + # id_keys: serialize (and deserialize) ForeignKey fields with _id suffix + # id_keys = False +``` + +You may set global options for `marshmallow-peewee`: + +```python + +from marshmallow_peewee import setup + +setup(id_keys=True, string_keys=False) # Set options for all schemas + +class UserSchema(ModelSchema): + # ... + +``` + +Customize fields convertion: + +```python + +from marshmallow_peewee import DefaultConverter + +# Customize global + +# Serialize boolean as string +DefaultConverter.register(peewee.BooleanField, marshmallow.fields.String) + +# Alternative method +@DefaultConverter.register(peewee.BooleanField) +def build_field(field: peewee.Field, opts, **field_params): + return marshmallow.fields.String(**params) + +# Customize only for a scheme + +class CustomConverter(DefaultConverter): + pass + + +CustomConverter.register(...) + + +class CustomSchema(ModelSchema): # may be inherited + class Meta: + model_converter = CustomConverter + + +```` + +## Bug tracker + +If you have any suggestions, bug reports or annoyances please report them to +the issue tracker at https://github.com/klen/marshmallow-peewee/issues + + +## Contributing + +Development of the project happens at: https://github.com/klen/marshmallow-peewee + + +## License + +Licensed under a [MIT License](http://opensource.org/licenses/MIT) + + +%package help +Summary: Development documents and examples for marshmallow-peewee +Provides: python3-marshmallow-peewee-doc +%description help +# Marshmallow-Peewee + +Marshmallow-Peewee -- [Peewee ORM](https://github.com/coleifer/peewee) +integration with the +[Marshmallow](https://github.com/marshmallow-code/marshmallow) +(de)serialization library. + +[![Tests Status](https://github.com/klen/marshmallow-peewee/workflows/tests/badge.svg)](https://github.com/klen/marshmallow-peewee/actions) +[![PYPI Version](https://img.shields.io/pypi/v/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) +[![Python Versions](https://img.shields.io/pypi/pyversions/marshmallow-peewee)](https://pypi.org/project/marshmallow-peewee/) + + +## Requirements + +* python >= 3.7 + +## Installation + +**marshmallow-peewee** should be installed using pip: + +```shell +$ pip install marshmallow-peewee +``` + +### Quickstart + +```python + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + model = User + + role = Role.create() + user = User.create(name='Mike', role=role) + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:27:18.600034+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': 1, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert result.name == 'Mike' + + from marshmallow_peewee import Related + + class UserSchema(ModelSchema): + + role = Related() + + class Meta: + model = User + + result = UserSchema().dump(user) + print(result) + # {'active': True, + # 'created': '2016-03-29T15:30:32.767483+00:00', + # 'id': 1, + # 'name': 'Mike', + # 'rating': 0, + # 'role': {'id': 5, 'name': 'user'}, + # 'title': None} + + result = UserSchema().load(result) + assert isinstance(result, User) + assert isinstance(result.role, Role) +``` + +## Usage + +```python + + import peewee as pw + + + class Role(pw.Model): + name = pw.CharField(255, default='user') + + + class User(pw.Model): + + created = pw.DateTimeField(default=dt.datetime.now()) + name = pw.CharField(255) + title = pw.CharField(127, null=True) + active = pw.BooleanField(default=True) + rating = pw.IntegerField(default=0) + + role = pw.ForeignKeyField(Role) + + + from marshmallow_peewee import ModelSchema + + class UserSchema(ModelSchema): + + class Meta: + + # model: Bind peewee.Model to the Schema + model = User + + # model_converter: Use custom model_converter + # model_converter = marshmallow_peewee.DefaultConverter + + # dump_only_pk: Primary key is dump only + # dump_only_pk = True + + # string_keys: Convert keys to strings + # string_keys = True + + # id_keys: serialize (and deserialize) ForeignKey fields with _id suffix + # id_keys = False +``` + +You may set global options for `marshmallow-peewee`: + +```python + +from marshmallow_peewee import setup + +setup(id_keys=True, string_keys=False) # Set options for all schemas + +class UserSchema(ModelSchema): + # ... + +``` + +Customize fields convertion: + +```python + +from marshmallow_peewee import DefaultConverter + +# Customize global + +# Serialize boolean as string +DefaultConverter.register(peewee.BooleanField, marshmallow.fields.String) + +# Alternative method +@DefaultConverter.register(peewee.BooleanField) +def build_field(field: peewee.Field, opts, **field_params): + return marshmallow.fields.String(**params) + +# Customize only for a scheme + +class CustomConverter(DefaultConverter): + pass + + +CustomConverter.register(...) + + +class CustomSchema(ModelSchema): # may be inherited + class Meta: + model_converter = CustomConverter + + +```` + +## Bug tracker + +If you have any suggestions, bug reports or annoyances please report them to +the issue tracker at https://github.com/klen/marshmallow-peewee/issues + + +## Contributing + +Development of the project happens at: https://github.com/klen/marshmallow-peewee + + +## License + +Licensed under a [MIT License](http://opensource.org/licenses/MIT) + + +%prep +%autosetup -n marshmallow-peewee-4.2.2 + +%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-marshmallow-peewee -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 4.2.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..c923038 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +7b1331327aedd0192cc95338d02d8833 marshmallow_peewee-4.2.2.tar.gz -- cgit v1.2.3