View Python Scripts on GitHub

I published a project on GitHub that primarily consists of python scripting. After looking through the source code on GitHub, I was not able to find any python code in the project. How do I publish a project in such a way that GitHub will identify the entirety of the code?

Have you looked at the best practices whitepaper:
Ignition 8 Deployment Best Practices

The Scripting -> Project Library scripts end up in /data/projects//ignition/script-python//code.py

If you have set your repo at the projects level or the projects/ level then that folder (and code) should be included.

Scripts that are part of a view are embedded in the view.json

{
        "events": {
          "dom": {
            "onClick": {
              "config": {
                "script": "\tpass"
              },
              "scope": "G",
              "type": "script"
            }
          }
        },
        "meta": {
          "name": "Button"
        },
        "position": {
          "basis": "80px"
        },
        "scripts": {
          "customMethods": [
            {
              "name": "newMethod",
              "params": [],
              "script": "\t# implement your method here\n\tpass"
            }
          ],
          "extensionFunctions": null,
          "messageHandlers": [
            {
              "messageType": "type-name-here",
              "pageScope": true,
              "script": "\t# implement your handler here\n\tpass",
              "sessionScope": false,
              "viewScope": false
            }
          ]
        },
        "type": "ia.input.button"
      }

Session scripts end up in data.bin. Despite the name it is human readable (and diffable) JSON.

Also, check out the Git Extension described here: Module Git - Easy integration of git for your development
It is really good.

1 Like

thank you for the response. I was able to see all the data on github. The issue I am actually having (didn't realize it) is that all the data does not load into the project designer when I try to git clone to a folder and then open it through designer launcher. the project can be opened, but the contents are non existent.

I tried to export at .zip and then import into designer launcher. I also tried to use git Bash with the git clone command. every time I open the project in designer launcher, none of the contents appear

Where on your disk are you putting your local repo (i.e., cloning to)?
How are you opening the project in the designer launcher?

C:\Users\Controlsadmin\Documents\IgnitionTempProjects
This is where I cloned the repo I copied from github

Config -> Projects -> Import project... -> choose File
It only accepts '.zip', '.proj', or '.xml'
so I choose .zip

To confirm... is the source Python repo you're attempting to import an Ignition project, or just a random Python project?

1 Like

IIRC, the best practices whitepaper / video recommends that your repo be in-place - put it at C:\Program Files\Inductive Automation\Ignition\data\projects

If you put it there then you don't need to import/export or reload or anything. It just works.

There is a bit of a race condition there if the designer is open, which was demonstrated in the video.

There also seems to be a mapping constraint - one gateway per one designer machine. Swapping from gateway to gateway would be a bit odd to me... so I put my repos in the subfolder - one repo per Ignition project. That does cause some duplication of gateway scoped resources but when you choose your solution you also are choosing your problems.

I haven't tried cloning a repo to a clean machine and starting to work on it the way that I would have in other technologies. The designer seems happy if the project is created on disk first and then linked / cloned and the demos follow that path. My guess is that it would be fine.
.

1 Like

Source Python repo. Its the entire Ignition project that I loaded on github

so what I am trying to do is simulate an actor(user) that pulls the source code off of github and then imports it into their designer launcher. after doing this, none of the data comes with the project

I think that you are going to need to invent a few manual steps to make that happen.

The tools are built so that the repo is the in-situ project, not an export of the project.

Maybe you could follow the whitepaper to do a test project, noting what happens on github, on disk, and in the designer at each step. Test exporting and importing a project to see what the artifacts look like.

There's no Python resources in that Github repo. They should be in ignition/script-python/; they weren't exported/part of the export, apparently, so there's nothing showing up when you import.

forgot to mention I do not have any project library scripts. they are all scoped to view and component level

The code is embedded inside the view.json file.

Looks like the data is separated into sections: project, images, tags, and gateway config. These all have to follow a process in order to automatically be pushed into the version control, based on the manual that was provided: