### Getting Started with Maizzle Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/README.md Commands to clone the Maizzle starter project, install dependencies, start local development, and build emails for production. ```bash npx degit maizzle/maizzle my-project cd my-project npm install npm run dev npm run build ``` -------------------------------- ### Run Example Application (Windows) Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Navigates to the examples directory, sets up a virtual environment, installs dependencies, and runs the example application. ```sh cd examples/ # Create a venv for the example app python -m venv .venv .venv/Script/activate pip install -r requirements ./run.ps1 ``` -------------------------------- ### Install Plombery Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/get-started.md This command installs the Plombery library and its dependencies using pip, the Python package installer. Ensure your virtual environment is activated before running this command. ```bash pip install plombery ``` -------------------------------- ### Run Example Application (Linux/macOS) Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Navigates to the examples directory, sets up a virtual environment, installs dependencies, and runs the example application. ```sh cd examples/ # Create a venv for the example app python -m venv .venv source .venv/bin/activate pip install -r requirements ./run.sh ``` -------------------------------- ### Create Virtual Environment Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/get-started.md This command creates a new virtual environment named '.venv' in the current project directory. It isolates project dependencies. ```bash # Run this in your project folder python -m venv .venv ``` -------------------------------- ### Install and Run Uvicorn Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md Instructions on how to install the uvicorn package and run the Plombery application using the Python script. ```sh pip install uvicorn python src/app.py ``` -------------------------------- ### Plombery Configuration Example Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/configuration.md Example of a `plombery.config.yaml` file demonstrating frontend URL, authentication settings (client ID, secret, metadata URL), and notification rules with channels. ```yaml frontend_url: https://pipelines.example.com auth: client_id: $GOOGLE_CLIENT_ID client_secret: $GOOGLE_CLIENT_SECRET server_metadata_url: https://accounts.google.com/.well-known/openid-configuration notifications: - pipeline_status: - failed channels: - $GMAIL_ACCOUNT - $MSTEAMS_WEBHOOK ``` -------------------------------- ### Full src/app.py Example Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md The complete content of the `src/app.py` file, combining task definition, pipeline registration, and application startup code. ```python from datetime import datetime from random import randint from apscheduler.triggers.interval import IntervalTrigger from plombery import task, get_logger, Trigger, register_pipeline @task async def fetch_raw_sales_data(): """Fetch latest 50 sales of the day""" # using Plombery logger your logs will be stored # and accessible on the web UI logger = get_logger() logger.debug("Fetching sales data...") sales = [ { "price": randint(1, 1000), "store_id": randint(1, 10), "date": datetime.today(), "sku": randint(1, 50), } for _ in range(50) ] logger.info("Fetched %s sales data rows", len(sales)) # Return the results of your task to have it stored # and accessible on the web UI return sales register_pipeline( id="sales_pipeline", description="Aggregate sales activity from all stores across the country", tasks=[fetch_raw_sales_data], triggers=[ Trigger( id="daily", name="Daily", description="Run the pipeline every day", schedule=IntervalTrigger(days=1), ), ], ) if __name__ == "__main__": import uvicorn uvicorn.run("plombery:get_app", reload=True, factory=True) ``` -------------------------------- ### Activate Virtual Environment (Mac/Linux) Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/get-started.md This command activates the virtual environment created in the previous step on macOS and Linux systems. Once activated, your terminal session will use the Python interpreter and packages installed within this environment. ```sh # on Mac/Linux source .venv/bin/activate ``` -------------------------------- ### Minimalist Plombery Pipeline Example Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Demonstrates the basic structure of a Plombery pipeline, showcasing how tasks and scheduling are defined in pure Python. This serves as a starting point for users to create their own scheduled tasks. ```python from plombery import Pipeline @Pipeline.register def my_pipeline(): return [ "echo 'Hello from Plombery!'", "sleep 5", "echo 'Pipeline finished.'" ] ``` -------------------------------- ### Python Virtual Environment Setup Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Commands to create and activate a Python virtual environment for development. ```sh python -m venv .venv # on Mac/Linux source .venv/bin/activate # on Win .venv/Script/activate ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Installs project dependencies using pip. ```sh pip install -r requirements.txt pip install -r requirements-dev.txt ``` -------------------------------- ### Run Frontend Development Server Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Starts the Vite development server for the React frontend. ```sh yarn dev ``` -------------------------------- ### Install Frontend Dependencies (Yarn) Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Installs frontend dependencies using Yarn. Assumes Yarn is installed. ```sh cd frontend/ # The project uses yarn as dependency manager, if you don't have # it, you must install it. # This command will install the deps: yarn ``` -------------------------------- ### Plombery Configuration Example Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/templates/transactional.html This snippet shows an example of a plombery.config.yml file, which is used to configure notification settings for the Plombery task scheduler. ```yaml # Example plombery.config.yml\n# Configure notification settings here\nnotifications:\n pipeline_updates: true ``` -------------------------------- ### Activate Virtual Environment (Windows) Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/get-started.md This command activates the virtual environment on Windows systems. It modifies your terminal's environment variables to point to the Python interpreter and packages within the '.venv' directory. ```sh # on Win .venv/Script/activate ``` -------------------------------- ### Register a Plombery Pipeline Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md Shows how to register a pipeline with a unique ID, description, a list of tasks, and triggers. This example includes a daily trigger using IntervalTrigger. ```python register_pipeline( id="sales_pipeline", description="Aggregate sales activity from all stores across the country", tasks = [fetch_raw_sales_data], triggers = [ Trigger( id="daily", name="Daily", description="Run the pipeline every day", schedule=IntervalTrigger(days=1), ), ], ) ``` -------------------------------- ### Environment Variables Example Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/configuration.md Example `.env` file for storing Plombery secrets, including Google client ID and secret, and notification channel details like Gmail account and MS Teams webhook. ```shell # Auth GOOGLE_CLIENT_ID="ABC123" GOOGLE_CLIENT_SECRET="DEF456" # Notifications GMAIL_ACCOUNT=mailto://myuser:mypass@gmail.com MSTEAMS_WEBHOOK=msteams://TokenA/TokenB/TokenC/ ``` -------------------------------- ### Authentication Client Keyword Arguments Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/configuration.md Example of configuring `client_kwargs` within the `auth` section of `plombery.config.yaml` to pass additional parameters like `scope` to the OAuth client. ```yaml auth: client_kwargs: scope: openid email profile ``` -------------------------------- ### Additional SSL Certificate Checks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/recipes/certificates-expiration.md Demonstrates how to add more tasks to the Plombery pipeline for performing additional checks on the SSL certificate, such as verifying the issuer or subject. ```python from plombery import Pipeline from plombery.tasks import http from datetime import datetime, timedelta def is_valid_date(date_str): try: datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%fZ') return True except ValueError: return False def get_days_until_expiration(date_str): if not is_valid_date(date_str): return None expiration_date = datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%fZ') return (expiration_date - datetime.utcnow()).days pipeline = Pipeline([ http.get( "Get certificate info", url="https://{hostname}/", params={"headers": {"Accept": "*/*"}}, extract_json_path="$.ssl_certificate.valid_to", extract_json_path_args={"hostname": "{{hostname}}"}, ), get_days_until_expiration, lambda valid_to: http.get( "Check certificate issuer", url="https://{hostname}/", params={"headers": {"Accept": "*/*"}}, extract_json_path="$.ssl_certificate.issuer", extract_json_path_args={"hostname": "{{hostname}}"}, ), lambda issuer: "Let's Encrypt" in issuer, ]) ``` -------------------------------- ### SSL Certificate Check Pipeline Configuration Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/recipes/certificates-expiration.md Defines the Plombery pipeline for checking SSL certificate expiration dates. It includes tasks for fetching certificate information and checking expiration. ```python from plombery import Pipeline from plombery.tasks import http from datetime import datetime, timedelta def is_valid_date(date_str): try: datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%fZ') return True except ValueError: return False def get_days_until_expiration(date_str): if not is_valid_date(date_str): return None expiration_date = datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%fZ') return (expiration_date - datetime.utcnow()).days pipeline = Pipeline([ http.get( "Get certificate info", url="https://{hostname}/", params={"headers": {"Accept": "*/*"}}, extract_json_path="$.ssl_certificate.valid_to", extract_json_path_args={"hostname": "{{hostname}}"}, ), get_days_until_expiration, ]) ``` -------------------------------- ### Valid Trigger Parameter Configuration Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/triggers.md Illustrates a valid way to configure trigger parameters when the input parameter is optional. This example shows omitting an optional parameter, demonstrating flexibility in trigger parameter definition. ```python Trigger( # ... params={ "past_days": 3, } ) ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Builds and serves the MkDocs documentation website locally. ```sh mkdocs serve ``` -------------------------------- ### Project Structure Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md Defines the recommended folder structure for a Plombery project, including the virtual environment and the source directory with an entrypoint file. ```sh . ├─ .venv/ # virtual environment folder ├─ src/ ├─ __init__.py # empty file needed to declare Python modules ├─ app.py # entrypoint to the project ``` -------------------------------- ### Run the Plombery Application Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md Provides the necessary code to run the Plombery application using uvicorn, typically placed in the `if __name__ == "__main__"` block. ```python if __name__ == "__main__": import uvicorn uvicorn.run("plombery:get_app", reload=True, factory=True) ``` -------------------------------- ### Git Workflow for Contributions Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Standard Git commands for contributing to an open-source project. ```sh git checkout -b feature/AmazingFeature git commit -m 'Add some AmazingFeature' git push origin feature/AmazingFeature ``` -------------------------------- ### Define a Plombery Task Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/create-a-pipeline.md Demonstrates how to define a task in Plombery using the `@task` decorator. The task fetches simulated sales data and uses the Plombery logger. ```python from datetime import datetime from random import randint from apscheduler.triggers.interval import IntervalTrigger from plombery import task, get_logger, Trigger, register_pipeline @task async def fetch_raw_sales_data(): """Fetch latest 50 sales of the day""" # using Plombery logger your logs will be stored # and accessible on the web UI logger = get_logger() logger.debug("Fetching sales data...") sales = [ { "price": randint(1, 1000), "store_id": randint(1, 10), "date": datetime.today(), "sku": randint(1, 50), } for _ in range(50) ] logger.info("Fetched %s sales data rows", len(sales)) # Return the results of your task to have it stored # and accessible on the web UI # If you have other tasks, the output of a task is # passed to the following one return sales ``` -------------------------------- ### Run Tests with Coverage Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Runs tests and generates a coverage report. ```sh coverage run -m pytest coverage report -m ``` -------------------------------- ### Run All Tests Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md Executes the entire test suite using pytest. ```sh pytest ``` -------------------------------- ### Registering a Plombery Pipeline Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/pipelines.md Demonstrates how to register a pipeline with tasks, input parameters, and triggers. It includes defining a Pydantic model for input parameters and setting up a daily trigger. ```python from plombery import register_pipeline, task from pydantic import BaseModel from plombery.triggers import Trigger, IntervalTrigger class InputParams(BaseModel): some_value: int @task def get_sales_data(): pass register_pipeline( # (required) the id identifies the pipeline univocally id="sales_pipeline_2345", # (required) the list of tasks to execute tasks=[get_sales_data], # This pipeline is configurable via input parameters params=InputParams, # The name is optional, if absent it would be generated from the ID name="Sales pipeline", description="""This is a very useless pipeline""", # Triggers with schedules triggers=[ Trigger( id="daily", name="Daily", description="Run the pipeline every day", # the input params value for this specific trigger params=InputParams(some_value=2), schedule=IntervalTrigger( days=1, ), ) ], ) ``` -------------------------------- ### Plombery REST API Documentation Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/index.md This section details the REST API endpoints available for interacting with Plombery. It covers authentication, pipeline management, task execution, and monitoring. ```APIDOC Plombery REST API: Authentication: - OAuth2 secured. - Specific endpoints for token acquisition and validation. Pipelines: - GET /pipelines: List all available pipelines. - POST /pipelines: Create a new pipeline. - Request Body: - name (str): Name of the pipeline. - description (str, optional): Description of the pipeline. - schedule (dict, optional): Scheduling configuration (e.g., {'type': 'interval', 'seconds': 3600}). - tasks (list): List of tasks within the pipeline. - GET /pipelines/{pipeline_id}: Get details of a specific pipeline. - PUT /pipelines/{pipeline_id}: Update an existing pipeline. - DELETE /pipelines/{pipeline_id}: Delete a pipeline. Tasks: - POST /pipelines/{pipeline_id}/run: Manually trigger a pipeline run. - Request Body (optional): - parameters (dict): Parameters to pass to the pipeline run. - GET /runs/{run_id}: Get details of a specific pipeline run. - GET /runs/{run_id}/logs: Get logs for a specific pipeline run. - GET /runs/{run_id}/output: Get output data for a specific pipeline run. Monitoring: - GET /status: Get the overall status of the scheduler. - GET /alerts: List configured alerts. Error Handling: - Standard HTTP status codes for errors (e.g., 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error). - Error responses typically include a JSON body with an 'error' message. ``` -------------------------------- ### Handling Input Parameters in Tasks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Illustrates how to define input parameters for a pipeline using Pydantic models and how these parameters are passed to task functions. The task function receives an instance of the input parameter model via the `params` argument. ```python from plombery import task, register_pipeline from pydantic import BaseModel class InputParams(BaseModel): some_value: int register_pipeline( # ... params=InputParams ) @task async def my_task(params: InputParams): result = params.some_value + 8 ``` -------------------------------- ### PyPI and CodeClimate Badges Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md This snippet displays badges for PyPI (Python Package Index) version and CodeClimate status. The PyPI badge indicates the current published version of the 'plombery' package, while the CodeClimate badge reflects the project's code quality metrics. ```Markdown [pypi-shield]: https://img.shields.io/pypi/v/plombery.svg?style=for-the-badge [pypi-url]: https://pypi.python.org/pypi/plombery [CodeClimate-shield]: https://codeclimate.com/github/lucafaggianelli/plombery.png?style=for-the-badge [CodeClimate-url]: https://codeclimate.com/github/lucafaggianelli/plombery ``` -------------------------------- ### Defining Synchronous and Asynchronous Tasks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Demonstrates how to define both synchronous and asynchronous tasks using the `@task` decorator provided by Plombery. These tasks form the building blocks of a pipeline. ```python from plombery import task @task def sync_task(): pass @task async def async_task(): pass ``` -------------------------------- ### Component Configuration Object Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/button.html This JavaScript object defines alignment classes and default properties for a component. It uses props to dynamically set alignment, href, and margin padding properties. ```javascript module.exports = { align: { left: 'text-left', center: 'text-center', right: 'text-right' }[props.align], href: props.href, msoPt: props['mso-pt'] || '16px', msoPr: props['mso-pr'] || '32px', msoPb: props['mso-pb'] || '30px', msoPl: props['mso-pl'] || '32px' }; ``` -------------------------------- ### Defining Pipeline Input Parameters Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/pipelines.md Shows how to define input parameters for a pipeline using a Pydantic BaseModel. This allows for customization when running the pipeline manually or via HTTP triggers. ```python from pydantic import BaseModel class InputParams(BaseModel): some_value: int ``` -------------------------------- ### Link Component Rendering Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/button.html A simple JSX snippet demonstrating how to render a link using the 'href' prop. This is often used in conjunction with other component properties. ```javascript []({{ href }}) ``` -------------------------------- ### Registering Tasks in a Pipeline Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Shows how to register defined tasks with the `register_pipeline` function. This step is crucial for Plombery to recognize and execute the tasks as part of a pipeline. ```python from plombery import task, register_pipeline @task def sync_task(): pass @task async def async_task(): pass register_pipeline( tasks=[sync_task, async_task] ) ``` -------------------------------- ### Notification Rule Configuration Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/configuration.md Defines notification rules in `plombery.config.yaml`. Shows how to specify pipeline statuses (e.g., 'failed', 'completed', 'cancelled') and the channels to send notifications to, using Apprise URI formats. ```yaml notifications: # Send notifications only if the pipelines failed - pipeline_status: - failed channels: # Send them to my gmail address (from my address itself) # Better to use an env var here - mailto://myuser:mypass@gmail.com # Send notifications only if the pipelines succeeded or was cancelled - pipeline_status: - completed - cancelled channels: # Send them to a MS Teams channel # Better to use an env var here - msteams://mychanneltoken ``` -------------------------------- ### GitHub Repository Badges Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md This snippet displays various badges related to the GitHub repository, such as contributors, forks, stars, issues, and license. These badges provide a quick visual summary of the project's health and community engagement. ```Markdown [contributors-shield]: https://img.shields.io/github/contributors/lucafaggianelli/plombery.svg?style=for-the-badge [contributors-url]: https://github.com/lucafaggianelli/plombery/graphs/contributors [forks-shield]: https://img.shields.io/github/forks/lucafaggianelli/plombery.svg?style=for-the-badge [forks-url]: https://github.com/lucafaggianelli/plombery/network/members [stars-shield]: https://img.shields.io/github/stars/lucafaggianelli/plombery.svg?style=for-the-badge [stars-url]: https://github.com/lucafaggianelli/plombery/stargazers [issues-shield]: https://img.shields.io/github/issues/lucafaggianelli/plombery.svg?style=for-the-badge [issues-url]: https://github.com/lucafaggianelli/plombery/issues [license-shield]: https://img.shields.io/github/license/lucafaggianelli/plombery.svg?style=for-the-badge [license-url]: https://github.com/lucafaggianelli/plombery/blob/master/LICENSE ``` -------------------------------- ### Technology Stack Badges Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md This snippet showcases badges for the technologies used in the Plombery project, including React.js, Python, and TypeScript. These badges indicate the primary programming languages and frameworks employed in the project's development. ```Markdown [React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB [React-url]: https://reactjs.org/ [Python]: https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=yellow [Python-url]: https://www.python.org/ [TypeScript]: https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white [TypeScript-url]: https://www.typescriptlang.org/ ``` -------------------------------- ### Passing Task Output to Subsequent Tasks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Explains how the return value of a task is treated as its output data and automatically passed as positional arguments to the next task in the pipeline. This enables data flow between tasks. ```python from plombery import task @task def task_1(): return 1 @task def task_2(from_1): # from_1 = 1 return from_1 + 1 @task def task_3(from_1, from_2): # from_1 = 1 # from_2 = 2 return from_1 + from_2 ``` -------------------------------- ### Plombery Pipeline Trigger API Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/triggers.md Details the API for triggering Plombery pipelines. This includes information on the default pipeline trigger, HTTP triggers, and manual run buttons. ```APIDOC Pipeline Trigger: - Default trigger created when a pipeline is registered without explicit triggers. - Provides a button in the web UI and an HTTP endpoint for manual execution. HTTP Trigger: - Allows pipeline execution via an HTTP POST request. - The trigger URL is available on the pipeline's page in the web UI. - Parameters can be passed as a JSON body in the HTTP request. Manual Trigger: - A "manual run" button in the web UI (home and pipeline pages). - Based on the HTTP trigger functionality. - If the pipeline has input parameters, a dialog prompts for customization. Trigger with Parameters: - Input parameters are configured via a form in the manual run dialog. - The form is automatically generated from Pydantic's BaseModel declared in the pipeline. - For HTTP triggers, parameters are sent as a JSON body in the POST request. ``` -------------------------------- ### Registering a Plombery Pipeline with a Trigger Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/triggers.md Demonstrates how to register a Plombery pipeline with input parameters and a trigger that specifies custom parameter values. The trigger is configured with a schedule and specific values for the pipeline's input parameters. ```python from pydantic import BaseModel class InputParams(BaseModel): past_days: int convert_currency: bool = False def get_sales_data(params: InputParams): print(params.past_days) register_pipeline( id="sales_pipeline", tasks=[get_sales_data], params=InputParams, triggers=[ Trigger( id="daily", description="Get last 5 days of sales data in USD dollars", schedule=IntervalTrigger( days=1, ), params={ "past_days": 5, "convert_currency": True, }, ), ], ) ``` -------------------------------- ### Register Pipeline with Daily Schedule Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/triggers.md Demonstrates how to register a pipeline with a daily schedule using APScheduler's IntervalTrigger. This allows the pipeline to run automatically once every day. ```python from apscheduler.triggers.interval import IntervalTrigger from plombery import register_pipeline, Trigger register_pipeline( id="sales_pipeline", tasks=[get_sales_data], triggers=[ Trigger( id="daily", description="Run the pipeline every day", schedule=IntervalTrigger( days=1, ), ), ], ) ``` -------------------------------- ### Default Configuration Object Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/v-image.html This JavaScript snippet defines a module export for a configuration object. It sets default values for width, height, and image properties, which can be overridden by props. This is commonly used for component initialization or data structuring. ```javascript module.exports = { width: props.width || '600px', height: props.height || '400px', image: props.image || 'https://via.placeholder.com/600x400' } ``` -------------------------------- ### Star History Chart Source: https://github.com/lucafaggianelli/plombery/blob/main/README.md This HTML snippet embeds a dynamic star history chart for the Plombery GitHub repository. It uses SVG images from the star-history.com API and supports dark and light themes based on user preference. ```HTML Star History Chart ``` -------------------------------- ### Spacer Component Configuration Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/spacer.html Configuration for a spacer component, likely used in an email templating framework like Maizzle. It defines the height and Microsoft Office-specific height properties. ```javascript module.exports = { height: props.height, msoHeight: props['mso-height'], } ``` -------------------------------- ### Default Module Exports Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/v-fill.html This snippet defines the default module exports for the Plombery project. It sets default values for 'width' and 'image' properties if they are not provided. ```javascript module.exports = { width: props.width || '600px', image: props.image || 'https://via.placeholder.com/600x400' } ``` -------------------------------- ### Divider Component Configuration Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/components/divider.html Configuration object for a divider component, allowing customization of height, color, margins, and spacing. It uses properties passed via props for dynamic styling. ```javascript module.exports = { height: props.height || '1px', color: props.color, // any CSS color value top: props.top, // top margin bottom: props.bottom, // bottom margin left: props.left, // left margin right: props.right, // right margin spaceY: props['space-y'] || '24px', // top and bottom margin spaceX: props['space-x'] // right and left margin } ``` -------------------------------- ### Using Plombery's Integrated Logger within Tasks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Demonstrates how to access and use Plombery's logger within task functions to capture logs that will be displayed on the UI. The `get_logger` function is specifically designed for use inside tasks. ```python from plombery import task, get_logger @task def my_task(): logger = get_logger() logger.debug("Hey greetings!") ``` -------------------------------- ### Toggle Dark Mode with localStorage and System Preference Source: https://github.com/lucafaggianelli/plombery/blob/main/frontend/index.html This JavaScript code checks the user's theme preference stored in localStorage and their system's color scheme preference. It applies a 'dark' class to the document's root element accordingly, enabling dark mode. ```javascript if ( localStorage.plomberyTheme === 'dark' || (!('plomberyTheme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.documentElement.classList.add('dark') } else { document.documentElement.classList.remove('dark') } ``` -------------------------------- ### Pipeline Email Notification Template Source: https://github.com/lucafaggianelli/plombery/blob/main/email-templates/src/templates/transactional.html This snippet represents an email template used for notifying users about pipeline status updates. It includes placeholders for pipeline name and status, and links to view run details and manage notification settings. ```html ---\n title: "Pipeline @@{{ pipeline_name }} @@{{ pipeline_status }}"\n preheader: "Your pipeline @@{{ pipeline_name }} @@{{ pipeline_status }}!"\n bodyClass: bg-slate-50\n---\n\nHello,\n======\n\nYour pipeline @{{ pipeline_name }} @{{ pipeline_status }}!\n\nSee run details →\n\n_If you don't want to receive these emails, change the notifications settings in your plombery.config.yml file._\n\n‍\n\nPowered by Plombery\n\nPython task scheduler with a user-friendly web UI\n\n[Docs](https://lucafaggianelli.github.io/plombery/?utm_source=notifications&utm_medium=email&utm_campaign=pipeline_notifications) • [Github](https://github.com/lucafaggianelli/plombery??utm_source=notifications&utm_medium=email&utm_campaign=pipeline_notifications) ``` -------------------------------- ### Plombery Schedule Triggers Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/triggers.md Lists the types of APScheduler triggers supported by Plombery for scheduling pipeline runs. These include IntervalTrigger, CronTrigger, DateTrigger, and Combining triggers. ```APIDOC Supported APScheduler Triggers for Plombery Schedules: - CronTrigger: For defining schedules based on cron expressions. - Reference: https://apscheduler.readthedocs.io/en/3.x/modules/triggers/cron.html#module-apscheduler.triggers.cron - DateTrigger: For scheduling a job to run at a specific date and time. - Reference: https://apscheduler.readthedocs.io/en/3.x/modules/triggers/date.html#module-apscheduler.triggers.date - IntervalTrigger: For scheduling jobs at regular intervals (e.g., every hour, every day). - Reference: https://apscheduler.readthedocs.io/en/3.x/modules/triggers/interval.html#module-apscheduler.triggers.interval - Combining Triggers: For creating complex schedules by combining multiple triggers. - Reference: https://apscheduler.readthedocs.io/en/3.x/modules/triggers/combining.html#module-apscheduler.triggers.combining ``` -------------------------------- ### Incorrect Usage of get_logger Outside Tasks Source: https://github.com/lucafaggianelli/plombery/blob/main/docs/tasks.md Highlights the incorrect usage of the `get_logger` function outside of a task's execution context. Calling `get_logger` outside a task will not work as intended. ```python # ❌ Don't do this from plombery import get_logger logger = get_logger() def my_task(): logger.debug("Hey greetings!") ``` -------------------------------- ### Plombery Configuration for Notifications Source: https://github.com/lucafaggianelli/plombery/blob/main/src/plombery/notifications/email_templates/transactional.html This snippet shows a configuration setting within the `plombery.config.yml` file that controls email notification preferences. Users can modify this to opt-out of receiving pipeline status emails. ```YAML _If you don't want to receive these emails, change the notifications settings in your plombery.config.yml file._ ``` -------------------------------- ### Pipeline Notification Email Structure Source: https://github.com/lucafaggianelli/plombery/blob/main/src/plombery/notifications/email_templates/transactional.html This snippet outlines the HTML and CSS used for the Plombery pipeline status notification emails. It includes styling for text, links, and responsive design for different screen sizes. ```HTML Pipeline {{ pipeline_name }} {{ pipeline_status }} img { max-width: 100%; vertical-align: middle; line-height: 1; border: 0 } .hover-important-text-decoration-underline:hover { text-decoration: underline !important } @media (max-width: 600px) { .sm-px-4 { padding-left: 16px !important; padding-right: 16px !important } .sm-px-6 { padding-left: 24px !important; padding-right: 24px !important } .sm-leading-8 { line-height: 32px !important } } Your pipeline {{ pipeline_name }} {{ pipeline_status }}! [See run details →]({{ pipeline_run_url }}) _If you don't want to receive these emails, change the notifications settings in your plombery.config.yml file._ Powered by Plombery Python task scheduler with a user-friendly web UI [Docs](https://lucafaggianelli.github.io/plombery/?utm_source=notifications&utm_medium=email&utm_campaign=pipeline_notifications) • [Github](https://github.com/lucafaggianelli/plombery??utm_source=notifications&utm_medium=email&utm_campaign=pipeline_notifications) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.