Skip to content

sonolus.script.project

BuildConfig dataclass

A configuration for building an engine package.

FAST_PASSES: Sequence[CompilerPass] = optimize.FAST_PASSES class-attribute

The list of compiler passes for faster builds.

MINIMAL_PASSES: Sequence[CompilerPass] = optimize.MINIMAL_PASSES class-attribute

The minimal list of compiler passes.

STANDARD_PASSES: Sequence[CompilerPass] = optimize.STANDARD_PASSES class-attribute

The standard list of compiler passes.

build_play: bool = True class-attribute instance-attribute

Whether to build the play package.

build_preview: bool = True class-attribute instance-attribute

Whether to build the preview package.

build_tutorial: bool = True class-attribute instance-attribute

Whether to build the tutorial package.

build_watch: bool = True class-attribute instance-attribute

Whether to build the watch package.

override_resource_level_engines: bool = True class-attribute instance-attribute

Whether to override any levels included in resources to use the engine of this project.

passes: Sequence[CompilerPass] = 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 Iterable[Level] | Callable[[], Iterable[Level]] | None

The levels of the project.

None
resources PathLike | None

The path to the resources of the project.

None

build(build_dir: PathLike, config: BuildConfig | None = 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: PathLike, port: int = 8080, config: BuildConfig | None = 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() -> ProjectSchema

Generate the schema of the project.

Returns:

Type Description
ProjectSchema

The schema of the project.

with_levels(levels: Iterable[Level] | Callable[[], Iterable[Level]] | None) -> Project

Create a new project with the specified levels.

Parameters:

Name Type Description Default
levels Iterable[Level] | Callable[[], Iterable[Level]] | None

The levels of the project.

required

Returns:

Type Description
Project

The new project.