### Kamal Configuration File Example Source: https://kamal-deploy.org/docs/installation An example of a `config/deploy.yml` file for Kamal, specifying service name, Docker image, server addresses, registry credentials, builder architecture, and environment variables. ```yaml service: hey image: 37s/hey servers: - 192.168.0.1 - 192.168.0.2 registry: username: registry-user-name password: - KAMAL_REGISTRY_PASSWORD builder: arch: amd64 env: secret: - RAILS_MASTER_KEY ``` -------------------------------- ### Install uv using standalone installer Source: https://docs.astral.sh/uv Installs uv using a standalone script provided via `curl` for macOS and Linux, or PowerShell for Windows. This is a convenient way to get started with uv without needing to install Rust or Python beforehand. ```shell # macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```powershell PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Shell: Clone Django Project and Start Docker Containers Source: https://testdriven.io/blog/django-digitalocean-spaces This shell command sequence guides you through cloning a Django project configured for DigitalOcean Spaces and starting the necessary Docker containers. It involves cloning the repository, navigating into the project directory, and then building and running the Docker Compose services. Ensure Docker and Docker Compose are installed. ```shell $ git clone -b base https://github.com/testdrivenio/django-digitalocean-spaces $ cd django-digitalocean-spaces $ docker-compose up -d --build ``` -------------------------------- ### Add Django Project Apps Configuration Source: https://github.com/pcherna/pegasus-example-apps-v2 Activates example applications within a Django project by adding their configurations to the `PROJECT_APPS` setting in `settings.py`. Ensure these match the apps you intend to integrate. ```python "apps.crud_example1.apps.CrudExample1Config", "apps.crud_example2.apps.CrudExample2Config", "apps.crud_example3.apps.CrudExample3Config", "apps.crud_example4.apps.CrudExample4Config", ``` -------------------------------- ### Go Runtime Example Command Source: https://render.com/docs/deploys Provides an example command to start a Go application. ```text ./app ``` -------------------------------- ### Ruby Runtime Example Command Source: https://render.com/docs/deploys Provides an example command to start a Ruby application using Puma. ```text bundle exec puma ``` -------------------------------- ### Python Runtime Example Command Source: https://render.com/docs/deploys Provides an example command to start a Python application using gunicorn. ```text gunicorn your_application.wsgi ``` -------------------------------- ### Elixir Runtime Example Command Source: https://render.com/docs/deploys Provides an example command to start an Elixir application using Phoenix. ```text mix phx.server ``` -------------------------------- ### Kamal Secrets File Example Source: https://kamal-deploy.org/docs/installation An example of a `.kamal/secrets` file used to manage sensitive environment variables for Kamal deployments, such as registry passwords and application secrets. ```bash KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY=$(cat config/master.key) ``` -------------------------------- ### Node.js Runtime Example Commands Source: https://render.com/docs/deploys Provides example commands to start a Node.js application using Yarn, npm, or direct execution. ```text yarn start ``` ```text npm start ``` ```text node index.js ``` -------------------------------- ### Install and Run Pre-commit Hooks Source: https://docs.saaspegasus.com/llms-small.txt Commands to install and manually run pre-commit hooks for code formatting. Pre-commit automates code checks before each commit, ensuring consistent formatting across the project. ```bash # install pre-commit hooks $ pre-commit install --install-hooks # run all hooks against currently staged files pre-commit run # run all the hooks against all the files. This is a useful invocation if you are using pre-commit in CI. pre-commit run --all-files ``` -------------------------------- ### Install individual npm packages (Shell) Source: https://docs.saaspegasus.com/llms-small.txt This command-line snippet demonstrates how to use an optional argument with `make npm-install` to install specific npm packages. It's part of a build process improvement that allows for more granular control over package management. ```bash make npm-install --package ``` -------------------------------- ### golang hook setup and installation Source: https://pre-commit.com/ Describes how to configure and use Go (golang) hooks with pre-commit. It explains the installation process using 'go install', the isolated GOPATH, and support for 'additional_dependencies' and 'language_version'. ```text language: golang entry: additional_dependencies: [] language_version: ``` -------------------------------- ### Bootstrap e-commerce configuration (Shell) Source: https://docs.saaspegasus.com/llms-small.txt This command-line snippet shows how to simplify the e-commerce configuration setup using a new management command: `./manage.py bootstrap_ecommerce`. This command streamlines the process of setting up e-commerce functionality within the Django application. ```bash ./manage.py bootstrap_ecommerce ``` -------------------------------- ### Add Django App Configurations to Settings Source: https://github.com/pcherna/pegasus-example-apps-v2 This Python code snippet shows how to register new Django applications within the project's settings.py file. It involves adding the application configuration paths to the PROJECT_APPS list, enabling features like CRUD operations for multiple examples. ```python "apps.crud_example1.apps.CrudExample1Config", "apps.crud_example2.apps.CrudExample2Config", "apps.crud_example3.apps.CrudExample3Config", "apps.crud_example4.apps.CrudExample4Config", ``` -------------------------------- ### Chart.js Upgrade and Installation Method Source: https://docs.saaspegasus.com/llms-small.txt Updates the Chart.js library to its latest version and changes its installation method from a CDN to NPM. The example charts have been modified to reflect this change, ensuring they utilize the locally installed Chart.js. ```javascript * Upgraded Chart.js to the latest version, and moved it to be installed from NPM instead of a CDN. * Changed the example charts to use the NPM-installed Chart.js. ``` -------------------------------- ### Generate Random SECRET_KEY for New Installations Source: https://docs.saaspegasus.com/llms-small.txt This change ensures that a unique, random `SECRET_KEY` is generated for each new installation of the application. This enhances security by preventing the use of default or predictable secret keys. It's a security and setup improvement. ```python Generate random `SECRET_KEY` for each new installation ``` -------------------------------- ### Clone Project Repository Source: https://github.com/pcherna/pegasus-example-apps-v2 Clones the specified project repository into a local directory. This is the initial step for setting up the project and integrating its components. ```shell git clone git@github.com:pcherna/pegasus-example-apps-v2.git ``` -------------------------------- ### Example .env File for Anthropic API Key Source: https://docs.saaspegasus.com/llms-small.txt This is an example of an environment file (`.env`) snippet that includes a default setting for the `AI_CHAT_ANTHROPIC_API_KEY`. This is used to configure the Anthropic API key for AI chat functionalities, simplifying setup for developers. ```dotenv .env ``` -------------------------------- ### Install Django and Initialize Project Source: https://render.com/docs/deploy-django Steps to install the Django framework and create a new Django project named 'mysite'. These commands set up the basic project structure. ```bash pip install django ``` ```bash django-admin startproject mysite ``` -------------------------------- ### Install and Run Celery with Gevent Pool Source: https://docs.saaspegasus.com/llms-small.txt Installs the 'gevent' library and starts a Celery worker using the 'gevent' concurrency pool. This is useful for I/O-bound tasks and for running Celery on Windows. ```bash pip install gevent celery -A {{ project_name }} worker -l info -P gevent ``` -------------------------------- ### Install uv on Windows Source: https://docs.saaspegasus.com/llms-small.txt Installs the uv package manager on Windows systems using PowerShell. This command bypasses execution policy restrictions to download and run the installation script. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Custom Webhook Handling Example Source: https://docs.saaspegasus.com/llms-small.txt Illustrates how to implement custom logic when processing Stripe webhooks, using an example from `apps/subscriptions/webhooks.py` that emails admins on subscription cancellation. ```python # Example logic in apps/subscriptions/webhooks.py: # def subscription_canceled_handler(event): # # Send email to admins or perform other custom actions # pass ``` -------------------------------- ### Format Salary in Object Demo Examples Source: https://docs.saaspegasus.com/llms-small.txt Applies number formatting to the 'Salary' field in object demo examples. This improves the readability of currency or numerical data presented in the examples. It's a front-end display enhancement. ```javascript Added number formatting of Salary to object demo examples ``` -------------------------------- ### Start Commands for Node.js, Python, Ruby, Go, Rust, Elixir Source: https://render.com/docs/deploys Examples of start commands used by Render to launch services after a successful build. These commands are specific to each runtime environment. ```shell yarn start npm start node index.js ``` ```shell gunicorn your_application.wsgi ``` ```shell bundle exec puma ``` ```shell ./app ``` ```shell cargo run --release ``` ```shell mix phx.server ``` -------------------------------- ### Apply Database Migrations using Make Source: https://github.com/pcherna/pegasus-example-apps-v2 These commands are used to create and apply database migrations when using Docker. They leverage the 'make' utility for streamlined execution. ```bash make migrations make migrate ``` -------------------------------- ### Install uv on Linux/Mac Source: https://docs.saaspegasus.com/llms-small.txt Installs the uv package manager on Linux and macOS systems using a curl script. This is a prerequisite for using uv to manage Python environments. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Sync project dependencies with uv Source: https://docs.saaspegasus.com/llms-small.txt Synchronizes project dependencies using uv. This command installs the correct Python version if necessary, creates a virtual environment, and installs all project dependencies. ```bash uv sync ``` -------------------------------- ### Initialize Project with shadcn/ui CLI Source: https://ui.shadcn.com/docs/cli The `init` command sets up your project for shadcn/ui, installing dependencies, adding the `cn` utility, and configuring CSS variables. It supports various options for customization, such as template selection, base color, and directory usage. ```bash pnpm dlx shadcn@latest init ``` -------------------------------- ### Organize React Object Lifecycle Example Source: https://docs.saaspegasus.com/llms-small.txt The React object lifecycle example has been moved into a dedicated `react` subfolder for better organization. Additionally, the example is being refactored into multiple files and utilizes React Hooks. This improves code structure and maintainability. ```javascript Moved React object lifecycle example to a `react` subfolder ``` ```javascript Started splitting up React object lifecycle demo into multiple files, and refactoring it to use hooks ``` -------------------------------- ### Displaying Black Help Information Source: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html Shows the command to display all available command-line options for Black. This is useful for understanding the various configuration settings and flags that can be used to control Black's behavior. ```bash black --help ``` -------------------------------- ### Install Node.js 18.x on Debian-based systems Source: https://docs.saaspegasus.com/llms-small.txt This snippet installs Node.js version 18.x on Debian-based Linux distributions. It adds the NodeSource repository, imports the GPG key, and then installs the 'nodejs' package. Ensure you have root privileges to run these commands. ```bash curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg RUN echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list RUN apt-get update && apt-get install nodejs -yqq ``` -------------------------------- ### Starting Django Channels Development Server Source: https://channels.readthedocs.io/en/latest/tutorial/part_2.html Starts the Django development server with Channels support. This command is used to run the ASGI application locally for testing and development. ```shell python3 manage.py runserver ``` -------------------------------- ### Initialize Pegasus Project with Docker Source: https://docs.saaspegasus.com/docker This command initializes the Pegasus project with Docker enabled, spinning up necessary services like the database, web worker, celery worker, and Redis broker. It also handles database migrations. Ensure Docker is installed and the project is set up according to the getting started guide. ```bash make init ``` -------------------------------- ### Configure Setuptools for Dynamic Dependencies (TOML) Source: https://github.com/jazzband/pip-tools This TOML configuration snippet demonstrates how to set up Setuptools as the build backend. It dynamically defines project dependencies and optional dependencies by referencing external requirement files. ```toml [build-system] requires = ["setuptools", "setuptools-scm"] build-backend = "setuptools.build_meta" [project] requires-python = ">=3.9" name = "foobar" dynamic = ["dependencies", "optional-dependencies"] [tool.setuptools.dynamic] dependencies = { file = ["requirements.in"] } optional-dependencies.test = { file = ["requirements-test.txt"] } ``` -------------------------------- ### Rust Runtime Example Command Source: https://render.com/docs/deploys Provides an example command to build and run a Rust application in release mode. ```text cargo run --release ``` -------------------------------- ### Install and Run Front End Source: https://context7_llms Commands to navigate to the frontend directory, install npm packages, create the environment file, and start the development server. Requires the Django backend to be running. ```bash cd frontend npm install cp .env.example .env npm run dev ``` -------------------------------- ### Upgrade Installer Script (Bash) Source: https://docs.saaspegasus.com/llms-small.txt Provides the command to upgrade the Pegasus installer to version 0.0.2 or later. This is a necessary step for existing Pegasus users to apply version 0.9.0 updates. This is a command-line operation. ```bash pip install --upgrade pegasus-installer>=0.0.2 ``` -------------------------------- ### Project Setup: Dependencies, Data, and Events Source: https://cloud.digitalocean.com/apps Initializes core project components including dependency store, data bridge, and event bus. It provides a consolidated object for accessing these services. ```typescript const X = atob("aHR0cHM6Ly9sb2NhbGRldi5pbnRlcm5hbC5kaWdpdGFsb2NlYW4uY29t"), Z = new class { constructor(e) { this.dependencyStore = new S(e), this.dataBridge = new M, this.eventBus = new A, this.debugger = new N(this.dependencyStore, this.dataBridge, this.eventBu } } ``` -------------------------------- ### Update Dockerfile.dev for Node 22 Installation (Bash) Source: https://docs.saaspegasus.com/llms-small.txt This patch updates the Dockerfile.dev to install Node.js version 22. It ensures proper cache management and adds the NodeSource repository for version 22. This is a hotfix for issues installing Node 22 in the development Docker container. ```bash RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \ --mount=target=/var/cache/apt,type=cache,sharing=locked \ rm -f /etc/apt/apt.conf.d/docker-clean && \ echo "deb https://deb.nodesource.com/node_22.x bookworm main" > /etc/apt/sources.list.d/nodesource.list && \ wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get update && \ apt-get install -yqq nodejs \ ``` -------------------------------- ### Run Uvicorn with Config and Server Instances Source: https://www.uvicorn.org/ This method provides more granular control over Uvicorn's configuration and server lifecycle. It involves creating a `uvicorn.Config` object with application details and then initializing a `uvicorn.Server` instance with this configuration. The server is then started using `server.run()`. ```python import uvicorn async def app(scope, receive, send): ... if __name__ == "__main__": config = uvicorn.Config("main:app", port=5000, log_level="info") server = uvicorn.Server(config) server.run() ``` -------------------------------- ### Install Package Requirements (Bash) Source: https://docs.saaspegasus.com/llms-small.txt Commands to install project dependencies using either 'uv' or 'pip tools'. It's recommended to have Python development headers and PostgreSQL client libraries installed for 'psycopg2' compatibility. This step ensures all necessary libraries are available for the project. ```bash # with uv uv sync ``` ```bash # or if using pip tools pip install -r dev-requirements.txt ``` ```bash brew reinstall openssl export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ ``` -------------------------------- ### Update Node.js Installation in Dockerfile Source: https://docs.saaspegasus.com/llms-small.txt Replaces the existing Node.js installation steps in Docker development and web Dockerfiles. This update aligns with recent changes in NodeSource distributions, ensuring compatibility with newer Node.js versions. ```plaintext # install node/npm RUN curl -fsSL https://deb.nodesource.com/gpgke ``` -------------------------------- ### Project Setup and Virtual Environment (Shell) Source: https://render.com/docs/deploy-django This shell script outlines the initial steps for setting up a new project. It includes creating a project directory, navigating into it, creating a Python virtual environment using `venv`, and activating that environment. Dependencies include Python 3 and its `venv` module. ```shell # Create a new project directory and cd into it mkdir mysite cd mysite # Create a virtual environment using Python's venv package python -m venv venv # Activate the virtual environment to start installing other packages source venv/bin/activate ``` -------------------------------- ### Example .env for OpenAI API Key (Plaintext) Source: https://docs.saaspegasus.com/llms-small.txt This is an example of how to set the OpenAI API key in your .env file. This key is then used by the application to authenticate with OpenAI services for AI chat and image generation features. ```plaintext OPENAI_API_KEY="sk-***" ``` -------------------------------- ### Troubleshooting Setup and Deployment with Kamal Source: https://docs.saaspegasus.com/deployment/kamal Commands to help troubleshoot setup and deployment failures. This includes rebooting individual accessories (PostgreSQL, Redis, proxy), booting the proxy if it failed, and deploying the application. `kamal app logs` is used to inspect application logs for errors. ```bash # rebuild the PostgreSQL container kamal accessory reboot postgres ``` ```bash # rebuild the Redis container kamal accessory reboot redis ``` ```bash # rebuild the proxy container kamal proxy reboot ``` ```bash # build the proxy container (if it didn't succeed the first time) kamal proxy boot ``` ```bash # deploy the app kamal deploy ``` ```bash kamal app logs ``` -------------------------------- ### Setup reqs-sync Development Environment Source: https://github.com/saaspegasus/reqs-sync Steps to set up a local development environment for reqs-sync. This involves navigating to the project directory, creating a virtual environment, and synchronizing dependencies. ```shell cd reqs-sync uv sync ``` -------------------------------- ### Example Frontend .env file for Development Source: https://docs.saaspegasus.com/llms-small.txt An example of a `.env` file for the frontend during development. This file is used to configure environment-specific settings, particularly the base URL for the backend API, helping to resolve 'URI malformed' errors. ```env # Example .env file for frontend development VITE_APP_BASE_URL=http://localhost:8000 ``` -------------------------------- ### Backend API Access Example in React Source: https://docs.saaspegasus.com/llms-small.txt Illustrates how to import and potentially use the Pegasus API client within a React application for interacting with backend services. This example shows the import statement for `PegasusApi` and related components. ```jsx import {PegasusApi} from "api-client"; import EmployeeApplication from "../../../../assets/javascript/pegasus/examples/react/App.jsx"; import {getApiConfiguration} from "../" ``` -------------------------------- ### Initialize shadcn Project Source: https://ui.shadcn.com/docs/cli Initializes a new project with shadcn, installing necessary dependencies, adding the `cn` utility, and configuring CSS variables. This command is essential for setting up shadcn in a new project. ```bash npx shadcn@latest init ``` -------------------------------- ### Start LiteLLM Proxy Server with CLI Source: https://docs.litellm.ai/docs Initiate the LiteLLM Proxy Server using a simple command-line interface after installing the necessary package. This enables the LLM gateway functionalities, including request proxying and integration with configured models. ```bash pip install 'litellm[proxy]' $ litellm --model huggingface/bigcode/starcoder #INFO: Proxy running on http://0.0.0.0:4000 ``` -------------------------------- ### JavaScript Example for Feature Flag Usage Source: https://docs.saaspegasus.com/llms-small.txt This snippet provides an example of how to use feature flags in JavaScript. It demonstrates checking if a feature is enabled for the current team or user, likely interacting with a backend API or global configuration. ```javascript if (isFeatureEnabled('new_dashboard')) { // Show new dashboard console.log('New dashboard is enabled.'); } else { // Show old dashboard console.log('New dashboard is not enabled.'); } ``` -------------------------------- ### Running a Redis Server with Docker Source: https://channels.readthedocs.io/en/latest/tutorial/part_2.html Starts a Redis server instance using a Docker container. This is a common method for setting up Redis as a backing store for a channel layer. ```shell docker run --rm -p 6379:6379 redis:7 ``` -------------------------------- ### Django Template Example for Feature Flag Usage Source: https://docs.saaspegasus.com/llms-small.txt This example illustrates how to conditionally render content in Django templates based on feature flag status. It uses a custom template tag or variable provided by the feature flag system. ```django {% if feature_enabled 'new_dashboard' %}

