Installation & Setup¶
Follow these steps to get the Lean Automator project running.
The shared library initialization (Steps 6-11) only needs to be done once. The lean_processor will automatically add new .lean files to the library's source directory (e.g., vantage_lib/VantageLib/) and trigger builds within the shared library directory later.
-
Clone the repository:
-
Create and activate a virtual environment (recommended):
-
Install Python dependencies:
-
Install Project in Editable Mode: This links the Python package to your local source code, ensuring edits are immediately reflected without reinstallation. Run this command from the project root directory (
vantage/): -
Set up Environment Variables (
.envfile):- Copy the
.env.examplefile (located in the project root) to a new file named.envin the same directory. - This
.envfile will hold your local configuration secrets and overrides, and should not be committed to version control. - Edit the
.envfile:- You must add your actual
GEMINI_API_KEY. - You will set the correct absolute path for
LEAN_AUTOMATOR_SHARED_LIB_PATHin Step 12 after creating the shared library directory. Leave the placeholder for now or set it if you already know the final path.
- You must add your actual
- For detailed explanations of all required and optional environment variables, and how the configuration system works, please refer to the Configuration documentation.
- Copy the
-
Install Lean 4 (Lake included) Follow the official installation instruction. After installing Lean 4 in your editor (VS Code default), you'll see a '∀' in your editor. Click '∀' and follow the instructions step by step. If you did everything correctly, the binaries of
lake,leanandelanare under the directory~/.elan/bin. Add them toPATHif necessary. -
Create Shared Library Directory: This directory will hold the Lake project for your persistent Lean library. Create it and navigate into it from your project root (e.g.,
vantage/). -
Initialize Shared Library with Lake: Initialize a default Lake project within the new directory. On older Lake versions using
lakefile.toml, this often configures both a library (e.g.,VantageLib) and an executable (Main.lean), deriving names from the directory. -
Configure Shared Library (
lakefile.toml): Manually edit the generatedlakefile.tomlto configure the project as library-only.- Open
lakefile.toml. - Find the library definition section (e.g.,
[[lean_lib]]). Ensure thenameattribute matches your desired module name (e.g.,name = "VantageLib"). Keep this section. This name must match theLEAN_AUTOMATOR_SHARED_LIB_MODULE_NAMEenvironment variable if you choose to set it (see Configuration docs). - Find the executable definition section (e.g.,
[[lean_exe]]). Delete this entire section (usually 3 lines). - (Optional but Recommended) Find the
defaultTargets = [...]line near the top and delete it to avoid potential build issues. - Save the changes to
lakefile.toml.
- Open
-
Clean Up Shared Library Files: Delete the unnecessary files generated by the default
lake initassociated with the executable or placeholders. Run these commands while still inside the shared library directory (e.g.,vantage_lib/).# Remove executable entry point and potential library root file: rm -f Main.lean VantageLib.lean # Remove default placeholder inside the library source directory: # (Replace VantageLib if you configured a different library name in Step 9) rm -f VantageLib/Basic.lean # Optional: remove default readme: rm -f README.md -
Optional: Build Check Shared Library: Verify the Lake configuration by running a build command. This ensures the
Note: If this fails withlakefile.tomland directory structure are valid. Run this while still inside the shared library directory (e.g.,vantage_lib/).error: package 'vantage_lib' has no target 'vantage_lib', double-check that you deleted thedefaultTargets = [...]line from yourlakefile.tomlin Step 9. A successful command indicates the setup is correct so far. -
Finalize Setup: Navigate back to the project root directory and ensure your environment variables are correctly set.
- CRITICAL: Now, update your
.envfile (from Step 5):- Set
LEAN_AUTOMATOR_SHARED_LIB_PATHto the absolute path of the shared library directory you created (e.g., the output ofpwdwhen you were insidevantage_lib). - Confirm
LEAN_AUTOMATOR_SHARED_LIB_MODULE_NAMEin your.envfile (if you set it) matches the library name you configured in Step 9 (e.g.,VantageLib). Refer to the Configuration documentation if needed.
- Set
- CRITICAL: Now, update your