Skip to main content

lua-annotations build-time processor/validator

Project description

lua-annotations-python

A lua annotation processor written in python; it's targeted toward Roblox development and is to be used as a modular game framework or simply a build-time processor.

Documentation

Key concepts

Processor

  • Expandable with an API
  • Allows for functionality during build-time, runtime, or for both.

Game framework

  • Services (@service) define individual game logic
  • Controllers (@controller) define per-instance behavior and are automatically mapped to instances containing CollectionService tags
  • Dependency injection for services and controllers with automatic load ordering
  • Seamless networking bridge; simply import "remote services" (wrappers of RemoteEvents/Functions)

CLI usage

To setup your project, run lua-anot init path/to/project. This creates a default config file. Don't forget to change the default environment paths if your project setup differs!

This is mostly a CLI tool; to build a project, run this command: lua-anot build path/to/project. This command assumes the project directory contains a annotations.config.json file. You may specify a custom filename using the --config or -c argument.

The program also has a watch command, which detects changes and automatically rebuilds; used via lua-anot watch.

Multiple workspaces

A workspace represents one individual place synced with rojo. Multi-place games would require using multiple. It is also possible to have multiple paths per ennvironment, if you want to.

Defining custom annotations

The program contains an easy API to do so!

#Runs after annotation parsing
class MyExtension(Extension):
    def on_build_test_anot(ctx: AnnotationBuildCtx):
        print(f'Hello World, {ctx.annotation.name}!')

    #Runs after all files have been processed
    def on_post_process(ctx: PostProcessCtx):
        print('Build finished!')

    def load(ctx: ExtensionRegistry):
        ctx.register_anot(AnnotationDef('moduleTest', scope='module', on_build=self.on_build_test_anot)


def load(ctx: ExtensionRegistry):
    ctx.register_extension(MyExtension())

add it to your project's config file: annotations.config.json

extensions = [
    ["path", "my_extension/main.py"]
]

Note: see the documentation for more info.

Since the project uses this API internally for optional extensions, you may also see the sourcecode under /src/extensions/ for reference!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lua_annotations-0.2.0.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lua_annotations-0.2.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file lua_annotations-0.2.0.tar.gz.

File metadata

  • Download URL: lua_annotations-0.2.0.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lua_annotations-0.2.0.tar.gz
Algorithm Hash digest
SHA256 df888c48ab0bdbbc3fe18b7247496e53334cee9a2e570c5c2649b70305bc3819
MD5 0a5ea8d5277b6caacf550a0f1fe0b1da
BLAKE2b-256 44cdadda6913716df86a06afabb16733af83ca3b9266e927a216f68f754cdbf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for lua_annotations-0.2.0.tar.gz:

Publisher: python-publish.yml on pigxity-games/lua-annotations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lua_annotations-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lua_annotations-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f89b7d05bf87d953efd21224768995b6bdfe723cd8c7f1d95f7dc7dcd96bb820
MD5 2c0e2e5384f38858998f058224cf93a6
BLAKE2b-256 5e0d0bd8c160ccb31d1cf3df02378390eeefaaa59e43e2616e899ab169978051

See more details on using hashes here.

Provenance

The following attestation bundles were made for lua_annotations-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on pigxity-games/lua-annotations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page