Home Applications PyObjectscript Gen

PyObjectscript Gen Image Works

Image
InterSystems does not provide technical support for this project. Please contact its developer for the technical assistance.
4Image
1 reviews
0
Awards
137
Views
0
IPM installs
Image0
Image0
Image
Details
Releases (1)
Reviews (1)
Issues
Objectscript class code generation library for Python

What's new in this version

Initial Release

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 creating persistent classes from an arbitrary CSV file describing properties

python3 -m examples.csv_import ./examples/data.csv

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 output directory

python3 -m examples.rest ./examples/generated/rest/


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.

Made with
Version
1.0.026 Jul, 2025
Python package
pyobjectscript_gen
Ideas portal
Category
Developer Environment
Works with
InterSystems IRISEnsemble
First published
26 Jul, 2025
Last edited
01 Aug, 2025
Last checked by moderator
19 Jan, 2026Works