pyobjectscript-gen


Namepyobjectscript-gen JSON
Version 1.0 PyPI version JSON
download
home_pageNone
SummaryObjectscript class code generation library for Python
upload_time2025-07-28 18:40:44
maintainerAntoine-dh
docs_urlNone
authorAntoine-dh
requires_python>=3.9
licenseNone
keywords cls code generation intersystems iris objectscript
VCS
bugtrack_url
requirements jinja2
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```shell
pip install pyobjectscript_gen
````

Or from source:

```shell
git clone https://github.com/Antoine-dh/pyobjectscript_gen.git
pip install .
```

---

## Usage

Here's a basic example of how to use the library:

```python
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](https://pyobjectscript-gen.readthedocs.io/en/latest/)

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/`

```bash
# 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:

```bash
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](https://www.gnu.org/licenses/gpl-3.0.txt).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyobjectscript-gen",
    "maintainer": "Antoine-dh",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "cls, code generation, intersystems, iris, objectscript",
    "author": "Antoine-dh",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/5b/6f/08fad117c1d9f00719351c8d93124c9c6b5d0454e387a688f60969b33804/pyobjectscript_gen-1.0.tar.gz",
    "platform": null,
    "description": "# PyObjectscript Gen\n\nObjectscript class code generation library for Python\n\n---\n\n## Features\n\n- Objectscript class code generation \n- Clean and simple to use interface in python\n- Extensible classes for custom usage\n\n---\n\n## Installation\n\nYou can install the package using pip:\n\n```shell\npip install pyobjectscript_gen\n````\n\nOr from source:\n\n```shell\ngit clone https://github.com/Antoine-dh/pyobjectscript_gen.git\npip install .\n```\n\n---\n\n## Usage\n\nHere's a basic example of how to use the library:\n\n```python\nfrom pyobjectscript_gen.cls import *\n\ncls = Class(\n    name=\"Demo.MyExample.MyClass\",\n    extends=[\"%RegisteredObject\"]\n)\n\n# example of declaratively creating properties\ncls.components = [\n    Property(\n        name=\"Property1\",\n        type=\"%String\",\n    ),\n    Property(\n        name=\"Property2\",\n        type=\"%Numeric\",\n    ),\n]\n\n# example of iteratively creating a method\nmethod = Method(\"MyMethod\")\nmethod.return_type = \"%String\"\nmethod.impl = [\n    \"set returnvalue=..Property1_..Property2\",\n    \"quit returnvalue\"\n]\n\n# append method to class components\ncls.components.append(method)\n\n# generate on sys.stdout\ncls.generate()\n```\n\nSee the generated class in `examples/generated/basic.cls`\n\n---\n\n## Requirements\n\n* Python 3.9+\n* Jinja2\n\n---\n\n## Documentation\n\nYou can find the full documentation at: [Read the docs](https://pyobjectscript-gen.readthedocs.io/en/latest/)\n\nAll the documentation can also be found in code with python docstrings in `src/pyobjectscript_gen/cls.py`\n\n---\n\n## Running Examples\n\nAll examples code can be found in `examples/` and their respective output classes in `examples/generated/`\n\n```bash\n# Basic class example with 2 properties and a method\npython3 -m examples.basic > basic.cls\n\n# Test class for every features capable to be generated by the library\npython3 -m examples.features > features.cls\n\n# Real life example of multiple classes generation using custom subclasses of the library's components\n# Generates a simple REST example with a business operation, request and response classes in the specified directory\nmkdir output/\npython3 -m examples.rest ./output/\n```\n\nMore examples to come...\n\n---\n\n## Contributing\n\nContributions are welcome!\n\nTo get started:\n\n```bash\ngit clone https://github.com/Antoine-dh/pyobjectscript_gen.git\npython -m venv .venv\nsource .venv/bin/activate  # On Windows, use .venv\\bin\\activate.bat\npip install -r requirements.txt\n```\n\n---\n\n## License\n\nThis project is licensed under the [GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.txt).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Objectscript class code generation library for Python",
    "version": "1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/Antoine-dh/pyobjectscript_gen/issues",
        "Changelog": "https://github.com/Antoine-dh/pyobjectscript_gen/blob/master/CHANGELOG.md",
        "Documentation": "https://readthedocs.org",
        "Repository": "https://github.com/Antoine-dh/pyobjectscript_gen.git"
    },
    "split_keywords": [
        "cls",
        " code generation",
        " intersystems",
        " iris",
        " objectscript"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8cc7a78ac56708631bc08be12842d48d43123e586f8da442bf7d7dbd76f79acd",
                "md5": "fb54019b02ac9244d83316c9eddb6394",
                "sha256": "22a170e6d3c1359b74b64f7799aae036ef287787638fad95ffba92ef486a10ba"
            },
            "downloads": -1,
            "filename": "pyobjectscript_gen-1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb54019b02ac9244d83316c9eddb6394",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16300,
            "upload_time": "2025-07-28T18:40:42",
            "upload_time_iso_8601": "2025-07-28T18:40:42.689771Z",
            "url": "https://files.pythonhosted.org/packages/8c/c7/a78ac56708631bc08be12842d48d43123e586f8da442bf7d7dbd76f79acd/pyobjectscript_gen-1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5b6f08fad117c1d9f00719351c8d93124c9c6b5d0454e387a688f60969b33804",
                "md5": "dcfa1d225aa8c5d6249259a91f3d0f14",
                "sha256": "accdbaf80f12c4f14a4ca2706078fd1fdff516062c2e5a4a473d52d2cc6c179c"
            },
            "downloads": -1,
            "filename": "pyobjectscript_gen-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dcfa1d225aa8c5d6249259a91f3d0f14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 628486,
            "upload_time": "2025-07-28T18:40:44",
            "upload_time_iso_8601": "2025-07-28T18:40:44.696810Z",
            "url": "https://files.pythonhosted.org/packages/5b/6f/08fad117c1d9f00719351c8d93124c9c6b5d0454e387a688f60969b33804/pyobjectscript_gen-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 18:40:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Antoine-dh",
    "github_project": "pyobjectscript_gen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "jinja2",
            "specs": [
                [
                    ">=",
                    "3.0"
                ]
            ]
        }
    ],
    "lcname": "pyobjectscript-gen"
}
        
Elapsed time: 1.03566s