Skip to main content

owl22python

Bidirectional OWL2 ⇄ Python over a renderable block/class system. Make blocks, make classes from data, and keep an OWL ontology for everything you make. Dependency-light (pydantic + jinja2), no network, no external services.

What's in it

  • pydantic_stack — RenderablePiece (a block: a renderable typed pydantic model) + MetaStack (a stack of blocks that renders to one output).
  • template_mixins — TemplateAttributeMixin / TemplateMethodMixin: class-level templating — add_attribute, add_method, execute_template_sequence — grow a class's attributes and methods from data at runtime.
  • templated_class — TemplatedClass: a BaseModel + the mixins, configurable from a dict, that can emit real .py source of itself (generate_class_template / generate_code_files).
  • owl22python(xml) / python22owl(cls) — OWL2/XML ⇄ a generated RenderablePiece class (one typed field per OWL DataProperty). Bidirectional: every class knows its own OWL, so you can define a thing in OWL or in Python and round-trip it.

Example

from owl22python import owl22python, python22owl, RenderablePiece, MetaStack, TemplatedClass

# OWL -> a live Python class
M = owl22python(EXAMPLE_OWL2_XML)["ModelClass"]
owl = M(species="Great Horned Owl", wingspan_cm=120.0, nocturnal=True)
print(owl.render())               # -> OWL individual (RDF/XML) + typed triples

# Python -> OWL (the inverse): the class knows its own ontology
print(python22owl(M))             # -> OWL2/XML schema for M

MIT.

Metadata

Release files for owl22python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for owl22python 0.1.0
File Size Uploaded Provenance
owl22python-0.1.0.tar.gz 17.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for owl22python 0.1.0
File Interpreter ABI Platform
owl22python-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.3 kB

Release files / owl22python-0.1.0.tar.gz

Download URL owl22python-0.1.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f940370e5c9aaa1dabaaeb902382b9f23f1f6eb29c209ce34dd941681352315d
BLAKE2b-256 checksum
How to use checksums
3926ca97359a5423caba44f9a758c4cec4c03e387629a5366cad75ac084d950b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / owl22python-0.1.0-py3-none-any.whl

Download URL owl22python-0.1.0-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e416e49d6c20b145f87fbcfe057c92a7c599987ac973944082a813882e94a663
BLAKE2b-256 checksum
How to use checksums
72ace5bb9ecb1e9392e3efc485090f702609c8d139bf1b32fdaaf0ae92abbc39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for owl22python 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page