Sari la conținut

Usage Guide

Overview

The Agnostic Project Seeder creates project structures from YAML configurations. It generates directories and files based on external config files, making it easy to bootstrap new projects.

Prerequisites

  • Python 3.6+
  • PyYAML (pip install pyyaml)
  • makeself (for building installers)

Quick Start

1. Create a Project Configuration

Create a directory under projects/ with a config.yaml:

# Example config.yaml
docs:
  README.md: "# My Project\n\nGenerated automatically."
  architecture.md: "# Architecture\n\nDetails here."

src:
  main.py: |
    #!/usr/bin/env python3
    print("Hello, World!")

tests:
  test_main.py: |
    import main
    # Tests here

2. Build the Onelineinstaller

make PROJECT=example

This creates example-seeder.run - a self-extracting script.

3. Use the Onelineinstaller

./example-seeder.run /absolute/path/to/new/project

Running the Seeder Directly

If you have the seeder setup locally:

python core/seeder.py /path/to/project /path/to/config.yaml

YAML Configuration Reference

Directories

mydir: null        # Empty directory
nested:
  subdir: null     # Nested directory

Files

file.txt: "Simple content"

multiline.md: |
  # Title
  Content here
  More content

External File References

You can reference external files instead of inline content:

# Copy a single file
external_file.txt:
  file: "path/to/external/file.txt"

# Copy entire directory recursively
copied_assets:
  dir: "path/to/external/directory"

# Copy files matching glob pattern (flat copy to target directory)
selected_scripts:
  glob: "path/to/extras/**/*.py"

Note: Paths are relative to the config file's directory.

Nested Structures

project:
  src:
    main.py: "print('hello')"
  tests:
    test.py: "assert True"

Makefile Targets

  • make PROJECT=name: Build installer for specific project (requires make and makeself)
  • make clean: Remove generated files
  • make install-deps: Install Python dependencies
  • make docs-deploy: Deploy documentation to equilibrium.go.ro MkDocs server

Examples

Example 1: Basic Web Project

public:
  index.html: |
    <!DOCTYPE html>
    <html>
    <head><title>My App</title></head>
    <body><h1>Hello</h1></body>
    </html>

src:
  app.js: "console.log('Hello');"

Example 2: Python Package

mypackage:
  __init__.py: ""
  core.py: "# Core functionality"

tests:
  __init__.py: ""
  test_core.py: "# Tests"

setup.py: |
  from setuptools import setup
  setup(name="mypackage")

Error Handling

  • Invalid YAML: Check syntax with python -c "import yaml; yaml.safe_load(open('config.yaml'))"
  • Permission errors: Ensure write access to target directory
  • Missing dependencies: Run pip install -r requirements.txt

Best Practices

  • Use relative paths in configurations
  • Test configurations locally first
  • Keep configurations modular and reusable
  • Document your project configs in README files