Python CLI for managing OCX schema databinding and versioning according to PEP 440.
Project description
ocx-databinding
CLI python script for managing the OCX schema databinding. See the documentation of xsdata for details on creating python databindings.
Installation
pip install ocx_databinding
Changes
Usage
databinding --help
Usage: databinding [OPTIONS] COMMAND [ARGS]...
Options:
--install-completion Install completion for the current shell.
--show-completion Show completion for the current shell, to copy it or
customize the installation.
--help Show this message and exit.
Commands:
generate Generate code from xml schemas, webservice definitions and...
version Print the version number and exit.
Generate a datbinding:
Usage: databinding generate [OPTIONS] SOURCE PACKAGE SCHEMA_VERSION
Generate code from xml schemas, webservice definitions and any xml or json
document. The input source can be either a filepath, uri or a directory
containing xml, json, xsd and wsdl files.
Arguments:
SOURCE [required]
PACKAGE [required]
SCHEMA_VERSION [required]
Options:
--docstring-style TEXT [default: Google]
--structure-style TEXT [default: single-package]
--slots / --no-slots [default: slots]
--recursive / --no-recursive [default: no-recursive]
--help Show this message and exit.
Example
Generate the databindings from the unitsML schema url:
databinding generate https://3docx.org/fileadmin/ocx_schema/unitsml/unitsmlSchema_lite-0.9.18.xsd unitsml 0.9.18
2023-09-04 11:17:28.705 | INFO | ocx_databinding.generator:generate:64 - New databinding package name is unitsml_0918 with version: 0.9.18 is created in C:\PythonDev\ocx-generator\unitsml
========= xsdata v23.8 / Python 3.11.5 / Platform win32 =========
Parsing schema https://3docx.org/fileadmin/ocx_schema/unitsml/unitsmlSchema_lite-0.9.18.xsd
Parsing schema file:///C:/miniconda3/envs/generator/Lib/site-packages/xsdata/schemas/xml.xsd
Compiling schema file:///C:/miniconda3/envs/generator/Lib/site-packages/xsdata/schemas/xml.xsd
Builder: 5 main and 2 inner classes
Compiling schema https://3docx.org/fileadmin/ocx_schema/unitsml/unitsmlSchema_lite-0.9.18.xsd
Builder: 38 main and 2 inner classes
Analyzer input: 43 main and 4 inner classes
Analyzer output: 35 main and 0 inner classes
Generating package: init
Generating package: unitsml_0918
This has now generated a subdirectory unitsml
with the following structure:
C:.
└───unitsml
└───unitsml_0918
and with the content:
Length Name
------ ----
29577 unitsml_0918.py
2145 xsdata.xml
1531 __init__.py
The CLI generates a single package, meaning that any imported schemas are ignored, see xsdata if more detailed control of the databinding is necessary. The databindings are also versioned by creating a package name with the version string. This allows us to have multiple databindings representing different schema versions.
API documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ocx_databinding-2.7.1.tar.gz
.
File metadata
- Download URL: ocx_databinding-2.7.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ac9b07ab0d04a778e4d3a87c54ac8283899b00e01528aeb7555464d003793b5 |
|
MD5 | 947440f2b73c704922c2e53d266a16ca |
|
BLAKE2b-256 | 3c44127e1d9d944d9b006c9ba241dc46f47459763fdf4d58bc84b44559e52efd |
File details
Details for the file ocx_databinding-2.7.1-py3-none-any.whl
.
File metadata
- Download URL: ocx_databinding-2.7.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f7919e381e7498db523fd9890557b879383a3787a47295cd79f5171d53d93ad |
|
MD5 | 899f25e3956251914f89e69893e382b6 |
|
BLAKE2b-256 | efbf11b818434a84dd5174de85c3add73575832c1579a4243ee5c400d062cd9b |