Python DSL reference
project.generate_code() -> GeneratedProjectArchiveGenerate and download project code
Send the complete topology to the authorized generation endpoint and receive a validated ZIP archive.
When to use
Call this after constructing and validating the Project when target-language source and deployment assets are required.
Behavior
- Serializes the Project to YAML, converts it to the designer-compatible API JSON model, and submits
/v1/generation-jobs. - Authenticates with
SERVICE_ARCHITECT_API_KEY, polls the owned job until completion, and requests a short-lived download URL. - Downloads the artifact directly from S3 without forwarding the API key, derives a safe filename, and verifies the ZIP container.
- Returns archive bytes without extracting or executing generated files.
Project.generate_code parameters properties
All parameters are keyword-only.
PropertyTypeDescription
api_keyoptional secretOverride SERVICE_ARCHITECT_API_KEY for the asynchronous API.
id_token / username / passwordlegacy credentialsUse the legacy synchronous generation path when no API key is available.
env_filepathCredentials file; default .env.
base_urloptional URLOverride Service Architect API root.
timeoutsecondsNetwork timeout; default 120.
GeneratedProjectArchive properties
Validated successful response.
PropertyTypeDescription
filenamestringSafe basename from Content-Disposition or download.zip.
contentbytesZIP archive bytes.
save(path)PathCreate parent directories and write the archive.
Python example
from pathlib import Path
from processorder import project
diagnostics = project.validate()
if diagnostics:
raise RuntimeError(diagnostics)
archive = project.generate_code()
output = archive.save(Path("dist") / archive.filename)
print(output)