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
Metadata
Release files for ocx-databinding 2.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ocx_databinding-2.8.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ocx_databinding-2.8.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / ocx_databinding-2.8.1.tar.gz
| Download URL | ocx_databinding-2.8.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a517cd8fc8c380b2010510fde1a91e459f27105b24b8ef24e3e0a0a306e2955
|
|
BLAKE2b-256 checksum How to use checksums |
9ad3cc9fa43aa935f786a90aa7a61176c6f1a741b40cab1c146e204873d5ff32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 6, 2025.
Transparency logRelease files / ocx_databinding-2.8.1-py3-none-any.whl
| Download URL | ocx_databinding-2.8.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02c64abd80bb572555efa320bc2317802ffb0b344a62769070c8496523920328
|
|
BLAKE2b-256 checksum How to use checksums |
0fbcf1972405ef1756d1dbaf05da85931a6b886a9ad34d5d35491c3de43f0e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 6, 2025.
Transparency log