diff options
author | CoprDistGit <infra@openeuler.org> | 2023-06-09 01:40:48 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-06-09 01:40:48 +0000 |
commit | 50e54fd4c06e599777532f7c9bd3b79062405d9e (patch) | |
tree | b8db18a64463cd8ea79178bf4fc98b0dfc3dc429 | |
parent | 9864fc8b8f70e69d54e9786a559e21f2009e7807 (diff) |
automatic import of python-formio-dataopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-formio-data.spec | 672 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 674 insertions, 0 deletions
@@ -0,0 +1 @@ +/formio-data-0.5.1.tar.gz diff --git a/python-formio-data.spec b/python-formio-data.spec new file mode 100644 index 0000000..75a1d64 --- /dev/null +++ b/python-formio-data.spec @@ -0,0 +1,672 @@ +%global _empty_manifest_terminate_build 0 +Name: python-formio-data +Version: 0.5.1 +Release: 1 +Summary: formio.js JSON-data API +License: MIT +URL: https://github.com/novacode-nl/python-formio-data +Source0: https://mirrors.aliyun.com/pypi/web/packages/27/5f/7db7438e66cbe3433a82eb637d1fc6e93d829755ba716db34c714c0f2afd/formio-data-0.5.1.tar.gz +BuildArch: noarch + +Requires: python3-dateutil +Requires: python3-requests +Requires: python3-json_logic_qubit + +%description +# formio-data (Python) + +formio.js (JSON Form Builder) data API for Python. + +For information about the formio.js project, see https://github.com/formio/formio.js + +## Introduction + +**python-formio-data** is a Python package, which loads and transforms +formio.js **Builder JSON** and **Form JSON** into **usable Python objects**. It's main +aim is to provide easy access to a Form its components/fields, also +captured as **Python objects**, which makes this API very versatile and usable. + +**Notes about terms:** + - **Builder:** The Form Builder which is the design/blueprint of a Form. + - **Form:** A filled-in Form, aka Form submission. + - **Component:** Input (field) or layout component in the Form Builder and Form. + +## Features + + - Compatible with Python 3.6 and later + - Constructor of the **Builder** and **Form** class, only requires + the JSON and an optional language code for translations. + - Get a Form object its Components as a usable object e.g. datetime, boolean, dict (for select component) etc. + - Open source (MIT License) + +## Installation + +The source code is currently hosted on GitHub at: +https://github.com/novacode-nl/python-formio-data + +### PyPI - Python Package Index + +Binary installers for the latest released version are available at the [Python +Package Index](https://pypi.python.org/pypi/formio-data) + +```sh +pip(3) install formio-data +``` + +#### Optional dependencies + +To support conditional visibility using JSON logic, you can install +the `json-logic-qubit` package (the `json-logic` package it is forked +off of is currently unmaintained). It's also possible to install it +via the pip feature `json_logic` like so: + +```sh +pip(3) install -U formio-data[json_logic] +``` + +### Source Install with Poetry (recommended) + +Convenient for developers. Also useful for running the (unit)tests. + +```sh +git clone git@github.com:novacode-nl/python-formio-data.git +poetry install +``` + +#### Optional dependencies + +When working in the project itself, use + +```sh +poetry install -E json_logic +``` + +### Source Install with pip + +Optional dependencies need to be installed separately. + +```sh +pip(3) install -U -e python-formio-data +``` + +## Using direnv + +You can use [nixpkgs](https://nixos.org/) to run a self-contained +Python environment without any additional setup. Once you've +installed nixpkgs, switch into the directory and type "nix-shell" to +get a shell from which the correct Python with packages is available. + +If you're using [direnv](https://direnv.net/), use `direnv allow` +after changing into the project directory and you're good to go. Also +consider [nix-direnv](https://github.com/nix-community/nix-direnv) to +speed up the experience (it can re-use a cached local installation). + +## License +[MIT](LICENSE) + +## Contributing +All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. + +## Usage examples + +For more examples of usage, see the unit-tests. + +``` python +>> from formiodata import Builder, Form +>> +# builder_json is a formio.js Builder JSON document (text/string) +# form_json is a formio.js Form JSON document (text/string) +>> +>> builder = Builder(builder_json) +>> form = Form(builder, form_json) + +################## +# input components +################## + +# textfield label +>> print(form.input_components['firstname'].label) +'First Name' + +# textfield value +>> print(form.input_components['firstname'].value) +'Bob' + +# datetime label +>> print(form.input_components['birthday'].label) +'Birthday' + +# datetime value +>> print(form.input_components['birthday'].value) +datetime.date(2009 10 16) + +# datagrid (rows property) +>> print(form.input_components['datagridMeasurements'].rows) +[ + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>}, + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>} +] + +>> for row in form.input_components['datagridMeasurements'].rows: +>> dtime = row['measurementDatetime'] +>> fahrenheit = row['measurementFahrenheit'] +>> print(%s: %s, %s: %s' % (dt.label, dt.value, fahrenheit.label, fahrenheit.value)) + +Datetime: datetime.datetime(2021, 5, 8, 11, 39, 0, 296487), Fahrenheit: 122 +Datetime: datetime.datetime(2021, 5, 8, 11, 41, 5, 919943), Fahrenheit: 131 + +# alternative example, by getattr +>> print(form.data.firstname.label) +'First Name' + +>> print(form.data.firstname.value) +'Bob' + +################################# +# components (layout, input etc.) +################################# + +# columns +>> print(form.components['addressColumns']) +<columnsComponent> + +>> print(form.components['addressColumns'].rows) +[ + {'firstName': <textfieldComponent>, 'lastName: <textfieldComponent>}, + {'email': <emailComponent>, 'companyName: <textfieldComponent>} +] +``` + +## Unit tests + +**Note:** + +Internet access is recommended for running the `filecStorageUrlComponentTestCase`, because this also tests the URL Storage (type).\ +If no internet access, this test won't fail and a WARNING shall be logged regarding a ConnectionError. + +### Run all unittests + +From toplevel directory: + +``` +poetry install -E json_logic # if you haven't already +poetry run python -m unittest +``` + +### Run component unittests + +All Components, from toplevel directory: + +``` +poetry run python -m unittest tests/test_component_*.py +``` + +Nested components (complexity), from toplevel directory: + +``` +poetry run python -m unittest tests/test_nested_components.py +``` + +### Run specific component unittest + +``` +poetry run python -m unittest tests.test_component_day.dayComponentTestCase.test_get_form_dayMonthYear +``` + + +%package -n python3-formio-data +Summary: formio.js JSON-data API +Provides: python-formio-data +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-formio-data +# formio-data (Python) + +formio.js (JSON Form Builder) data API for Python. + +For information about the formio.js project, see https://github.com/formio/formio.js + +## Introduction + +**python-formio-data** is a Python package, which loads and transforms +formio.js **Builder JSON** and **Form JSON** into **usable Python objects**. It's main +aim is to provide easy access to a Form its components/fields, also +captured as **Python objects**, which makes this API very versatile and usable. + +**Notes about terms:** + - **Builder:** The Form Builder which is the design/blueprint of a Form. + - **Form:** A filled-in Form, aka Form submission. + - **Component:** Input (field) or layout component in the Form Builder and Form. + +## Features + + - Compatible with Python 3.6 and later + - Constructor of the **Builder** and **Form** class, only requires + the JSON and an optional language code for translations. + - Get a Form object its Components as a usable object e.g. datetime, boolean, dict (for select component) etc. + - Open source (MIT License) + +## Installation + +The source code is currently hosted on GitHub at: +https://github.com/novacode-nl/python-formio-data + +### PyPI - Python Package Index + +Binary installers for the latest released version are available at the [Python +Package Index](https://pypi.python.org/pypi/formio-data) + +```sh +pip(3) install formio-data +``` + +#### Optional dependencies + +To support conditional visibility using JSON logic, you can install +the `json-logic-qubit` package (the `json-logic` package it is forked +off of is currently unmaintained). It's also possible to install it +via the pip feature `json_logic` like so: + +```sh +pip(3) install -U formio-data[json_logic] +``` + +### Source Install with Poetry (recommended) + +Convenient for developers. Also useful for running the (unit)tests. + +```sh +git clone git@github.com:novacode-nl/python-formio-data.git +poetry install +``` + +#### Optional dependencies + +When working in the project itself, use + +```sh +poetry install -E json_logic +``` + +### Source Install with pip + +Optional dependencies need to be installed separately. + +```sh +pip(3) install -U -e python-formio-data +``` + +## Using direnv + +You can use [nixpkgs](https://nixos.org/) to run a self-contained +Python environment without any additional setup. Once you've +installed nixpkgs, switch into the directory and type "nix-shell" to +get a shell from which the correct Python with packages is available. + +If you're using [direnv](https://direnv.net/), use `direnv allow` +after changing into the project directory and you're good to go. Also +consider [nix-direnv](https://github.com/nix-community/nix-direnv) to +speed up the experience (it can re-use a cached local installation). + +## License +[MIT](LICENSE) + +## Contributing +All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. + +## Usage examples + +For more examples of usage, see the unit-tests. + +``` python +>> from formiodata import Builder, Form +>> +# builder_json is a formio.js Builder JSON document (text/string) +# form_json is a formio.js Form JSON document (text/string) +>> +>> builder = Builder(builder_json) +>> form = Form(builder, form_json) + +################## +# input components +################## + +# textfield label +>> print(form.input_components['firstname'].label) +'First Name' + +# textfield value +>> print(form.input_components['firstname'].value) +'Bob' + +# datetime label +>> print(form.input_components['birthday'].label) +'Birthday' + +# datetime value +>> print(form.input_components['birthday'].value) +datetime.date(2009 10 16) + +# datagrid (rows property) +>> print(form.input_components['datagridMeasurements'].rows) +[ + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>}, + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>} +] + +>> for row in form.input_components['datagridMeasurements'].rows: +>> dtime = row['measurementDatetime'] +>> fahrenheit = row['measurementFahrenheit'] +>> print(%s: %s, %s: %s' % (dt.label, dt.value, fahrenheit.label, fahrenheit.value)) + +Datetime: datetime.datetime(2021, 5, 8, 11, 39, 0, 296487), Fahrenheit: 122 +Datetime: datetime.datetime(2021, 5, 8, 11, 41, 5, 919943), Fahrenheit: 131 + +# alternative example, by getattr +>> print(form.data.firstname.label) +'First Name' + +>> print(form.data.firstname.value) +'Bob' + +################################# +# components (layout, input etc.) +################################# + +# columns +>> print(form.components['addressColumns']) +<columnsComponent> + +>> print(form.components['addressColumns'].rows) +[ + {'firstName': <textfieldComponent>, 'lastName: <textfieldComponent>}, + {'email': <emailComponent>, 'companyName: <textfieldComponent>} +] +``` + +## Unit tests + +**Note:** + +Internet access is recommended for running the `filecStorageUrlComponentTestCase`, because this also tests the URL Storage (type).\ +If no internet access, this test won't fail and a WARNING shall be logged regarding a ConnectionError. + +### Run all unittests + +From toplevel directory: + +``` +poetry install -E json_logic # if you haven't already +poetry run python -m unittest +``` + +### Run component unittests + +All Components, from toplevel directory: + +``` +poetry run python -m unittest tests/test_component_*.py +``` + +Nested components (complexity), from toplevel directory: + +``` +poetry run python -m unittest tests/test_nested_components.py +``` + +### Run specific component unittest + +``` +poetry run python -m unittest tests.test_component_day.dayComponentTestCase.test_get_form_dayMonthYear +``` + + +%package help +Summary: Development documents and examples for formio-data +Provides: python3-formio-data-doc +%description help +# formio-data (Python) + +formio.js (JSON Form Builder) data API for Python. + +For information about the formio.js project, see https://github.com/formio/formio.js + +## Introduction + +**python-formio-data** is a Python package, which loads and transforms +formio.js **Builder JSON** and **Form JSON** into **usable Python objects**. It's main +aim is to provide easy access to a Form its components/fields, also +captured as **Python objects**, which makes this API very versatile and usable. + +**Notes about terms:** + - **Builder:** The Form Builder which is the design/blueprint of a Form. + - **Form:** A filled-in Form, aka Form submission. + - **Component:** Input (field) or layout component in the Form Builder and Form. + +## Features + + - Compatible with Python 3.6 and later + - Constructor of the **Builder** and **Form** class, only requires + the JSON and an optional language code for translations. + - Get a Form object its Components as a usable object e.g. datetime, boolean, dict (for select component) etc. + - Open source (MIT License) + +## Installation + +The source code is currently hosted on GitHub at: +https://github.com/novacode-nl/python-formio-data + +### PyPI - Python Package Index + +Binary installers for the latest released version are available at the [Python +Package Index](https://pypi.python.org/pypi/formio-data) + +```sh +pip(3) install formio-data +``` + +#### Optional dependencies + +To support conditional visibility using JSON logic, you can install +the `json-logic-qubit` package (the `json-logic` package it is forked +off of is currently unmaintained). It's also possible to install it +via the pip feature `json_logic` like so: + +```sh +pip(3) install -U formio-data[json_logic] +``` + +### Source Install with Poetry (recommended) + +Convenient for developers. Also useful for running the (unit)tests. + +```sh +git clone git@github.com:novacode-nl/python-formio-data.git +poetry install +``` + +#### Optional dependencies + +When working in the project itself, use + +```sh +poetry install -E json_logic +``` + +### Source Install with pip + +Optional dependencies need to be installed separately. + +```sh +pip(3) install -U -e python-formio-data +``` + +## Using direnv + +You can use [nixpkgs](https://nixos.org/) to run a self-contained +Python environment without any additional setup. Once you've +installed nixpkgs, switch into the directory and type "nix-shell" to +get a shell from which the correct Python with packages is available. + +If you're using [direnv](https://direnv.net/), use `direnv allow` +after changing into the project directory and you're good to go. Also +consider [nix-direnv](https://github.com/nix-community/nix-direnv) to +speed up the experience (it can re-use a cached local installation). + +## License +[MIT](LICENSE) + +## Contributing +All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. + +## Usage examples + +For more examples of usage, see the unit-tests. + +``` python +>> from formiodata import Builder, Form +>> +# builder_json is a formio.js Builder JSON document (text/string) +# form_json is a formio.js Form JSON document (text/string) +>> +>> builder = Builder(builder_json) +>> form = Form(builder, form_json) + +################## +# input components +################## + +# textfield label +>> print(form.input_components['firstname'].label) +'First Name' + +# textfield value +>> print(form.input_components['firstname'].value) +'Bob' + +# datetime label +>> print(form.input_components['birthday'].label) +'Birthday' + +# datetime value +>> print(form.input_components['birthday'].value) +datetime.date(2009 10 16) + +# datagrid (rows property) +>> print(form.input_components['datagridMeasurements'].rows) +[ + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>}, + {'measurementDatetime': <datetimeComponent>, 'measurementFahrenheit': <numberComponent>} +] + +>> for row in form.input_components['datagridMeasurements'].rows: +>> dtime = row['measurementDatetime'] +>> fahrenheit = row['measurementFahrenheit'] +>> print(%s: %s, %s: %s' % (dt.label, dt.value, fahrenheit.label, fahrenheit.value)) + +Datetime: datetime.datetime(2021, 5, 8, 11, 39, 0, 296487), Fahrenheit: 122 +Datetime: datetime.datetime(2021, 5, 8, 11, 41, 5, 919943), Fahrenheit: 131 + +# alternative example, by getattr +>> print(form.data.firstname.label) +'First Name' + +>> print(form.data.firstname.value) +'Bob' + +################################# +# components (layout, input etc.) +################################# + +# columns +>> print(form.components['addressColumns']) +<columnsComponent> + +>> print(form.components['addressColumns'].rows) +[ + {'firstName': <textfieldComponent>, 'lastName: <textfieldComponent>}, + {'email': <emailComponent>, 'companyName: <textfieldComponent>} +] +``` + +## Unit tests + +**Note:** + +Internet access is recommended for running the `filecStorageUrlComponentTestCase`, because this also tests the URL Storage (type).\ +If no internet access, this test won't fail and a WARNING shall be logged regarding a ConnectionError. + +### Run all unittests + +From toplevel directory: + +``` +poetry install -E json_logic # if you haven't already +poetry run python -m unittest +``` + +### Run component unittests + +All Components, from toplevel directory: + +``` +poetry run python -m unittest tests/test_component_*.py +``` + +Nested components (complexity), from toplevel directory: + +``` +poetry run python -m unittest tests/test_nested_components.py +``` + +### Run specific component unittest + +``` +poetry run python -m unittest tests.test_component_day.dayComponentTestCase.test_get_form_dayMonthYear +``` + + +%prep +%autosetup -n formio-data-0.5.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-formio-data -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri Jun 09 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.1-1 +- Package Spec generated @@ -0,0 +1 @@ +b0dfd3697f3df4b1e81d44ad87e123f7 formio-data-0.5.1.tar.gz |