Get Started
Nautil pipelines are just standard Python scripts. They use a fluent, chainable API built around the Artifact class.
An Artifact represents a temporary workspace containing files and directories that you manipulate step by step, before eventually packaging them up into an output directory or archive.
Your First Build Script
Section titled “Your First Build Script”Once nautil and nautil-utils are installed, let’s create a straightforward build script that imports a source folder, performs some basic cleanup, and packages it into a zip file.
Create a file named build.py in your project:
import os
# 1. Import the Core componentsfrom nautil.core import Artifact, Zipfrom nautil_utils.source import LocalSource
# 2. Import plugins to register their actionsimport nautil_utils.actions
def main(): # Environment variables or configuration for this build env = { "VERSION": "1.0.0", "PROJECT_NAME": "MyApp" }
# Initialize a new Artifact with the given environment context artifact = Artifact(env)
# Chain actions sequentially artifact\ .use(LocalSource("src"), dest=".")\ .remove_empty(files=True, dirs=True)\ .mkdir("logs")\ .output("dist", "$PROJECT_NAME-$VERSION", format=Zip())
if __name__ == "__main__": main()Running the Build
Section titled “Running the Build”Since this is a standard Python script, you can execute it like any other python file:
python build.pyUnder the hood:
Artifact(env)creates a temporary directory on your machine..use(...)usesLocalSourcefromnautil-utilsto copy thesrcdirectory into the temporary workspace..remove_empty(...)(provided bynautil-utils) scans the temporary workspace and deletes all empty files and folders..mkdir("logs")creates a newlogsdirectory inside the artifact..output(...)archives the contents of the temporary workspace into a zip file located atdist/MyApp-1.0.0.zipusing the environment variables defined earlier ($PROJECT_NAME-$VERSION). The temporary workspace is safely cleaned up automatically.