Ignition repo now with branches

In the past, I’ve shared with this community the Ignition repo I maintain over at GitHub, and in the past couple of weeks, I’ve been experimenting with branches.

So now I have main, 7.9, and jython.

main

Includes all system.* scripting functions included in version 8.0.16, as well as java/javax stubs in cases where Java cannot be installed. Project interpreter: Python 2.7.18.

7.9

Includes all system.* scripting functions included in version 7.9.16, as well as java/javax stubs in cases where Java cannot be installed. Project interpreter: Python 2.7.18.

jython

Includes all system.* scripting functions included in version 8.0.16. Project interpreter: Jython 2.7.1.

And in no way I am a Java expert, so please excuse any/all blunders.

How do I clone a branch in particular?

# main
git clone --single-branch --branch main https://github.com/thecesrom/Ignition.git

# jython
git clone --single-branch --branch jython https://github.com/thecesrom/Ignition.git

# 7.9
git clone --single-branch --branch 7.9 https://github.com/thecesrom/Ignition.git

Just want the code?

You may download the source code for any version here: https://github.com/thecesrom/Ignition/releases

I intend to keep it up to date, as long as work permits.

2 Likes

Geeze this is quite thorough.

I could definitely see it being useful to add the ability to write unittests for your project scripts, as in 8+ they are just stored as .py files in the project folder.

Really if there was a way to write unit tests directly within Ignition and utilize the builtin libraries that way it would be fantastic, but unfortunately I understand its not necessarily easy due to the way the unittest module has to be called.

Either way good work!

1 Like

As much as I like the idea of the Designer as an IDE, I don’t think it is technically possible.

One of the main reasons I started using PyCharm, and the motivation behind creating the stubs for all Scripting Functions, was because I was able to get code completion on my libraries, not just on system.*. And while I have not created unit tests I do believe PyCharm or Visual Studio Code (and many others) offer better integration with the ‘unittest’ framework.

If at some point I do include unit testing on my projects, I’ll share it with the community.

4 Likes

Where do you put the library in relation to your ignition/data/project/my-project/ignition/script-python directory? I am looking to do a bit more of my development in VSCode for other reasons, but I am not exactly sure how to get it to see system as a valid library with the built in file structure.

i.e.

.
+-- script-1
|   +-- code.py
|   +-- resource.json
+-- script-2
|   +-- code.py
|   +-- resource.json
+-- package-1
|   +-- script-1
|   |    +-- code.py
|   |    +--resource.json
|   +-- script-2
|   |    +-- code.py
|   |    +--resource.json

I really wanted vscode to work for my projects, but as I mentioned here Ignition mock scripts on GitHub, after trying a couple of IDEs, PyCharm CE is the one that worked best for me.

So, I just have to add Ignition as a dependency for my project[s], and it all works.

To add Ignition as a dependency to your project in PyCharm, just do the following:

  1. Open your project
  2. File > Open, and select Ignition
    image
  3. When prompted, choose Attach
  4. And just like that, you’ve added Ignition as a dependency

Ohhhh now I understand, it’s the lack of ability to add library dependencies, and so you would need to add Imports to all of your code

I feel like combining your repository with a VS extension would be a pretty easy way to add an “Ignition” extension that automatically includes the libraries

Not sure I know enough of the tools to create something like that, but it would for sure be useful!

So, today I embarked into creating a setup.py file for the Ignition library, pip-installed it on a virtual environment hoping it will work for Visual Studio code, but unfortunately it didn’t. Although it did work on PyCharm.

If there are packaging/vscode experts out there, please let me know if I’m missing something.

setup.py:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import io
import os

from setuptools import find_packages, setup

NAME = "ignition-api"
DESCRIPTION = "Ignition Scripting API"
URL = "https://github.com/thecesrom/Ignition"
EMAIL = "cesar@thecesrom.dev"
AUTHOR = "César Román"
REQUIRES_PYTHON = "==2.7.18"
VERSION = "8.1.9"

here = os.path.abspath(os.path.dirname(__file__))

try:
    with io.open(os.path.join(here, "README.md"), encoding="utf-8") as readme:
        long_description = "\n" + readme.read()
except IOError:
    long_description = DESCRIPTION

setup(
    name=NAME,
    version=VERSION,
    description=DESCRIPTION,
    long_description=long_description,
    long_description_content_type="text/markdown",
    author=AUTHOR,
    author_email=EMAIL,
    python_requires=REQUIRES_PYTHON,
    url=URL,
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    license="MIT",
    classifiers=[
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2 :: Only",
        "Programming Language :: Python :: 2.7",
    ],
)

1 Like