Additional File in resource.json

I am working on a project that uses some ignition functionality, and a bunch of normal python functionality.

In doing this we need to write readmes and add some __init__.py files for test automation. However whenever we do this inside the script-python file structure, Ignition removes the additional files in the file structure.

We tried adding them into the resource.json files like this

{
  "scope": "A",
  "version": 1,
  "restricted": false,
  "overridable": true,
  "files": [
    "code.py",
    "__init__.py",
    "readme.md"
  ],
  "attributes": {
    "lastModification": {
      "actor": "external",
      "timestamp": "2021-12-14T17:36:00Z"
    },
    "lastModificationSignature": "5b6ab83c0aff225351847f7a2bcd0d7954047035dd425afc76f7459774704a5b"
  }
}

But it would still remove them and override the updated resource.json

Is there any property we can tweak on the gateway to change this? It would be really nice to be able to store additional files in parallel to scripts and views, so that we can build our documentation into our project. As well as import our scripts for automated testing, which requires the __init__.py.

Appreciate any help!

Weird, I just tried this on a different gateway with no issue… Not sure why it worked this time.

It does show these warning in the logs though

ProjectResourceId{resourcePath=ignition/script-python/MyFolder/MyScriptModule, projectName=MyProjectName} has empty data for key=__init__.py
ProjectResourceId{resourcePath=ignition/script-python/MyFolder/MyScriptModule, projectName=MyProjectName} has empty data for key=readme.md

Now I am confused!

It would be nice though if someone at ia (maybe @PGriffith ?) knows if this is the “proper” way to do that?

Those warnings imply the readme.md and __init__.py files were empty (zero length) when read.

This might work, until it doesn’t. Some of the internal methods we use to update resources will unceremoniously dump ‘additional’ data keys - so even if it works for one resource type (updated by one particular code path) in one version, any of those things being different could change that.

Yeah, I didn’t really want to get into that yet, but hitchhiking additional files that a resource doesn’t know about is kind of undefined behavior.

Would it be possible with a feature request to add in a way to support that? Even something as simple as adding an additional key into the attributes object that shows additional files for Ignition to ignore would be simple enough on our end.

Allowing developers to document inside their code with readmes, or add init.py for automated testing imports makes projects much easier to understand, test, and develop.

If this doesn’t sound like a crazy ask, I don’t mind creating an ideas post