Welcome to the new dashboard!

{% else %}

Enjoying the classic dashboard.

{% endif %} ``` -------------------------------- ### Clone Project from Github Source: https://docs.saaspegasus.com/getting-started Clones a project repository from Github using the git clone command. This is recommended for easier future upgrades. Requires a Github URL provided by saaspegasus.com. ```bash git clone https://github.com/user/project-id.git ``` -------------------------------- ### Apply Database Migrations Natively Source: https://github.com/pcherna/pegasus-example-apps-v2 These commands are used to create and apply database migrations when running the project natively, outside of a Docker environment. They utilize Django's management commands. ```bash ./manage.py makemigrations ./manage.py migrate ``` -------------------------------- ### Add Celerybeat Configuration Example (YAML) Source: https://docs.saaspegasus.com/llms-small.txt This snippet shows an example configuration for Celerybeat, a scheduler for Celery. It is used for implementing scheduled tasks within an application, allowing for automated, time-based job execution. This configuration is now supported out-of-the-box with Kamal deployments. ```yaml celerybeat: image: "your-celerybeat-image" depends_on: - celery environment: - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0 command: "celery --broker=$CELERY_BROKER_URL --results=$CELERY_RESULT_BACKEND beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler" ``` -------------------------------- ### Listen for Stripe Webhooks in Development (CLI) Source: https://docs.saaspegasus.com/llms-small.txt Prints the Stripe CLI secret for local webhook testing. This command requires the Stripe CLI to be installed and set up. ```bash stripe listen --print-secret ``` -------------------------------- ### Create and Start Vite Development Server Source: https://vitejs.dev/ This snippet demonstrates how to create a Vite development server instance using the `createServer` function from the 'vite' package. It includes placeholder options for user configuration and shows how to start the server using `server.listen()` and display the server URLs with `server.printUrls()`. ```javascript import { createServer } from 'vite' const server = await createServer({ // user config options }) await server.listen() server.printUrls() ``` -------------------------------- ### Install a Command-Line Tool with uv tool install Source: https://docs.astral.sh/uv Illustrates installing a command-line tool globally using 'uv tool install'. It shows the installation process and then verifies the installation by running the tool's version command. ```bash uv tool install ruff # Output shows package resolution, installation, and confirmation of the installed executable. ruff --version # Output displays the installed ruff version. ``` -------------------------------- ### Rename React Bundle File Source: https://docs.saaspegasus.com/llms-small.txt The filename for the React object lifecycle example bundle has been changed from `object-lifecycle-bundle.js` to `react-object-lifecycle-bundle.js`. This provides a more specific and descriptive name for the file. ```javascript Renamed React object lifecycle example bundle file from `object-lifecycle-bundle.js` to `react-object-lifecycle-bundle.js` ``` -------------------------------- ### Bash: Use uv for Python package installation Source: https://docs.saaspegasus.com/llms-small.txt This update reflects the adoption of `uv` for installing Python packages within Dockerfiles and GitHub Actions. It also updates the `make pip-compile` target to utilize `uv`, aiming for faster and more efficient dependency management. ```bash [uv](https://docs.astral.sh/uv/) is now used to install Python packages in Docker files and Github actions. ``` ```bash Also updated `make pip-compile` target to use `uv`. ``` -------------------------------- ### Create and Start Vite Development Server Source: https://vite.dev/ This snippet demonstrates how to create a Vite development server instance using the `createServer` function and then start it using the `listen` method. The `listen` method returns a promise that resolves with the server instance, allowing further operations like printing URLs. ```javascript import { createServer } from "vite" const server = await createServer({ // user config options }) await server.listen() server.printUrls() ``` -------------------------------- ### Gunicorn Usage in Production Dockerfiles Source: https://docs.saaspegasus.com/llms-small.txt Production Dockerfiles now utilize gunicorn as the default web server. This change can be overridden in platform-specific tools if necessary, for example, to run Celery tasks. ```text Production Dockerfiles now run gunicorn by default (this can be overridden in the platform-specific tools, e.g. to run celery) ``` -------------------------------- ### Black Configuration Example (pyproject.toml) Source: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html Provides an example of a pyproject.toml file configured for Black. This snippet showcases how to set line length, target Python versions, include patterns, and exclude patterns using TOML syntax. Note the use of single-quoted strings for regular expressions and multiline strings for complex exclusion patterns. ```toml [tool.black] line-length = 88 target-version = ['py37'] include = '\.pyi?$' # 'extend-exclude' excludes files or directories in addition to the defaults extend-exclude = ''' # A regex preceded with ^/ will apply only to files and directories # in the root of the project. ( ^/foo.py # exclude a file named foo.py in the root of the project | .*_pb2.py # exclude autogenerated Protocol Buffer files anywhere in the project ) ''' ``` -------------------------------- ### Building Kamal Proxy Locally Source: https://github.com/basecamp/kamal-proxy Instructions for building the Kamal Proxy project locally using either a local Go environment or by building a Docker container. The `make` command is used for both build methods. ```bash make make docker ``` -------------------------------- ### Sentry Error Tracking Configuration Source: https://docs.saaspegasus.com/llms-small.txt Configure Sentry DSN to enable error tracking. Set the `SENTRY_DSN` in `settings.py` or as an environment variable. After setup, a test error can be triggered at `/simulate_error`. ```python SENTRY_DSN = 'your_sentry_dsn_here' ``` -------------------------------- ### Navigate to Project Directory (Bash) Source: https://docs.saaspegasus.com/llms-small.txt Command to change the current directory to the project's root folder. This is a prerequisite for many subsequent setup steps when using native Python. ```bash cd {{ project_name }} ``` -------------------------------- ### Django Auto-discover Tasks Configuration Source: https://docs.celeryq.dev/en/4.0/whatsnew-4.0.html Example of using Django's `autodiscover_tasks()` function without arguments for automatic discovery of tasks within installed Django apps, ensuring compatibility with `AppConfig`. ```python app.autodiscover_tasks() ``` -------------------------------- ### julia hook configuration examples Source: https://pre-commit.com/ Provides examples of configuring Julia hooks. It shows how to specify the entry point (a Julia source file, optionally with arguments) and how to include 'additional_dependencies' for package management. ```yaml - id: foo-without-args name: ... language: julia entry: bin/foo.jl - id: bar-with-args name: ... language: julia entry: bin/bar.jl --arg1 --arg2 - id: baz-with-extra-deps name: ... language: julia entry: bin/baz.jl additional_dependencies: - 'ExtraDepA@1' - '[email protected]' ``` -------------------------------- ### Clone Pegasus Example Apps Repository Source: https://github.com/pcherna/pegasus-example-apps Command to clone the example applications repository for SaaS Pegasus. This is the first step in setting up the example apps alongside your Pegasus project. ```bash git clone git@github.com:pcherna/pegasus-example-apps.git ``` -------------------------------- ### Configure Tailwind CSS Content for Upgrade Tool Source: https://docs.saaspegasus.com/llms-small.txt Example configuration for the 'content' section in `tailwind.config.js`. This is needed when temporarily restoring Tailwind v3 to run the upgrade tool on non-Pegasus managed files. ```javascript content: [ './apps/**/*.html', './apps/web/templatetags/form_tags.py', './assets/**/*.{js,ts,jsx,tsx,vue}', './templates/**/*.html', ], ``` -------------------------------- ### Include Chat Widget Initialization JavaScript Source: https://docs.saaspegasus.com/llms-small.txt This Jinja template snippet shows how to include the necessary JavaScript file for initializing the chat widget. It provides examples for both Vite and Webpack build systems. ```jinja {% block page_js %} {% vite_asset 'assets/javascript/chat/ws_initialize.ts' %} {% endblock page_js %} ``` -------------------------------- ### Bootstrap Celery Tasks (Python/Bash) Source: https://docs.saaspegasus.com/llms-small.txt This command bootstraps Celery tasks by creating or updating them in the database and removing stale tasks. It's useful for initial setup or during deployment alongside Django migrations. ```python SCHEDULED_TASKS = { 'celery.task.email.send_email': { 'schedule': 3600.0, # Run every hour (in seconds) 'args': (16, 16), # Arguments to pass to the task }, } ``` ```bash python manage.py bootstrap_celery_tasks --remove-stale ``` -------------------------------- ### Navigate to Project Directory Source: https://docs.saaspegasus.com/getting-started Changes the current directory to the project's root folder. This command is used after downloading or cloning the project. Assumes the project directory is named '{{ project_name }}'. ```bash cd {{ project_name }} ``` -------------------------------- ### Install Docker using Convenience Script Source: https://docs.docker.com/engine/install/ubuntu This command downloads the Docker convenience script from get.docker.com and executes it using sudo. This installs the latest stable version of Docker, containerd, and runc on your Linux system. The script handles dependency installation and service startup. ```shell curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh ``` -------------------------------- ### Example pip-sync command execution Source: https://pip-tools.readthedocs.io/en/latest This shows the command-line execution of `pip-sync`, which updates a virtual environment to match the exact dependencies listed in `requirements.txt`. It illustrates the process of uninstalling outdated packages and installing new ones. ```bash $ pip-sync Uninstalling flake8-2.4.1: Successfully uninstalled flake8-2.4.1 Collecting click==4.1 Downloading click-4.1-py2.py3-none-any.whl (62kB) 100% |................................| 65kB 1.8MB/s Found existing installation: click 4.0 Uninstalling click-4.0: Successfully uninstalled click-4.0 Successfully installed click-4.1 ``` -------------------------------- ### Connect to Local SQLite Database with Django Source: https://codelabs.developers.google.com/codelabs/cloud-run-django This guide explains how to configure your Django application to use a local SQLite database for development. It covers virtual environment setup, dependency installation, retrieving application settings, updating the DATABASE_URL, and applying database migrations. ```bash # Create a virtualenv virtualenv venv source venv/bin/activate pip install -r requirements.txt # Copy the application settings to your local machine gcloud secrets versions access latest --secret application_settings > temp_settings # Edit the DATABASE_URL setting to use a local sqlite file. For example: DATABASE_URL=sqlite:////tmp/my-tmp-sqlite.db # Set the updated settings as an environment variable APPLICATION_SETTINGS=$(cat temp_settings) # Apply migrations to the local database python manage.py migrate ``` -------------------------------- ### Install Django and Create Project Shell Commands Source: https://python.plainenglish.io/django-allauth-a-guide-to-enabling-social-logins-with-github-f820239fb73f This snippet provides shell commands to create a new Django project directory, set up a virtual environment, activate it, install Django, create a new Django project, apply migrations, and run the development server. These are essential steps for initializing a Django application. ```shell $ mkdir django-social-auth && cd django-social-auth $ python3 -m venv env $ source env\u002Fbin\u002Factivate (env)$ pip install Django==4.1.3 ``` ```bash (env)$ django-admin startproject social_app . (env)$ python manage.py migrate (env)$ python manage.py runserver ``` -------------------------------- ### Extend SiteJS object with modal functionality Source: https://docs.saaspegasus.com/llms-small.txt This example illustrates how to add modal functionality to the global `window.SiteJS` object from `app.js`. It ensures the `SiteJS` object exists and assigns the `Modals` object from `./web/modals` to `SiteJS.app.Modals`. ```javascript import { Modals as AppModals } from './web/modals'; // Ensure SiteJS global exists if (typeof window.SiteJS === 'undefined') { window.SiteJS = {}; } // Assign this entry's exports to SiteJS.app window.SiteJS.app = { Modals: AppModals, } ``` -------------------------------- ### Initialize shadcn/ui Project with CLI Source: https://ui.shadcn.com/docs/cli The `shadcn-ui init` command initializes configuration and dependencies for a new project. It installs necessary packages, adds the `cn` utility, and configures CSS variables. This command is crucial for setting up shadcn/ui components within your project. ```bash npx shadcn@latest init yarn shadcn@latest init pnpm dlx shadcn@latest init bunx --bun shadcn@latest init ```