Skip to content

sonolus.script.project

BuildConfig dataclass

A configuration for building an engine package.

FAST_PASSES = optimize.FAST_PASSES class-attribute

The list of compiler passes for faster builds.

MINIMAL_PASSES = optimize.MINIMAL_PASSES class-attribute

The minimal list of compiler passes.

STANDARD_PASSES = optimize.STANDARD_PASSES class-attribute

The standard list of compiler passes.

build_play = True class-attribute instance-attribute

Whether to build the play package.

build_preview = True class-attribute instance-attribute

Whether to build the preview package.

build_tutorial = True class-attribute instance-attribute

Whether to build the tutorial package.

build_watch = True class-attribute instance-attribute

Whether to build the watch package.

passes = optimize.STANDARD_PASSES class-attribute instance-attribute

The list of compiler passes to use.

Project

A Sonolus.py project.

Parameters:

Name Type Description Default
engine Engine

The engine of the project.

required
levels list[Level] | None

The levels of the project.

None
resources PathLike | None

The path to the resources of the project.

None

build(build_dir, config=None)

Build the project.

Parameters:

Name Type Description Default
build_dir PathLike

The path to the build directory.

required
config BuildConfig | None

The build configuration.

None

dev(build_dir, port=8080, config=None)

Start a development server for the project.

Parameters:

Name Type Description Default
build_dir PathLike

The path to the build directory.

required
port int

The port of the development server.

8080
config BuildConfig | None

The build configuration.

None

schema()

Generate the schema of the project.

Returns:

Type Description
ProjectSchema

The schema of the project.

with_levels(levels)

Create a new project with the specified levels.

Parameters:

Name Type Description Default
levels list[Level]

The levels of the project.

required

Returns:

Type Description
Self

The new project.