lightspeed.trex.packaging.core#

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

pydantic model lightspeed.trex.packaging.core.ModPackagingSchema#

Bases: BaseModel

Show JSON schema
{
   "title": "ModPackagingSchema",
   "type": "object",
   "properties": {
      "context_name": {
         "description": "The context name to use for the packaging stage. Should be a unique context name.",
         "title": "Context Name",
         "type": "string"
      },
      "mod_layer_paths": {
         "description": "The mod layer paths should be ordered by opinion strength where the strongest layer is first. All mod layers found in a given project should be in found in the list, including external mod dependencies",
         "items": {
            "format": "path",
            "type": "string"
         },
         "title": "Mod Layer Paths",
         "type": "array"
      },
      "selected_layer_paths": {
         "description": "A list of layers to package. Must at least contain the strongest mod layer found in `mod_layer_paths` or the packaging process will quick return.",
         "items": {
            "format": "path",
            "type": "string"
         },
         "title": "Selected Layer Paths",
         "type": "array"
      },
      "output_directory": {
         "description": "The directory where the packaged mod should be stored.\n\nWARNING: The directory will be emptied prior to packaging the mod.",
         "format": "path",
         "title": "Output Directory",
         "type": "string"
      },
      "redirect_external_dependencies": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": true,
         "description": "Whether the reference dependencies taken from external mods should be redirected or copied in this mod's package during the packaging process.\n\n- Redirecting will allow the mod to use the installed mod's dependencies so updating a dependency will be as simple as to install the updated dependency.\n- Copying will make sure the mod is completely standalone so no other mods need to be installed for this mod to be loaded successfully.",
         "title": "Redirect External Dependencies"
      },
      "mod_name": {
         "description": "The display name used for the mod in the RTX Remix Runtime.",
         "title": "Mod Name",
         "type": "string"
      },
      "mod_version": {
         "description": "The mod version. Used when building dependency lists.",
         "title": "Mod Version",
         "type": "string"
      },
      "mod_details": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional text used to describe the mod in more details.",
         "title": "Mod Details"
      },
      "ignored_errors": {
         "anyOf": [
            {
               "items": {
                  "maxItems": 3,
                  "minItems": 3,
                  "prefixItems": [
                     {
                        "type": "string"
                     },
                     {
                        "type": "string"
                     },
                     {
                        "type": "string"
                     }
                  ],
                  "type": "array"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "A list of errors to ignore when packaging the mod.",
         "title": "Ignored Errors"
      }
   },
   "required": [
      "context_name",
      "mod_layer_paths",
      "selected_layer_paths",
      "output_directory",
      "mod_name",
      "mod_version"
   ]
}

Fields:
  • context_name (str)

  • ignored_errors (List[Tuple[str, str, str]] | None)

  • mod_details (str | None)

  • mod_layer_paths (List[pathlib.Path])

  • mod_name (str)

  • mod_version (str)

  • output_directory (pathlib.Path)

  • redirect_external_dependencies (bool | None)

  • selected_layer_paths (List[pathlib.Path])

Validators:
  • at_least_one » mod_layer_paths

  • is_mod_file_valid » mod_layer_paths

  • is_not_empty » mod_name

  • is_not_empty » output_directory

  • is_valid_version » mod_version

  • layer_exists » selected_layer_paths

field context_name: str [Required]#

The context name to use for the packaging stage. Should be a unique context name.

field ignored_errors: List[Tuple[str, str, str]] | None = None#

A list of errors to ignore when packaging the mod.

field mod_details: str | None = None#

Optional text used to describe the mod in more details.

field mod_layer_paths: List[Path] [Required]#

The mod layer paths should be ordered by opinion strength where the strongest layer is first. All mod layers found in a given project should be in found in the list, including external mod dependencies

Validated by:
  • at_least_one

  • is_mod_file_valid

field mod_name: str [Required]#

The display name used for the mod in the RTX Remix Runtime.

Validated by:
  • is_not_empty

field mod_version: str [Required]#

The mod version. Used when building dependency lists.

Validated by:
  • is_valid_version

field output_directory: Path [Required]#

The directory where the packaged mod should be stored.

WARNING: The directory will be emptied prior to packaging the mod.

Validated by:
  • is_not_empty

field redirect_external_dependencies: bool | None = True#

Whether the reference dependencies taken from external mods should be redirected or copied in this mod’s package during the packaging process.

  • Redirecting will allow the mod to use the installed mod’s dependencies so updating a dependency will be as simple as to install the updated dependency.

  • Copying will make sure the mod is completely standalone so no other mods need to be installed for this mod to be loaded successfully.

field selected_layer_paths: List[Path] [Required]#

A list of layers to package. Must at least contain the strongest mod layer found in mod_layer_paths or the packaging process will quick return.

Validated by:
  • layer_exists

validator at_least_one  »  mod_layer_paths#

Check that at least 1 mod file was selected

validator is_mod_file_valid  »  mod_layer_paths#

Check that the file is a valid mod file

validator is_not_empty  »  output_directory, mod_name#

Check that the mod name is not empty

validator is_valid_version  »  mod_version#

Check that the mod version has a valid format

validator layer_exists  »  selected_layer_paths#

Check that every selected layer file exists

class lightspeed.trex.packaging.core.PackagingCore#

Bases: object

cancel()#

Cancel the packaging process.

property current_count: int#

Get the current packaged items count

destroy()#
package(schema: Dict)#

Execute the project packaging process using the given schema.

Parameters:

schema – the schema to use for the project packaging. Please see the documentation.

Examples

>>> core = PackagingCore()
>>> core.package(
>>>    {
>>>         "context_name": "Packaging",
>>>         "mod_layer_paths": [Path("R:\Remix\projects\MyProject\mod.usda")],
>>>         "selected_layer_paths": [
>>>             Path("R:\Remix\projects\MyProject\mod.usda"),
>>>             Path("R:\Remix\projects\MyProject\sublayer.usda"),
>>>         ],
>>>         "output_directory": Path("R:\Remix\rtx-remix\captures\capture_1.usda"),
>>>         "mod_name": "Packaged Mod Name",
>>>         "mod_version": "1.0.0",
>>>         "mod_details": "Optional Mod Details",
>>>    }
>>>)
async package_async(schema: Dict)#

Asynchronous implementation of package

async package_async_with_exceptions(schema: Dict)#

Asynchronous implementation of package, but async without error handling. This is meant for testing.

property status: str#

Get the current packaging status

subscribe_packaging_completed(
function: Callable[[List[str], List[Tuple[str, str, str]], bool], Any],
)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_packaging_progress(function)#

Return the object that will automatically unsubscribe when destroyed.

property total_count: int#

Get the current total items count