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.1.0.tar.gz (22.2 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.1.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lua_annotations-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 d88be8c73442808074bd5a6579be8f53a5ee82b741fcf30f9003320a4ffa7d7a
MD5 4e1f6ac1a5efc0fd5571bd3abb256a70
BLAKE2b-256 c5aef0b07e6e881101a6915b993fa622080f579acaf00e2ae1fc91c66ab4dc85

See more details on using hashes here.

Provenance

The following attestation bundles were made for lua_annotations-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lua_annotations-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48d038aba28e3b7d5985ad108e607c15c573ad0230fd642be42d8f3c9ce98ab3
MD5 c6a9392c2e665f328b5e3aa572a34fe1
BLAKE2b-256 e738641040635a3e4c2302c215259902ea4277c91347eb298e1d544dabeb693b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lua_annotations-0.1.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