user: Show practical ways to work with Extension Creation in a Blender add-on or script – include code.

assistant: ### Subcommand: `build`

usage:

```
blender --command extension build [-h] [--source-dir SOURCE_DIR]
                                  [--output-dir OUTPUT_DIR]
                                  [--output-filepath OUTPUT_FILEPATH]
                                  [--valid-tags VALID_TAGS_JSON]
                                  [--split-platforms] [--verbose]
```

Build a package in the current directory.

options:
:   `-h, --help`
    :   show this help message and exit

    `--source-dir SOURCE_DIR`
    :   The package source directory containing a `blender_manifest.toml` manifest.

        Default’s to the current directory.

    `--output-dir OUTPUT_DIR`
    :   The package output directory.

        Default’s to the current directory.

    `--output-filepath OUTPUT_FILEPATH`
    :   The package output filepath (should include a `.zip` extension).

        Defaults to `{id}-{version}.zip` using values from the manifest.

    `--valid-tags VALID_TAGS_JSON`
    :   Reference a file path containing valid tags lists.

        If you wish to reference custom tags a `.json` file can be used.
        The contents must be a dictionary of lists where the `key` matches the extension type.

        For example:
        :   `{"add-ons": ["Example", "Another"], "theme": ["Other", "Tags"]}`

        To disable validating tags, pass in an empty path `--valid-tags=""`.

    `--split-platforms`
    :   Build a separate package for each platform.
        Adding the platform as a file name suffix (before the extension).

        This can be useful to reduce the upload size of packages that bundle large
        platform-specific modules (`*.whl` files).

    `--verbose`
    :   Include verbose output.

### Subcommand: `validate`

usage:

```
blender --command extension validate [-h]
                                     [--valid-tags VALID_TAGS_JSON]
                                     [SOURCE_PATH]
```

Validate the package meta-data in the current directory.

positional arguments:
:   SOURCE_PATH:
    :   The package source path (either directory containing package files or the package archive).
        This path must containing a `blender_manifest.toml` manifest.

        Defaults to the current directory.

options:
:   `-h, --help`
    :   show this help message and exit

    `--valid-tags VALID_TAGS_JSON`
    :   Reference a file path containing valid tags lists.

        If you wish to reference custom tags a `.json` file can be used.
        The contents must be a dictionary of lists where the `key` matches the extension type.

        For example:
        :   `{"add-ons": ["Example", "Another"], "theme": ["Other", "Tags"]}`

        To disable validating tags, pass in an empty path `--valid-tags=""`.

### Subcommand: `server-generate`

usage:

```
blender --command extension server-generate [-h] --repo-dir REPO_DIR
                                            [--repo-config REPO_CONFIG]
                                            [--html]
                                            [--html-template HTML_TEMPLATE_FILE]
```

Generate a listing of all packages stored in a directory.
This can be used to host packages which only requires static-file hosting.

options:
:   `-h, --help`
    :   show this help message and exit

    `--repo-dir REPO_DIR`
    :   The remote repository directory.

    `--repo-config REPO_CONFIG`
    :   An optional server configuration to include information which can’t be detected.
        Defaults to `blender_repo.toml` (in the repository directory).

        This can be used to defined blocked extensions, for example

        ```
        schema_version = "1.0.0"

        [[blocklist]]
        id = "my_example_package"
        reason = "Explanation for why this extension was blocked"
        [[blocklist]]
        id = "other_extenison"
        reason = "Another reason for why this is blocked"
        ```

    `--html`
    :   Create a HTML file (`index.html`) as well as the repository JSON
        to support browsing extensions online with static-hosting.

    `--html-template HTML_TEMPLATE_FILE`
    :   An optional HTML file path to override the default HTML template with your own.

        The following keys will be replaced with generated contents:

        - `${body}` is replaced the extensions contents.
        - `${date}` is replaced the creation date.