PyObjectscript Gen
Objectscript class code generation library for Python
Features
- Objectscript class code generation
- Clean and simple to use interface in python
- Extensible classes for custom usage
Installation
You can install the package using pip:
pip install pyobjectscript_gen
Or from source:
git clone https://github.com/Antoine-dh/pyobjectscript_gen.git
pip install .
Usage
Here's a basic example of how to use the library:
from pyobjectscript_gen.cls import *
cls = Class(
name="Demo.MyExample.MyClass",
extends=["%RegisteredObject"]
)
# example of declaratively creating properties
cls.components = [
Property(
name="Property1",
type="%String",
),
Property(
name="Property2",
type="%Numeric",
),
]
# example of iteratively creating a method
method = Method("MyMethod")
method.return_type = "%String"
method.impl = [
"set returnvalue=..Property1_..Property2",
"quit returnvalue"
]
# append method to class components
cls.components.append(method)
# generate on sys.stdout
cls.generate()
See the generated class in examples/generated/basic.cls
Requirements
- Python 3.9+
- Jinja2
Documentation
You can find the full documentation at: Read the docs
All the documentation can also be found in code with python docstrings in src/pyobjectscript_gen/cls.py
Running Examples
All examples code can be found in examples/ and their respective output classes in examples/generated/
# Basic class example with 2 properties and a method
python3 -m examples.basic > basic.cls
# Test class for every features capable to be generated by the library
python3 -m examples.features > features.cls
# Real life example of multiple classes generation using custom subclasses of the library's components
# Generates a simple REST example with a business operation, request and response classes in the specified directory
mkdir output/
python3 -m examples.rest ./output/
More examples to come...
Contributing
Contributions are welcome!
To get started:
git clone https://github.com/Antoine-dh/pyobjectscript_gen.git
python -m venv .venv
source .venv/bin/activate # On Windows, use .venv\bin\activate.bat
pip install -r requirements.txt
License
This project is licensed under the GNU General Public License.
Metadata
Release files for pyobjectscript-gen 1.0
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 |
|---|---|---|---|---|
| pyobjectscript_gen-1.0.tar.gz | 628.5 kB | Without provenance | Details for pyobjectscript_gen-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyobjectscript_gen-1.0-py3-none-any.whl | Python 3 | none | any | Details for pyobjectscript_gen-1.0-py3-none-any.whl |
Total release size: 644.8 kB
Release files / pyobjectscript_gen-1.0.tar.gz
| Download URL | pyobjectscript_gen-1.0.tar.gz |
|---|---|
| Size | 628.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
accdbaf80f12c4f14a4ca2706078fd1fdff516062c2e5a4a473d52d2cc6c179c
|
|
BLAKE2b-256 checksum How to use checksums |
5b6f08fad117c1d9f00719351c8d93124c9c6b5d0454e387a688f60969b33804
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / pyobjectscript_gen-1.0-py3-none-any.whl
| Download URL | pyobjectscript_gen-1.0-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22a170e6d3c1359b74b64f7799aae036ef287787638fad95ffba92ef486a10ba
|
|
BLAKE2b-256 checksum How to use checksums |
8cc7a78ac56708631bc08be12842d48d43123e586f8da442bf7d7dbd76f79acd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for pyobjectscript-gen 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.