summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-25 13:16:56 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-25 13:16:56 +0000
commit79afbaf43f074bd787ab129046129402da745d90 (patch)
tree9040536dcd857fa32c3a879f0458e57c7badb072
parent10325f67891016b01b9d1f4636a7a2af88372dac (diff)
automatic import of python-jsonschema-gentypesopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-jsonschema-gentypes.spec405
-rw-r--r--sources1
3 files changed, 407 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c8f7575 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/jsonschema_gentypes-2.0.0.tar.gz
diff --git a/python-jsonschema-gentypes.spec b/python-jsonschema-gentypes.spec
new file mode 100644
index 0000000..fc16f8f
--- /dev/null
+++ b/python-jsonschema-gentypes.spec
@@ -0,0 +1,405 @@
+%global _empty_manifest_terminate_build 0
+Name: python-jsonschema-gentypes
+Version: 2.0.0
+Release: 1
+Summary: Tool to generate Python types based on TypedDict from a JSON Schema
+License: BSD-2-Clause
+URL: https://github.com/camptocamp/jsonschema-gentypes
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/72/19/8984d45face2e9f86a3fb7084ef9c21b938dbc753934f2b1809398c86180/jsonschema_gentypes-2.0.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-PyYAML
+Requires: python3-jsonschema
+Requires: python3-pinyin
+Requires: python3-pre-commit
+Requires: python3-referencing
+Requires: python3-requests
+Requires: python3-romanize
+Requires: python3-romkan
+Requires: python3-typing-extensions
+
+%description
+# JSON Schema generate Python types
+
+Tools to generate Python types based on TypedDict from a JSON schema
+
+## Quick start
+
+install:
+
+```bash
+python3 -m pip install --user jsonschema-gentypes
+```
+
+Convert a JSON schema to a Python file contains the types:
+
+```bash
+jsonschema-gentypes --json-schema=<JSON schema> --python=<destination Python file>
+```
+
+## Config file
+
+You can also write a config file named `jsonschema-gentypes.yaml` with:
+
+```yaml
+headers: >
+ # Automatically generated file from a JSON schema
+# Used to correctly format the generated file
+callbacks:
+ - - black
+ - - isort
+generate:
+ - # JSON schema file path
+ source: jsonschema_gentypes/schema.json
+ # Python file path
+ destination: jsonschema_gentypes/configuration.py
+ # The name of the root element
+ root_name: Config
+ # Argument passed to the API
+ api_arguments:
+ additional_properties: Only explicit
+ # Rename an element
+ name_mapping: {}
+ # The minimum Python version that the code should support. By default the
+ # currently executing Python version is chosen. Note that the output
+ # may require typing_extensions to be installed.
+ python_version: '3.11'
+```
+
+And just run:
+
+```bash
+jsonschema-gentypes
+```
+
+## Default
+
+The default values are exported in the Python file, then you can do something like that:
+
+```python
+value_with_default = my_object.get('field_name', my_schema.FIELD_DEFAULT)
+```
+
+## Limitations
+
+Requires Python 3.8
+
+See the [issues with label "limitation"](https://github.com/camptocamp/jsonschema-gentypes/issues?q=is%3Aissue+is%3Aopen+label%3Alimitation).
+
+## Pre-commit hooks
+
+This project provides pre-commit hooks to automatically generate the files.
+
+```yaml
+repos:
+ - repo: https://github.com/camptocamp/jsonschema-gentypes
+ rev: <version> # Use the ref you want to point at
+ hools:
+ - id: jsonschema-gentypes
+ files: |
+ (?x)^(
+ jsonschema-gentypes\.yaml|
+ <schema_path>\.json
+ )$
+```
+
+See also the pre_commit section in the configuration to run the pre-commit just after the generation, for example with:
+
+```yaml
+pre_commit:
+ enabled: true
+ arguments:
+ - --color=never
+```
+
+## Contributing
+
+Install the pre-commit hooks:
+
+```bash
+pip install pre-commit
+pre-commit install --allow-missing-config
+```
+
+The `prospector` tests should pass.
+
+The code should be typed.
+
+The code should be tested with `pytests`.
+
+
+
+%package -n python3-jsonschema-gentypes
+Summary: Tool to generate Python types based on TypedDict from a JSON Schema
+Provides: python-jsonschema-gentypes
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-jsonschema-gentypes
+# JSON Schema generate Python types
+
+Tools to generate Python types based on TypedDict from a JSON schema
+
+## Quick start
+
+install:
+
+```bash
+python3 -m pip install --user jsonschema-gentypes
+```
+
+Convert a JSON schema to a Python file contains the types:
+
+```bash
+jsonschema-gentypes --json-schema=<JSON schema> --python=<destination Python file>
+```
+
+## Config file
+
+You can also write a config file named `jsonschema-gentypes.yaml` with:
+
+```yaml
+headers: >
+ # Automatically generated file from a JSON schema
+# Used to correctly format the generated file
+callbacks:
+ - - black
+ - - isort
+generate:
+ - # JSON schema file path
+ source: jsonschema_gentypes/schema.json
+ # Python file path
+ destination: jsonschema_gentypes/configuration.py
+ # The name of the root element
+ root_name: Config
+ # Argument passed to the API
+ api_arguments:
+ additional_properties: Only explicit
+ # Rename an element
+ name_mapping: {}
+ # The minimum Python version that the code should support. By default the
+ # currently executing Python version is chosen. Note that the output
+ # may require typing_extensions to be installed.
+ python_version: '3.11'
+```
+
+And just run:
+
+```bash
+jsonschema-gentypes
+```
+
+## Default
+
+The default values are exported in the Python file, then you can do something like that:
+
+```python
+value_with_default = my_object.get('field_name', my_schema.FIELD_DEFAULT)
+```
+
+## Limitations
+
+Requires Python 3.8
+
+See the [issues with label "limitation"](https://github.com/camptocamp/jsonschema-gentypes/issues?q=is%3Aissue+is%3Aopen+label%3Alimitation).
+
+## Pre-commit hooks
+
+This project provides pre-commit hooks to automatically generate the files.
+
+```yaml
+repos:
+ - repo: https://github.com/camptocamp/jsonschema-gentypes
+ rev: <version> # Use the ref you want to point at
+ hools:
+ - id: jsonschema-gentypes
+ files: |
+ (?x)^(
+ jsonschema-gentypes\.yaml|
+ <schema_path>\.json
+ )$
+```
+
+See also the pre_commit section in the configuration to run the pre-commit just after the generation, for example with:
+
+```yaml
+pre_commit:
+ enabled: true
+ arguments:
+ - --color=never
+```
+
+## Contributing
+
+Install the pre-commit hooks:
+
+```bash
+pip install pre-commit
+pre-commit install --allow-missing-config
+```
+
+The `prospector` tests should pass.
+
+The code should be typed.
+
+The code should be tested with `pytests`.
+
+
+
+%package help
+Summary: Development documents and examples for jsonschema-gentypes
+Provides: python3-jsonschema-gentypes-doc
+%description help
+# JSON Schema generate Python types
+
+Tools to generate Python types based on TypedDict from a JSON schema
+
+## Quick start
+
+install:
+
+```bash
+python3 -m pip install --user jsonschema-gentypes
+```
+
+Convert a JSON schema to a Python file contains the types:
+
+```bash
+jsonschema-gentypes --json-schema=<JSON schema> --python=<destination Python file>
+```
+
+## Config file
+
+You can also write a config file named `jsonschema-gentypes.yaml` with:
+
+```yaml
+headers: >
+ # Automatically generated file from a JSON schema
+# Used to correctly format the generated file
+callbacks:
+ - - black
+ - - isort
+generate:
+ - # JSON schema file path
+ source: jsonschema_gentypes/schema.json
+ # Python file path
+ destination: jsonschema_gentypes/configuration.py
+ # The name of the root element
+ root_name: Config
+ # Argument passed to the API
+ api_arguments:
+ additional_properties: Only explicit
+ # Rename an element
+ name_mapping: {}
+ # The minimum Python version that the code should support. By default the
+ # currently executing Python version is chosen. Note that the output
+ # may require typing_extensions to be installed.
+ python_version: '3.11'
+```
+
+And just run:
+
+```bash
+jsonschema-gentypes
+```
+
+## Default
+
+The default values are exported in the Python file, then you can do something like that:
+
+```python
+value_with_default = my_object.get('field_name', my_schema.FIELD_DEFAULT)
+```
+
+## Limitations
+
+Requires Python 3.8
+
+See the [issues with label "limitation"](https://github.com/camptocamp/jsonschema-gentypes/issues?q=is%3Aissue+is%3Aopen+label%3Alimitation).
+
+## Pre-commit hooks
+
+This project provides pre-commit hooks to automatically generate the files.
+
+```yaml
+repos:
+ - repo: https://github.com/camptocamp/jsonschema-gentypes
+ rev: <version> # Use the ref you want to point at
+ hools:
+ - id: jsonschema-gentypes
+ files: |
+ (?x)^(
+ jsonschema-gentypes\.yaml|
+ <schema_path>\.json
+ )$
+```
+
+See also the pre_commit section in the configuration to run the pre-commit just after the generation, for example with:
+
+```yaml
+pre_commit:
+ enabled: true
+ arguments:
+ - --color=never
+```
+
+## Contributing
+
+Install the pre-commit hooks:
+
+```bash
+pip install pre-commit
+pre-commit install --allow-missing-config
+```
+
+The `prospector` tests should pass.
+
+The code should be typed.
+
+The code should be tested with `pytests`.
+
+
+
+%prep
+%autosetup -n jsonschema-gentypes-2.0.0
+
+%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-jsonschema-gentypes -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 25 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..61f8973
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+1cfb28689febf85f9adbba0f47db8b00 jsonschema_gentypes-2.0.0.tar.gz