### Clone and Run Blueprint Factory Locally Source: https://github.com/icezingza/blueprint-factory/blob/main/README.md This snippet shows how to clone the Blueprint Factory repository, set up a virtual environment, install dependencies, and run the application locally using Streamlit. It guides users through the initial setup for local development or testing. ```bash git clone https://github.com/icezingza/blueprint-factory.git cd blueprint-factory python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate pip install -r requirements.txt streamlit run app.py ``` -------------------------------- ### Install Development Dependencies and Run Checks Source: https://github.com/icezingza/blueprint-factory/blob/main/README.md This snippet outlines the commands for setting up the development environment, including installing both regular and development dependencies. It also shows how to run code quality checks using `black` for formatting and `flake8` for linting, and `pytest` for running tests. ```bash pip install -r requirements.txt -r requirements-dev.txt black --check . flake8 . pytest ``` -------------------------------- ### Local Development Setup and Run (Bash) Source: https://context7.com/icezingza/blueprint-factory/llms.txt This section provides instructions for setting up the Blueprint Factory project locally. It covers cloning the repository, creating and activating a virtual environment, installing dependencies using pip, and running the Streamlit application. ```bash # Clone and setup git clone https://github.com/icezingza/blueprint-factory.git cd blueprint-factory # Create virtual environment python -m venv venv source venv/bin/activate # macOS/Linux # venv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt # Run the application streamlit run app.py # Opens at http://localhost:8501 ``` -------------------------------- ### Run Blueprint Factory with Docker Compose Source: https://github.com/icezingza/blueprint-factory/blob/main/README.md Instructions for running the Blueprint Factory application locally using Docker Compose. This method simplifies the setup by managing dependencies and the application environment through containerization. ```bash docker-compose up ``` -------------------------------- ### Docker Deployment Options (Bash) Source: https://context7.com/icezingza/blueprint-factory/llms.txt Instructions for deploying the Blueprint Factory application using Docker. It includes commands for using Docker Compose, running a pre-built image from GHCR, and building/running the image locally with volume mounting for output persistence. ```bash # Using Docker Compose (recommended) docker-compose up # Opens at http://localhost:8501 # Using pre-built image from GHCR docker run -p 8501:8501 ghcr.io/icezingza/blueprint-factory:latest # Build and run locally docker build -t blueprint-factory . docker run -p 8501:8501 -v ./output:/app/output blueprint-factory ``` -------------------------------- ### Generate Tiered Product Packages (Python) Source: https://context7.com/icezingza/blueprint-factory/llms.txt The `create_packs` function generates three product tiers: Starter, Agency, and Whitelabel. Each tier includes specific files like READMEs, source code, Docker configurations, and licensing, based on the input content. It returns a dictionary mapping tier names to their respective output directory paths. ```python from src.packager import create_packs # Content dictionary from extract_contents content = { "text": "Tutorial content...", "codes": ["```python\nprint('hello')\n```", "```python\nimport os\n```"] } # Generate all three package tiers packs = create_packs(content) # Returns dictionary with paths to each package: # { # "starter": "output/20240115_1430/starter-pack", # "agency": "output/20240115_1430/agency-pack", # "whitelabel": "output/20240115_1430/whitelabel-pack" # } # Package structure for each tier: # starter-pack/ # ├── README.md # └── src/ # └── main.py # # agency-pack/ # ├── README.md # ├── docker-compose.yml # ├── slides.pptx # └── src/ # └── main.py # # whitelabel-pack/ # ├── README.md # ├── docker-compose.yml # ├── slides.pptx # ├── LICENSE # └── src/ # └── main.py ``` -------------------------------- ### Test Blueprint Package Generation with Python Source: https://context7.com/icezingza/blueprint-factory/llms.txt This Python unittest suite verifies the functionality of the `generate_blueprint_package` function. It uses mock objects to simulate uploaded files and checks if the output is a valid zip archive. Dependencies include `unittest` and `zipfile`. ```python import unittest from unittest.mock import MagicMock, patch import zipfile from app import generate_blueprint_package class MockUploadedFile: def __init__(self, name, content): self.name = name self.content = content def getbuffer(self): return self.content class TestBlueprintFactory(unittest.TestCase): def test_generate_blueprint_creates_valid_zip(self): input_files = [ MockUploadedFile("doc1.pdf", b"PDF_CONTENT"), MockUploadedFile("text.txt", b"TXT_CONTENT") ] zip_buffer = generate_blueprint_package(input_files) # Verify output is a valid ZIP file self.assertTrue(zipfile.is_zipfile(zip_buffer)) # Run tests # pytest tests/ # python -m unittest tests/test_app.py ``` -------------------------------- ### Run Blueprint Factory Container from GHCR Source: https://github.com/icezingza/blueprint-factory/blob/main/README.md This command demonstrates how to pull and run the Blueprint Factory Docker image directly from the GitHub Container Registry (GHCR). It maps the application's port to the host machine, allowing access via `http://localhost:8501`. ```bash docker run -p 8501:8501 ghcr.io/icezingza/blueprint-factory:latest ``` -------------------------------- ### Complete Package Generation Pipeline (Python) Source: https://context7.com/icezingza/blueprint-factory/llms.txt The `generate_blueprint_package` function orchestrates the entire digital product packaging workflow. It handles file uploads, content extraction, package creation, and bundles all generated assets into a downloadable ZIP file. This function is the main entry point for the application's core functionality. ```python import io from app import generate_blueprint_package # Mock uploaded files (Streamlit UploadedFile objects) class MockFile: def __init__(self, name, content): self.name = name self._content = content def getbuffer(self): return self._content uploaded_files = [ MockFile("guide.pdf", open("guide.pdf", "rb").read()), MockFile("notes.txt", b"Additional notes content...") ] # Generate complete ZIP package zip_buffer = generate_blueprint_package(uploaded_files) # Save ZIP to disk with open("blueprint-output.zip", "wb") as f: f.write(zip_buffer.getvalue()) # ZIP contains: # starter/README.md # starter/src/main.py # agency/README.md # agency/src/main.py # agency/docker-compose.yml # agency/slides.pptx # whitelabel/README.md # whitelabel/src/main.py # whitelabel/docker-compose.yml # whitelabel/slides.pptx # whitelabel/LICENSE ``` -------------------------------- ### Docker Compose Configuration (YAML) Source: https://context7.com/icezingza/blueprint-factory/llms.txt This YAML configuration file defines the services for deploying the Blueprint Factory application using Docker Compose. It specifies the build context, port mapping, and volume mounting for the application's output directory. ```yaml version: "3.9" services: blueprint-factory: build: . ports: - "8501:8501" volumes: - ./output:/app/output ``` -------------------------------- ### Extract Text and Code from Documents (Python) Source: https://context7.com/icezingza/blueprint-factory/llms.txt The `extract_contents` function processes PDF, DOCX, and TXT files to extract plain text and code snippets enclosed in markdown code fences. It utilizes PyMuPDF for PDFs and python-docx for Word documents. The function returns a dictionary containing the full extracted text and a list of identified code blocks. ```python import pathlib from src.extractor import extract_contents # Prepare input directory with documents input_dir = pathlib.Path("./documents") # Extract content from all supported files data = extract_contents(input_dir) # Returns: # { # "text": "Full extracted text from all documents...", # "codes": ["```python", "```javascript"] # Code fence markers found # } print(f"Extracted {len(data['text'])} characters") print(f"Found {len(data['codes'])} code blocks") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.