### Prek Pre-commit Hook Installation and Setup Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/code-quality.md These bash commands guide the installation of the `prek` tool and the setup of pre-commit hooks within a repository. `prek` automates running various checks before code is committed. ```bash # Install prek cargo install prek # or uv tool install prek # Install hooks in repository prek install ``` -------------------------------- ### Complete Scoop Workflow Example Source: https://context7.com/ai-screams/scoop-uv/llms.txt A comprehensive bash script demonstrating a typical Scoop workflow, including shell integration setup, Python installation, environment creation, project setup, dependency installation, and migration from other tools. ```bash #!/usr/bin/env bash # Complete scoop workflow # 1. Setup shell integration (one-time) echo 'eval "$(scoop init bash)"' >> ~/.bashrc source ~/.bashrc # 2. Install Python versions scoop install 3.12 scoop install 3.11 # 3. Create project environment scoop create myproject 3.12 # 4. Set up project directory mkdir -p ~/projects/myproject cd ~/projects/myproject scoop use myproject --link # Creates .scoop-version and .venv symlink # 5. Environment auto-activates on cd cd ~/projects/myproject # Output: (myproject) $ # 6. Install dependencies pip install requests flask pytest # 7. Work on project python app.py # 8. Check health periodically scoop doctor # 9. Set global default for new terminals scoop create default-env 3.12 scoop use default-env --global # 10. Migration from other tools scoop migrate list scoop migrate --all # 11. Cleanup old Python version scoop list --python-version 3.10 scoop uninstall 3.10 --cascade --force ``` -------------------------------- ### Install and Verify Python with Scoop UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Installs the latest Python version using Scoop UV and verifies the installation by listing available Python versions. ```bash # Install latest Python scoop install 3.12 # Verify installation scoop list --pythons ``` -------------------------------- ### Install uv Dependency Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Installs the 'uv' dependency, a prerequisite for scoop-uv. This command fetches and executes an installation script from a provided URL. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Setup scoop-uv Project Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/contributing.md Commands to clone the repository, install dependencies like prek and uv, set up git hooks, build the project, and run tests. ```bash git clone https://github.com/ai-screams/scoop-uv.git cd scoop-uv uv tool install prek # or: cargo install prek prek install cargo build cargo test ``` -------------------------------- ### Run scoop Examples (Bash) Source: https://github.com/ai-screams/scoop-uv/blob/main/examples/README.md This snippet demonstrates how to make scoop example shell scripts executable and then run them. It assumes you have scoop and uv installed and shell integration enabled. ```bash # Make examples executable chmod +x examples/*.sh # Run an example ./examples/basic_workflow.sh ``` -------------------------------- ### Manage Project Dependencies with Scoop UV Environment Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Installs project dependencies from a requirements file and lists installed packages within an activated Scoop UV virtual environment. This ensures project isolation. ```bash (myproject) $ pip install -r requirements.txt # If the file is in a different location: (myproject) $ pip install -r path/to/requirements.txt # Verify installed packages (myproject) $ pip list ``` -------------------------------- ### Basic scoop-uv Workflow Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/README.md Demonstrates the fundamental commands for installing Python versions, creating, and using virtual environments with scoop-uv. This workflow is essential for setting up and managing project-specific Python environments. ```bash # Install Python scoop install 3.12 # Create a virtualenv scoop create myproject 3.12 # Use it (auto-activates!) scoop use myproject (myproject) $ pip install -r requirements.txt # Check what's available scoop list ``` -------------------------------- ### Verify uv Installation Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Verifies that the 'uv' tool is installed and accessible in the system's PATH. This is a prerequisite check for scoop-uv. ```bash uv --version ``` -------------------------------- ### Verify scoop-uv Installation Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Verifies the installation of scoop-uv by checking its version. This command should be run after installation or upgrade to confirm the tool is accessible and functioning. ```bash scoop --version ``` -------------------------------- ### Install scoop-uv via Cargo Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Installs the scoop-uv tool using the Cargo package manager for Rust. This command compiles and installs the 'scoop-uv' crate, placing the binary in the default Cargo bin directory. ```bash cargo install scoop-uv ``` -------------------------------- ### Set Up Shell Integration for Scoop UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Integrates Scoop UV with your shell environment for command-line usage. This involves adding initialization commands to your shell's configuration file and sourcing it. ```bash echo 'eval "$(scoop init zsh)"' >> ~/.zshrc source ~/.zshrc ``` ```bash echo 'eval "$(scoop init bash)"' >> ~/.bashrc source ~/.bashrc ``` ```fish echo 'eval (scoop init fish)' >> ~/.config/fish/config.fish source ~/.config/fish/config.fish ``` ```powershell Add-Content -Path $PROFILE -Value 'Invoke-Expression (& scoop init powershell)' . $PROFILE ``` -------------------------------- ### Enable Auto-Activation of Scoop UV Environments Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Demonstrates how Scoop UV automatically activates a virtual environment when entering a directory containing a `.scoop-version` file. This simplifies environment management. ```bash cd ~/projects/myproject # (myproject) appears in prompt automatically ``` -------------------------------- ### Initial Rust Setup for scoop Development Source: https://github.com/ai-screams/scoop-uv/blob/main/CONTRIBUTING.md Instructions for setting up the Rust development environment for scoop, ensuring the correct Minimum Supported Rust Version (MSRV) is installed and configured. This includes cloning the repository and verifying the Rust compiler version. ```bash # Clone repository git clone https://github.com/ai-screams/scoop-uv.git cd scoop-uv # Rust 1.85 will be automatically selected via rust-toolchain.toml rustc --version # Expected: rustc 1.85.0 (a28077b28 2025-02-20) # If you see a different version: rustup update rustup toolchain install 1.85 ``` -------------------------------- ### Create Project Environment with Specific Python Version Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/llms.md This example shows how to create a project-specific virtual environment using a particular Python version (e.g., 3.9.5). It first ensures the Python version is installed and then creates the environment named 'myproject'. The `scoop info` command is used to verify the environment details. If the Python version is not found, it suggests checking discovery with `uv python list` and `scoop list --pythons`. ```bash scoop install 3.9.5 scoop create myproject 3.9.5 scoop info myproject ``` -------------------------------- ### Rust Language Registration Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md Shows how to register new supported languages in the `src/i18n.rs` file. This is crucial for the `scoop lang {code}` command to recognize and utilize new translations. ```rust // Language detection priority: // 1. SCOOP_LANG environment variable // 2. Config file (~/.scoop/config.json) // 3. System locale // 4. Default: "en" pub const SUPPORTED_LANGS: &[(&str, &str)] = &[ ("en", "English"), // ... existing languages // Add new languages here ]; ``` -------------------------------- ### Use Custom Python Installations with Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/python-management.md Provides examples of how to create scoop environments using custom Python installations that are not found in default discovery paths. This includes using the `--python-path` flag for direct executable specification and adding custom Python to the system's PATH. ```bash # Custom Python built from source scoop create debug-env --python-path /opt/python-debug/bin/python3 # PyPy interpreter scoop create pypy-env --python-path /opt/pypy/bin/pypy3 # GraalPy scoop create graal-env --python-path /opt/graalpy/bin/graalpy # Example: custom Python built from source in /opt/python-debug/ export PATH="/opt/python-debug/bin:$PATH" # Verify uv can find it uv python list | grep python # cpython-3.13.0 /opt/python-debug/bin/python3.13 # Now scoop can use it scoop create debug-env 3.13 ``` -------------------------------- ### YAML Placeholder Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md Illustrates the importance of preserving placeholders like `%{name}` and `%{version}` in translation files. Missing or incorrect placeholders can lead to runtime errors. ```yaml # WRONG - Missing placeholder error: "Cannot find environment" # CORRECT - Placeholder preserved error: "Cannot find '%{name}' environment" ``` -------------------------------- ### Example Tone Adjustments for CLI Messages Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md These examples illustrate the desired tone for CLI messages in scoop-uv. The goal is to be casual, clear, and concise, avoiding overly formal or robotic phrasing. The 'Good' examples show how to achieve this balance. ```text # Too formal (avoid) "The environment has been successfully created." # Too robotic (avoid) "Environment creation: complete." # Good - casual and clear "Created 'myenv' — ready to go!" "'myenv' is ready" ``` -------------------------------- ### Install Rust Dependency Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Installs or updates the Rust programming language toolchain, which is a prerequisite for building and installing scoop-uv. It uses curl to download and execute the official Rust installation script. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### List Virtual Environments and Python Versions with Scoop UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/list.md Demonstrates how to list all virtual environments and installed Python versions using the 'scoop list' command. This is the basic usage for understanding the current environment setup. ```bash scoop list s বাস্তব # List all virtualenvs scoop list --pythons # List installed Python versions ``` -------------------------------- ### Install scoop-uv and Configure Shell Source: https://context7.com/ai-screams/scoop-uv/llms.txt Installs scoop-uv and uv, then configures the user's shell for automatic environment activation and tab completion. Requires curl and Cargo. ```bash # Install prerequisites curl -LsSf https://astral.sh/uv/install.sh | sh # uv cargo install scoop-uv # scoop # Shell setup - choose your shell: # Zsh echo 'eval "$(scoop init zsh)"' >> ~/.zshrc && source ~/.zshrc # Bash echo 'eval "$(scoop init bash)"' >> ~/.bashrc && source ~/.bashrc # Fish echo 'eval (scoop init fish)' >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish # PowerShell Add-Content $PROFILE 'Invoke-Expression (& scoop init powershell)' && . $PROFILE # Verify installation scoop --version # Output: scoop 0.8.1 ``` -------------------------------- ### List and Use Discovered Python Versions with UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/install.md Lists all Python versions that uv can find, including those managed by uv and system installations. Demonstrates how to create an environment using a discovered Python version without explicit installation. ```bash # See all Python versions uv can find uv python list # Example output: cpython-3.13.1 /opt/homebrew/bin/python3.13 (system) cpython-3.12.8 ~/.local/share/uv/python/... (managed) cpython-3.11.5 /usr/bin/python3.11 (system) # Use system Python directly — no scoop install needed scoop create myenv 3.13 ``` -------------------------------- ### Rust Integration Test Examples using assert_cmd and predicates Source: https://github.com/ai-screams/scoop-uv/blob/main/CONTRIBUTING.md Shows how to write integration tests in Rust using the `assert_cmd` and `predicates` crates. Examples include testing a successful `list` command and a failing `invalid` command. ```rust // tests/cli_test.rs use assert_cmd::Command; use predicates::prelude::*; #[test] fn test_list_command() { Command::cargo_bin("scoop") .unwrap() .args(["list"]) .assert() .success(); } #[test] fn test_invalid_command() { Command::cargo_bin("scoop") .unwrap() .args(["invalid"]) .assert() .failure() .stderr(predicate::str::contains("error")); } ``` -------------------------------- ### Create and Use Python Virtual Environment with Scoop UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Creates a new Python virtual environment named 'myproject' with a specific Python version and then activates it for use. This sets up the environment for project-specific dependencies. ```bash scoop create myproject 3.12 cd ~/projects/myproject scoop use myproject ``` -------------------------------- ### YAML Label Translation Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md Provides an example of correctly translating labels in YAML files, ensuring that only the user-facing text is translated and commands remain in English. ```yaml # WRONG - Command translated hint: "→ List: {translated} list" # CORRECT - Only label translated hint: "→ {Translated Label}: scoop list" ``` -------------------------------- ### YAML Command Translation Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md Demonstrates the correct and incorrect ways to translate commands within YAML files. It emphasizes translating only the descriptive parts and keeping the actual commands in English. ```yaml # WRONG - Command translated hint: "→ Create: {translated_command} myenv 3.12" # CORRECT - Only description translated hint: "→ {translated_word}: scoop create myenv 3.12" ``` -------------------------------- ### Install Dependencies from requirements.txt Source: https://github.com/ai-screams/scoop-uv/blob/main/llms-full.txt Provides the command to install project dependencies from a `requirements.txt` file within the active Python environment. It also mentions how to specify alternative paths for the requirements file and how to verify the installation using `pip list`. ```bash pip install -r requirements.txt # For alternate paths: pip install -r path/to/requirements.txt # Verify installation: pip list ``` -------------------------------- ### Create IDE-Compatible Symlink with Scoop UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/quick-start.md Creates a `.venv` symlink pointing to the active Scoop UV environment, making it compatible with IDEs like VS Code and PyCharm. This facilitates seamless development workflows. ```bash scoop use myproject --link ``` -------------------------------- ### Rust Documentation Style Example Source: https://github.com/ai-screams/scoop-uv/blob/main/CONTRIBUTING.md This Rust code snippet illustrates the documentation style for public APIs. It includes a doc comment explaining the function's purpose, arguments, return value, potential errors, and provides a runnable example. ```rust /// Creates a new virtual environment. /// /// # Arguments /// /// * `name` - The environment name (must be valid identifier) /// * `python_version` - Python version (e.g., "3.12") /// /// # Returns /// /// Path to the created virtual environment. /// /// # Errors /// /// Returns [`ScoopError::InvalidName`] if name is invalid. /// Returns [`ScoopError::UvError`] if uv command fails. /// /// # Examples /// /// ```no_run /// let path = create_virtualenv("myenv", "3.12")?; /// ``` pub fn create_virtualenv(name: &str, python_version: &str) -> Result { // ... } ``` -------------------------------- ### Install Python Versions with scoop Source: https://context7.com/ai-screams/scoop-uv/llms.txt Installs Python versions managed by uv. Supports installing the latest, latest stable, specific minor versions, or exact versions. ```bash # Install latest Python scoop install # Output: Installing Python 3.13... # Output: Successfully installed Python 3.13.1 # Install latest stable (oldest fully-supported, currently 3.10) scoop install --stable # Output: Installing Python 3.10... # Output: Successfully installed Python 3.10.16 # Install specific minor version (gets latest patch) scoop install 3.12 # Output: Installing Python 3.12... # Output: Successfully installed Python 3.12.8 # Install exact version scoop install 3.11.8 # Output: Installing Python 3.11.8... # Output: Successfully installed Python 3.11.8 ``` -------------------------------- ### List Python Installations Managed by Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/create.md This command lists all Python installations that are managed by 'scoop'. This is useful for verifying that specific Python versions have been successfully installed and are available for use with 'scoop create'. ```bash scoop list --pythons ``` -------------------------------- ### Rust Function Documentation: Create Environment Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/code-quality.md Demonstrates Rust documentation comments for a function that creates a virtual environment. It includes arguments, return values, error conditions, and usage examples. This function is part of the scoop-uv project. ```rust /// Creates a new virtual environment. /// /// # Arguments /// /// * `name` - Environment name (must be valid) /// * `python` - Python version (e.g., "3.12") /// /// # Returns /// /// Path to the created environment. /// /// # Errors /// /// Returns [`ScoopError::InvalidEnvName`] if name is invalid. /// /// # Examples /// /// ``` /// # fn main() -> Result<(), Box> { /// let path = create_env("myenv", "3.12")?; /// # Ok(()) /// # } /// ``` pub fn create_env(name: &str, python: &str) -> Result { // ... } ``` -------------------------------- ### GitHub Actions CI Pipeline for Rust Projects Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/code-quality.md This GitHub Actions workflow (`ci.yml`) defines a CI pipeline that runs on push and pull request events. It checks out code, installs Rust with specified components (rustfmt, clippy), and runs formatting, linting, and testing. ```yaml name: CI on: [ push, pull_request ] jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-action@stable with: components: rustfmt, clippy - name: Format check run: cargo fmt --all -- --check - name: Clippy run: cargo clippy --all-targets --all-features -- -D warnings - name: Test run: cargo test --all-features ``` -------------------------------- ### Pre-commit Hook Configuration with Prek Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/code-quality.md The `.pre-commit-config.yaml` file defines the hooks that `prek` will manage. This example configures `cargo fmt`, `cargo clippy`, and `cargo check` as system language hooks for Rust files. ```yaml repos: - repo: local hooks: - id: cargo-fmt name: cargo fmt entry: cargo fmt --all -- language: system types: [ rust ] pass_filenames: false - id: cargo-clippy name: cargo clippy entry: cargo clippy --all-targets --all-features -- -D warnings language: system types: [ rust ] pass_filenames: false - id: cargo-check name: cargo check entry: cargo check --all-targets language: system types: [ rust ] pass_filenames: false ``` -------------------------------- ### Install Project Dependencies with pip and Scoop-uv Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md This snippet shows how to install project dependencies from a `requirements.txt` file into an active Scoop-uv environment using pip. It assumes the environment is already activated (indicated by the prompt). Variants for different file locations and verifying installed dependencies are also provided. ```bash # Prompt shows active environment, e.g. (myproject) pip install -r requirements.txt # Useful variants: # Different file location: pip install -r path/to/requirements.txt # Verify installed dependencies: pip list ``` -------------------------------- ### JSON Output Example (JSON) Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/migrate.md An example of the JSON output when listing migratable environments with the --json flag. It details the environment name, source, and Python version. ```json { "status": "success", "data": { "environments": [ { "name": "myproject", "source": "pyenv", "python_version": "3.12.0" } ] } } ``` -------------------------------- ### Install Dependencies from requirements.txt Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/llms.md This snippet shows the standard method for installing Python package dependencies from a `requirements.txt` file into an active scoop virtual environment using `pip`. It assumes the environment is already activated. The command `pip install -r requirements.txt` is used, and `pip list` can verify the installation. ```bash # environment already active (prompt shows: (myproject)) pip install -r requirements.txt ``` -------------------------------- ### Install scoop-uv and uv Source: https://github.com/ai-screams/scoop-uv/blob/main/README.md Installs the scoop-uv package and its prerequisite, uv. uv is installed using a curl script, while scoop-uv is installed via cargo. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh # uv cargo install scoop-uv # scoop ``` -------------------------------- ### Integrate Custom Python Installation with Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md Demonstrates two methods to integrate a custom or pre-existing Python installation into scoop's management system. Option 1 directly points to the Python executable, while Option 2 adds the custom Python to the system's PATH. ```bash # Option 1: Recommended - point directly to a Python executable scoop create myenv --python-path /opt/python-debug/bin/python3 # Option 2: Add custom Python to PATH, then use normal version selection export PATH="/opt/python-debug/bin:$PATH" scoop create myenv 3.13 ``` -------------------------------- ### Doc Test Example in Rust Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/testing.md Illustrates how to write documentation tests in Rust using Markdown code blocks within doc comments. These tests are automatically run by `cargo test --doc` and serve as runnable examples. ```rust /// Validates environment name. /// /// # Examples /// /// ``` /// use scoop_uv::validate::is_valid_env_name; /// assert!(is_valid_env_name("myenv")); /// assert!(!is_valid_env_name("123bad")); /// ``` pub fn is_valid_env_name(name: &str) -> bool { ... } ``` -------------------------------- ### GitHub Actions CI Integration with scoop (YAML) Source: https://github.com/ai-screams/scoop-uv/blob/main/examples/README.md This example shows how to integrate scoop into a GitHub Actions workflow for continuous integration. It outlines the steps for setting up the environment and running your Python project. ```yaml # Example content for ci_github_actions.yml would go here. # This is a placeholder as the actual code was not provided in the input. # A typical workflow might involve checking out code, setting up Python, installing dependencies with scoop, and running tests. ``` -------------------------------- ### Usage Example for Doctor (Rust) Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/api.md Provides a practical example of how to use the `Doctor` struct. It shows initializing a `Doctor`, running all checks, and iterating through the results to print their status. It also demonstrates how to use `run_and_fix` with an `Output` instance for progress display during auto-fixing. ```rust let doctor = Doctor::new(); // Run diagnostics let results = doctor.run_all(); for result in results { match &result.status { CheckStatus::Error(msg) => eprintln!("❌ {}: {}", result.name, msg), CheckStatus::Warning(msg) => println!("⚠️ {}: {}", result.name, msg), CheckStatus::Ok => println!("✅ {}", result.name), } } // Auto-fix issues (requires Output for progress display) use scoop::output::Output; let output = Output::new(0, false, false, false); let fixed_results = doctor.run_and_fix(&output); ``` -------------------------------- ### Rust Unit Test Structure and Examples Source: https://github.com/ai-screams/scoop-uv/blob/main/CONTRIBUTING.md Illustrates the standard structure for unit tests in Rust, located within a `#[cfg(test)] mod tests` block inside the source file. Includes examples for testing valid and invalid names. ```rust // src/validate.rs pub fn is_valid_name(name: &str) -> bool { // implementation } #[cfg(test)] mod tests { use super::*; #[test] fn test_valid_name() { assert!(is_valid_name("myenv")); assert!(is_valid_name("my-env")); assert!(is_valid_name("my_env_123")); } #[test] fn test_invalid_name() { assert!(!is_valid_name("")); assert!(!is_valid_name("123start")); assert!(!is_valid_name("has space")); } } ``` -------------------------------- ### Example Usage of VirtualenvService (Rust) Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/api.md Demonstrates a common pattern for using the `VirtualenvService` in Rust. It shows how to initialize the service, check for an environment's existence, create it if necessary, and retrieve its path. ```rust // Initialize service let service = VirtualenvService::auto()?; // Check if environment exists if !service.exists("myenv")? { // Create with Python 3.12 service.create("myenv", "3.12")?; } // Get environment path let path = service.get_path("myenv")?; println!("Environment at: {}", path.display()); ``` -------------------------------- ### List Python Versions and Associated Environments Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/llms.md This example demonstrates how to list available Python versions and the virtual environments associated with them using scoop. It shows commands like `scoop list --pythons`, `scoop list`, and `scoop list --python-version `. The `--json` and `--bare` flags are mentioned for automation and script-friendly output. ```bash scoop list --pythons scoop list scoop list --python-version 3.12 ``` -------------------------------- ### Source Shell Configuration Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Reloads the shell configuration file (e.g., .zshrc or .bashrc) to apply changes made to the PATH environment variable. This is typically run after modifying the configuration file. ```bash source ~/.zshrc # or ~/.bashrc ``` -------------------------------- ### Clone Scoop UV Repository Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/translation.md This command clones the scoop-uv repository from GitHub to your local machine. You will need Git installed to perform this action. Replace 'YOUR_USERNAME' with your GitHub username. ```bash git clone https://github.com/YOUR_USERNAME/scoop-uv.git cd scoop-uv ``` -------------------------------- ### Integration Testing Setup (Rust) Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/api.md Provides a template for integration tests in Rust, utilizing the 'tempfile' crate for creating temporary directories. It outlines a common pattern for setting up test environments before executing test logic. ```rust #[cfg(test)] mod tests { use super::*; use tempfile::TempDir; fn setup_test_env() -> TempDir { // Test setup } #[test] fn test_something() { let temp = setup_test_env(); // Test logic } } ``` -------------------------------- ### List Python Versions and Associated Environments Source: https://github.com/ai-screams/scoop-uv/blob/main/llms-full.txt Demonstrates how to list installed Python versions and their associated environments. It covers basic listing, filtering by Python version, and using `--bare` for shell loop integration and `--json` for automation. This helps in managing and inspecting the available Python environments. ```bash scoop list --pythons scoop list scoop list --python-version 3.12 # For automation: scoop list --json # For shell loops: for v in $(scoop list --pythons --bare); do scoop list --python-version "$v" --bare done ``` -------------------------------- ### Add Cargo Bin to PATH Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/installation.md Adds the Cargo bin directory to the system's PATH environment variable. This is a troubleshooting step to resolve 'command not found' errors for Cargo-installed binaries like scoop-uv. ```bash # Add to ~/.zshrc or ~/.bashrc export PATH="$HOME/.cargo/bin:$PATH" ``` -------------------------------- ### Bash Commands: Dependency Auditing with Cargo Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/development/code-quality.md Provides bash commands for auditing Rust project dependencies using `cargo-audit`. It covers installation, running the audit, and attempting to fix identified vulnerabilities. ```bash # Install cargo-audit cargo install cargo-audit # Run audit cargo audit # Fix vulnerabilities cargo audit fix ``` -------------------------------- ### Scoop Security Best Practices Example Source: https://github.com/ai-screams/scoop-uv/blob/main/SECURITY.md Demonstrates secure usage of the 'scoop' command-line tool, highlighting environment name validation and caution with untrusted files. This snippet shows how to create a project with a validated environment name and advises on reviewing untrusted .scoop-version files. ```bash # ✅ Good - environment names are validated scoop create myproject 3.12 # ⚠️ Be cautious with untrusted .scoop-version files # scoop validates names, but always review before entering untrusted directories ``` -------------------------------- ### Create Scoop Environment with Custom Python Path Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md Examples demonstrating how to create scoop environments using custom Python interpreters, including custom builds, PyPy, and GraalPy, by specifying the direct path to the Python executable. ```bash # Custom-built Python scoop create debug-env --python-path /opt/python-debug/bin/python3 # PyPy interpreter scoop create pypy-env --python-path /opt/pypy/bin/pypy3 # GraalPy scoop create graal-env --python-path /opt/graalpy/bin/graalpy ``` -------------------------------- ### Create Scoop Environment Using System Python via uv Discovery Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md Demonstrates creating a scoop environment by referencing a Python version that uv has discovered on the system. If the custom Python is not in a standard location, it can be added to the PATH. ```bash # Use a system-installed Python directly (no scoop install needed) scoop create myenv 3.13 # For a custom Python in a non-standard location, add it to your PATH: export PATH="/opt/python-debug/bin:$PATH" scoop create debug-env 3.13 ``` -------------------------------- ### Basic scoop Virtual Environment Management Source: https://github.com/ai-screams/scoop-uv/blob/main/llms.txt Demonstrates core scoop commands for managing Python virtual environments, including installation, creation, activation, listing, and removal. ```bash scoop install 3.12 # Install Python 3.12 via uv scoop create myproject 3.12 # Create a virtualenv scoop use myproject # Activate (auto-activates on directory entry) scoop list # List all virtualenvs scoop remove myproject # Delete a virtualenv ``` -------------------------------- ### Version File Content Example Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/use.md Shows the expected content of the '.scoop-version' file, which specifies the active virtual environment. The file contains either an environment name or the literal string 'system'. ```bash $ cat .scoop-version myproject ``` -------------------------------- ### Clone and Build scoop Project Source: https://github.com/ai-screams/scoop-uv/blob/main/CONTRIBUTING.md Steps to clone the scoop repository, install git hooks, build the project using Cargo, run tests, and execute the CLI. This is essential for setting up a local development environment. ```bash git clone https://github.com/ai-screams/scoop-uv.git cd scoop-uv prek install cargo build cargo test cargo run -- --help ``` -------------------------------- ### Install Python Version with Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/install.md Installs a specified Python version using the Scoop package manager. Supports installing the latest stable, a specific version, or the oldest supported version. The installation process is managed by uv. ```bash scoop install [version] [options] # Examples: scoop install # Install latest Python 3.x scoop install --latest # Install latest Python 3.x scoop install --stable # Install Python 3.10 (oldest supported) scoop install 3.12 # Install latest 3.12.x patch version scoop install 3.12.3 # Install exact Python version 3.12.3 ``` -------------------------------- ### Install Python Versions with Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/python-management.md Commands to install Python versions using scoop. This includes installing the latest Python, specific minor versions, and exact versions. It also shows how to list currently installed Python versions managed by scoop. ```bash # Install latest Python scoop install # Install specific minor version (latest patch) scoop install 3.12 # Install exact version scoop install 3.12.3 # List installed versions scoop list --pythons ``` -------------------------------- ### Install uv Source: https://github.com/ai-screams/scoop-uv/blob/main/README.md Installs the 'uv' tool, which is described as the 'secret ingredient' for scoop-uv. The installation is performed using a curl command piped to sh. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Verify scoop Installation Source: https://github.com/ai-screams/scoop-uv/blob/main/README.md Verifies that the scoop installation was successful by checking its version. A successful output indicates that scoop is correctly installed and accessible in the system's PATH. ```bash scoop --version # → scoop 0.7.0 🍨 ``` -------------------------------- ### Configure uv Python Installation Directory Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/python-management.md Shows how to set the `UV_PYTHON_INSTALL_DIR` environment variable to specify a custom location for uv-managed Python installations. This allows for shared Python installations among team members. ```bash # Store uv-managed Pythons in a custom directory export UV_PYTHON_INSTALL_DIR=/opt/shared-pythons # Install Python to the custom location scoop install 3.12 # All team members can share the same Python installations ``` -------------------------------- ### Create Project-Specific Python Environment with Scoop Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md This workflow details how to create a new virtual environment for a specific project, explicitly specifying a Python version (e.g., 3.9.5). It includes installing the Python version if not present, creating the project environment, and verifying its configuration. If the version is not found, it suggests checking available versions with `uv python list` and `scoop list --pythons`. ```bash # 1) Install Python 3.9.5 (skip if already available on your system) scoop install 3.9.5 # 2) Create a new project environment with that exact version scoop create myproject 3.9.5 # 3) Verify which Python the environment uses scoop info myproject # If creation fails because 3.9.5 is not found, run: uv python list scoop list --pythons # Then install the exact version and retry: scoop install 3.9.5 scoop create myproject 3.9.5 ``` -------------------------------- ### List Available Python Versions with UV Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/commands/create.md This command lists all Python versions that 'uv' can discover, including those managed by 'scoop' and system-wide installations. This helps in determining which Python versions are available for creating virtual environments. ```bash uv python list ``` -------------------------------- ### UvClient: Interact with the uv Python Package Installer Source: https://github.com/ai-screams/scoop-uv/blob/main/llms-full.txt The UvClient is a client for interacting with the uv tool, enabling operations like creating virtual environments, installing/uninstalling Python versions, listing available and installed Pythons, and performing pip installations. ```rust pub struct PythonInfo { pub version: String, pub path: Option, pub installed: bool, pub implementation: String, } pub struct UvClient { path: PathBuf, } impl UvClient { pub fn new() -> Result; // Find uv in PATH pub fn with_path(path: PathBuf) -> Self; pub fn version(&self) -> Result; pub fn create_venv(&self, path: &Path, python_version: &str) -> Result<()>; pub fn install_python(&self, version: &str) -> Result<()>; pub fn uninstall_python(&self, version: &str) -> Result<()>; pub fn list_pythons(&self) -> Result>; pub fn list_installed_pythons(&self) -> Result>; pub fn find_python(&self, version: &str) -> Result; pub fn pip_install(&self, venv_path: &Path, packages: &[&str]) -> Result<()>; pub fn pip_install_requirements(&self, venv_path: &Path, req_file: &Path) -> Result<()>; pub fn latest_installed_python(&self) -> Result; } ``` -------------------------------- ### Show Environment Details using Scoop Source: https://context7.com/ai-screams/scoop-uv/llms.txt Displays detailed information about a specific Scoop virtual environment, including its name, Python version, installation path, and creation timestamp. This command is helpful for inspecting the configuration of individual environments. ```bash # Show environment details scoop info myproject # Output: Name: myproject # Output: Python: 3.12.1 # Output: Path: ~/.scoop/virtualenvs/myproject # Output: Created: 2024-01-15 10:30:00 UTC # Info for environment with custom Python path scoop info debug-env # Output: Name: debug-env # Output: Python: 3.13.0 # Output: Python Path: /opt/python-debug/bin/python3 # Output: Path: ~/.scoop/virtualenvs/debug-env ``` -------------------------------- ### Install Stable Python Version with Scoop-UV Source: https://github.com/ai-screams/scoop-uv/blob/main/README.md Installs the oldest supported stable Python version (currently 3.10) using Scoop-UV. ```bash scoop install --stable ``` -------------------------------- ### Install a Python Version with Scoop-UV Source: https://github.com/ai-screams/scoop-uv/blob/main/README.md Command to install a specific Python version into the Scoop-UV managed repository. Defaults to the latest version. ```bash scoop install [version] ``` -------------------------------- ### Initialize Scoop Shell Integration on Windows (PowerShell) Source: https://github.com/ai-screams/scoop-uv/blob/main/docs/src/faq.md Instructions for initializing scoop's shell integration, including auto-activation and tab completion, specifically for PowerShell on Windows. This command should be added to the user's PowerShell profile. ```powershell # Add this line to your $PROFILE file: Invoke-Expression (& scoop init powershell) ```