defineutils
CDISC Define-XML v2.1 utilities
The defineutils package currently includes 2 modules:
definehtml.py: transforms a define.xml into a define.html using the stylesheetvalidate.py: schema validates a define.xml file
The definehtml.py module includes the Define-XML v2.1 style sheet to simplify usage. It generates a define.html file,
or alternatively will generate an HTML string.
The validate.py module includes the Define-XML v2.1 schema to simplify usage. It schema validates a define.xml file
and returns a define.xml is valid message to indicate success, or a detailed message documenting the schema validation
issues.
Using defineutils
Currently, defineutils contains 2 modules, one for generating an HTML rendition and one for schema validation.
Example code used to generate a define.html from a define.xml:
from pathlib import Path
from defineutils.definehtml import DefineHtml, DefineHtmlGenerationError
out_file = Path(__file__).parent.joinpath("define.html")
dh = DefineHtml(Path(__file__).parent.joinpath("define.xml"))
dh.transform_to_html_file(out_file)
The above code applies the Define-XML v2.1 stylesheet to the define.xml to generation the define.html file. The stylesheet is embedded in the module. For error handling, use the custom DefineHtmlGenerationError exception.
Example code used to schema validate a define.xml:
from pathlib import Path
from defineutils.validate import DefineSchemaValidator, DefineSchemaValidationError
validator = DefineSchemaValidator(Path(__file__).parent.joinpath("define.xml"))
try:
result = validator.validate_define_file()
except DefineSchemaValidationError as e:
print(e)
The above code schema validates the specified define.xml file. The Define-XML v2.1 schema is embedded into the module. The schema validation errors are reported via the DefineSchemaValidationError exception.
Running defineutils from the Command-line
When you run a module with the -m switch it will execute the defineutils modules from the command-line. For example, to transform a define.xml file into HTML using the stylesheet, the following command-line example executes the module to generate define.html. The -m parameter instructs Python to run the module as an application. The definehtml program uses the -d parameter to specify the define.xml file path and the -o to specify the define.html file path.
python3 -m defineutils.definehtml -d tests/define.xml -o tests/define.html
The validate command can be executed using the command-line the same way. For validate, only the -d parameter is required to indicate the file path of the define.xml to validate.
python3 -m defineutils.validate -d tests/define.xml
If you are running defineutils from the source code using a virtual environment, you may need to activate that virtual environment before running the code from the command-line.
source .venv/bin/activate
python3 -m defineutils.validate -d tests/define.xml
Metadata
Release files for defineutils 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| defineutils-0.2.1.tar.gz | 59.4 kB | Without provenance | Details for defineutils-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| defineutils-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for defineutils-0.2.1-py3-none-any.whl |
Total release size: 125.0 kB
Release files / defineutils-0.2.1.tar.gz
| Download URL | defineutils-0.2.1.tar.gz |
|---|---|
| Size | 59.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae0c514edaf75a787f3def55399231ba70e29f624be7b1f61898ee59b7d2de7c
|
|
BLAKE2b-256 checksum How to use checksums |
5acff24e06e82ee015899ed3e86d43acd33f35a67205d6b24aa853727c62e4ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / defineutils-0.2.1-py3-none-any.whl
| Download URL | defineutils-0.2.1-py3-none-any.whl |
|---|---|
| Size | 65.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
477a7ec6c66387cbb4e4fd4e841a957552a7041c22d1ef8b3fa9f46e9e8dd281
|
|
BLAKE2b-256 checksum How to use checksums |
99e4ce6555931c46c5fd6c4f4597983d0ed7b61b1dd1479677feba6ac378ed97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for defineutils 0.2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.