Pixi Repositories

This section provides comprehensive documentation for using CloudRepo with Pixi, the modern cross-platform package and environment management tool.

Introduction to Pixi

What is Pixi?

Pixi is a revolutionary cross-platform package management tool that bridges the conda and PyPI ecosystems, offering developers a unified solution for managing dependencies, environments, and workflows across Windows, macOS, and Linux. Built in Rust for exceptional performance, Pixi represents a significant evolution in Python package management.

Key advantages of Pixi include:

  • Cross-platform by design: Single configuration works seamlessly across Windows, macOS, and Linux

  • Dual ecosystem support: Native integration with both conda-forge and PyPI packages

  • Blazing fast performance: Up to 10x faster than conda, 4x faster than micromamba

  • Deterministic environments: Lock files ensure reproducible builds across all platforms

  • Language agnostic: Manage Python, R, C++, Rust, and other language dependencies

  • Built-in task runner: Define and execute project tasks without additional tools

  • Modern configuration: Single pixi.toml file replaces multiple config files

Why Use Pixi with CloudRepo?

Combining Pixi’s modern workflow with CloudRepo’s private repository hosting provides:

  • Private package distribution: Securely share internal packages across your organization

  • Cross-platform consistency: Ensure teams on different OS platforms get identical environments

  • Cost efficiency: Save up to 90% compared to enterprise alternatives like JFrog Artifactory

  • No egress fees: Download packages without worrying about bandwidth charges

  • Simplified CI/CD: One configuration file works across all build environments

  • Mixed dependencies: Seamlessly combine public PyPI/conda packages with private CloudRepo packages

Prerequisites

Before configuring Pixi to work with CloudRepo, ensure you have:

  1. CloudRepo Account and Repository

    • An active CloudRepo organization account

    • A Python repository created in the CloudRepo Admin Portal

    • A repository user with appropriate permissions (upload/download)

    Note

    Your admin user cannot directly access repositories for security reasons. Always create a dedicated repository user in the CloudRepo Admin Portal.

    If you haven’t completed these steps, please refer to:

  2. Pixi Installation

    Install Pixi using the official installer:

    Installing Pixi (Recommended Method)
    # macOS and Linux
    curl -fsSL https://pixi.sh/install.sh | bash
    
    # Windows (PowerShell)
    iwr -useb https://pixi.sh/install.ps1 | iex
    

    Or install via conda/mamba:

    Installing Pixi via Conda
    conda install -c conda-forge pixi
    # or
    mamba install -c conda-forge pixi
    
  3. Python Environment

    • Python 3.8 or higher (managed by Pixi)

    • A project directory for your Pixi configuration

Configuration

Basic Pixi Configuration for CloudRepo

Initialize a new Pixi project or add CloudRepo to an existing project:

Initializing a Pixi Project
# Create new project
pixi init my-project
cd my-project

# Or initialize in existing directory
pixi init

This creates a pixi.toml file. Configure it to use CloudRepo as a PyPI index:

pixi.toml - Basic CloudRepo Configuration
 1[project]
 2name = "my-project"
 3version = "0.1.0"
 4description = "Project using CloudRepo for private packages"
 5authors = ["Your Team <team@example.com>"]
 6channels = ["conda-forge"]
 7platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
 8
 9[dependencies]
10python = ">=3.8,<3.12"
11
12[pypi-dependencies]
13# Public packages from PyPI
14requests = ">=2.28.0"
15pandas = "*"
16
17# Private packages from CloudRepo
18my-private-package = { version = ">=1.0.0", index = "cloudrepo" }
19company-utils = { version = "*", index = "cloudrepo" }
20
21[[project.pypi-indices]]
22name = "cloudrepo"
23url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
24priority = "supplemental"

Authentication Setup

Pixi supports multiple authentication methods for private repositories:

Method 1: Environment Variables (Recommended for CI/CD)

Authentication via Environment Variables
export PIXI_PYPI_USERNAME_CLOUDREPO="[repository-user-email]"
export PIXI_PYPI_PASSWORD_CLOUDREPO="[repository-user-password]"

# Or for Windows PowerShell
$env:PIXI_PYPI_USERNAME_CLOUDREPO = "[repository-user-email]"
$env:PIXI_PYPI_PASSWORD_CLOUDREPO = "[repository-user-password]"

Method 2: URL Authentication (Quick Setup)

pixi.toml - URL-based Authentication
1[[project.pypi-indices]]
2name = "cloudrepo"
3url = "https://[repository-user-email]:[repository-user-password]@[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"

Warning

URL-based authentication embeds credentials in the configuration file. Use environment variables or keyring for production environments.

Method 3: Keyring Integration (Most Secure for Development)

Using System Keyring for Credentials
# Install keyring support
pixi add keyring

# Store credentials in system keyring
python -m keyring set https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple [repository-user-email]
# You'll be prompted for the password

Method 4: .netrc File (Unix-like Systems)

~/.netrc Configuration
machine [organization-id].mycloudrepo.io
login [repository-user-email]
password [repository-user-password]
Secure .netrc Permissions
chmod 600 ~/.netrc

Multiple Index Configuration

Configure Pixi to use multiple package indices efficiently:

pixi.toml - Multiple PyPI Indices
 1[project]
 2name = "multi-index-project"
 3channels = ["conda-forge"]
 4platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
 5
 6# Define multiple PyPI indices
 7[[project.pypi-indices]]
 8name = "pypi"
 9url = "https://pypi.org/simple"
10priority = "primary"  # Check PyPI first for public packages
11
12[[project.pypi-indices]]
13name = "cloudrepo"
14url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
15priority = "supplemental"  # Check for packages not on PyPI
16
17[[project.pypi-indices]]
18name = "cloudrepo-ml"  # Specialized ML package repository
19url = "https://[organization-id].mycloudrepo.io/repositories/[ml-repository-id]/simple"
20priority = "explicit"  # Only use when explicitly specified
21
22[pypi-dependencies]
23# From PyPI (primary index)
24numpy = ">=1.24.0"
25scipy = "*"
26
27# From CloudRepo (found via supplemental)
28company-core = ">=2.0.0"
29
30# Explicitly from specific index
31ml-toolkit = { version = ">=1.0.0", index = "cloudrepo-ml" }

Publishing Packages for Pixi

Building Python Packages

Create a standard Python package structure for publishing:

Package Directory Structure
my-package/
├── pyproject.toml      # Package configuration
├── pixi.toml          # Pixi environment configuration
├── src/
│   └── my_package/
│       ├── __init__.py
│       └── module.py
├── tests/
│   └── test_module.py
└── README.md

Configure your package’s pyproject.toml:

pyproject.toml - Package Configuration
 1[build-system]
 2requires = ["hatchling"]
 3build-backend = "hatchling.build"
 4
 5[project]
 6name = "my-package"
 7version = "1.0.0"
 8description = "Private package for our team"
 9authors = [{name = "Your Team", email = "team@example.com"}]
10requires-python = ">=3.8"
11dependencies = [
12    "requests>=2.28.0",
13]
14
15[project.optional-dependencies]
16dev = [
17    "pytest>=7.0.0",
18    "black>=22.0.0",
19]

Build the package:

Building Packages with Pixi
# Add build dependencies
pixi add --pypi build twine

# Build the package
pixi run python -m build

# This creates:
# dist/my_package-1.0.0-py3-none-any.whl
# dist/my_package-1.0.0.tar.gz

Publishing to CloudRepo

Upload your package to CloudRepo using twine:

Publishing to CloudRepo
# Configure .pypirc for CloudRepo
cat > ~/.pypirc << EOF
[distutils]
index-servers = cloudrepo

[cloudrepo]
repository = https://[organization-id].mycloudrepo.io/repositories/[repository-id]
username = [repository-user-email]
password = [repository-user-password]
EOF

# Upload the package
pixi run twine upload -r cloudrepo dist/*

# Or upload with inline credentials
pixi run twine upload \
  --repository-url https://[organization-id].mycloudrepo.io/repositories/[repository-id] \
  --username [repository-user-email] \
  --password [repository-user-password] \
  dist/*

Platform-Specific Packages

Build and publish platform-specific packages with binary extensions:

pixi.toml - Platform-Specific Build Configuration
 1[project]
 2name = "native-extension"
 3platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
 4
 5[dependencies]
 6python = "3.11.*"
 7cython = ">=3.0.0"
 8numpy = ">=1.24.0"
 9
10[tasks]
11build-extension = "python setup.py build_ext --inplace"
12build-wheel = { cmd = "python -m build --wheel", depends_on = ["build-extension"] }
13
14# Platform-specific build tasks
15[target.win-64.tasks]
16build-wheel = "python -m build --wheel --plat-name win_amd64"
17
18[target.linux-64.tasks]
19build-wheel = "python -m build --wheel --plat-name manylinux2014_x86_64"
20
21[target.osx-arm64.tasks]
22build-wheel = "python -m build --wheel --plat-name macosx_11_0_arm64"

Build for all platforms:

Multi-Platform Build Process
# Build for current platform
pixi run build-wheel

# Or use cibuildwheel for comprehensive platform support
pixi add --pypi cibuildwheel
pixi run cibuildwheel --platform linux

# Upload all platform wheels
pixi run twine upload -r cloudrepo dist/*.whl

Version Management

Manage package versions effectively:

Version Management with Pixi
# Install bump2version for version management
pixi add --pypi bump2version

# Configure version bumping in setup.cfg
cat > setup.cfg << EOF
[bumpversion]
current_version = 1.0.0
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
EOF

# Bump versions
pixi run bump2version patch  # 1.0.0 -> 1.0.1
pixi run bump2version minor  # 1.0.1 -> 1.1.0
pixi run bump2version major  # 1.1.0 -> 2.0.0

# Pre-release versions
pixi run bump2version --new-version 2.0.0-alpha.1 prerelease
pixi run bump2version --new-version 2.0.0-beta.1 prerelease
pixi run bump2version --new-version 2.0.0-rc.1 prerelease

Consuming Packages from CloudRepo

Adding Private Dependencies

Add CloudRepo packages to your Pixi project:

Adding Private Dependencies
# Add a private package from CloudRepo
pixi add --pypi my-private-package --index cloudrepo

# Add with version constraints
pixi add --pypi "my-private-package>=2.0.0,<3.0.0" --index cloudrepo

# Add to specific feature/environment
pixi add --pypi my-dev-tools --index cloudrepo --feature dev

Alternatively, manually edit pixi.toml:

pixi.toml - Private Dependencies
 1[pypi-dependencies]
 2# Simple private dependency
 3my-private-lib = { version = "*", index = "cloudrepo" }
 4
 5# With version constraints
 6company-framework = { version = ">=2.0,<3.0", index = "cloudrepo" }
 7
 8# With extras
 9ml-toolkit = { version = ">=1.0.0", extras = ["gpu", "viz"], index = "cloudrepo" }
10
11# Pre-release versions
12experimental-lib = { version = ">=1.0.0a1", index = "cloudrepo" }

Mixing Public and Private Indices

Efficiently combine packages from multiple sources:

pixi.toml - Mixed Dependencies Configuration
 1[project]
 2name = "mixed-dependencies"
 3channels = ["conda-forge", "pytorch"]
 4platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"]
 5
 6# Conda dependencies (from conda-forge/pytorch)
 7[dependencies]
 8python = "3.11.*"
 9pytorch = ">=2.0.0"
10cudatoolkit = "11.8.*"  # Platform-specific, managed by conda
11
12# PyPI dependencies
13[pypi-dependencies]
14# Public packages (from PyPI)
15transformers = ">=4.30.0"
16datasets = "*"
17
18# Private packages (from CloudRepo)
19company-ml-utils = { version = ">=2.0.0", index = "cloudrepo" }
20internal-datasets = { version = "*", index = "cloudrepo" }
21
22# Mixed - public package with private plugin
23fastapi = ">=0.100.0"  # From PyPI
24fastapi-company-auth = { version = ">=1.0.0", index = "cloudrepo" }  # Private auth plugin

Lock File Management

Pixi automatically manages lock files for reproducible environments:

Lock File Management
# Install dependencies and create/update lock file
pixi install

# Update all dependencies to latest compatible versions
pixi update

# Update specific packages only
pixi update numpy pandas my-private-package

# Show current lock file status
pixi list

# Clean and regenerate lock file
pixi clean
pixi install

The pixi.lock file ensures all team members and CI/CD systems get identical dependencies:

pixi.lock Structure (Example)
 1version: 4
 2environments:
 3  default:
 4    channels:
 5      - conda-forge
 6    packages:
 7      linux-64:
 8        - python: 3.11.0
 9        - numpy: 1.24.0
10    pypi:
11      - my-private-package:
12          version: 2.1.0
13          index: cloudrepo
14          hash: sha256:abc123...

Note

Always commit pixi.lock to version control for reproducible builds.

Environment Specifications

Define multiple environments for different use cases:

pixi.toml - Multiple Environments
 1[project]
 2name = "multi-env-project"
 3channels = ["conda-forge"]
 4platforms = ["linux-64", "win-64", "osx-64"]
 5
 6# Default environment dependencies
 7[dependencies]
 8python = "3.11.*"
 9
10[pypi-dependencies]
11requests = "*"
12my-core-lib = { version = ">=1.0.0", index = "cloudrepo" }
13
14# Development environment
15[feature.dev.dependencies]
16pytest = ">=7.0.0"
17black = ">=22.0.0"
18
19[feature.dev.pypi-dependencies]
20my-test-utils = { version = "*", index = "cloudrepo" }
21pytest-cov = "*"
22
23# Production environment
24[feature.prod.dependencies]
25gunicorn = "*"
26
27[feature.prod.pypi-dependencies]
28my-prod-monitor = { version = ">=2.0.0", index = "cloudrepo" }
29
30# Data science environment
31[feature.datascience.dependencies]
32jupyter = "*"
33scikit-learn = "*"
34
35[feature.datascience.pypi-dependencies]
36company-ml-lib = { version = ">=3.0.0", index = "cloudrepo" }
37
38# Define environment combinations
39[environments]
40dev = ["dev"]
41prod = ["prod"]
42datascience = ["dev", "datascience"]

Activate and use environments:

Working with Environments
# Install default environment
pixi install

# Install specific environment
pixi install -e dev
pixi install -e prod
pixi install -e datascience

# Run commands in specific environment
pixi run -e dev pytest
pixi run -e prod gunicorn app:main
pixi run -e datascience jupyter notebook

# Shell into environment
pixi shell -e dev

Advanced Topics

Multi-Project Workspaces

Manage multiple related projects in a workspace:

Workspace Directory Structure
my-workspace/
├── pixi.toml           # Workspace configuration
├── pixi.lock
├── packages/
│   ├── core-lib/
│   │   ├── pyproject.toml
│   │   └── src/
│   ├── web-api/
│   │   ├── pyproject.toml
│   │   └── src/
│   └── cli-tool/
│       ├── pyproject.toml
│       └── src/
└── apps/
    ├── frontend/
    └── backend/

Workspace pixi.toml configuration:

Workspace pixi.toml
 1[workspace]
 2name = "my-workspace"
 3channels = ["conda-forge"]
 4platforms = ["linux-64", "win-64", "osx-64"]
 5
 6# Workspace members
 7members = [
 8    "packages/core-lib",
 9    "packages/web-api",
10    "packages/cli-tool",
11]
12
13# Shared dependencies across workspace
14[dependencies]
15python = "3.11.*"
16
17[[pypi-indices]]
18name = "cloudrepo"
19url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
20
21# Workspace-wide tasks
22[tasks]
23test-all = "pytest packages/*/tests"
24build-all = "python -m build packages/*"
25publish-all = """
26for pkg in packages/*; do
27    cd $pkg && pixi run twine upload -r cloudrepo dist/*
28    cd ../..
29done
30"""

Cross-Platform Builds

Configure platform-specific dependencies and builds:

pixi.toml - Cross-Platform Configuration
 1[project]
 2name = "cross-platform-app"
 3platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"]
 4
 5# Shared dependencies
 6[dependencies]
 7python = "3.11.*"
 8
 9# Platform-specific dependencies
10[target.linux-64.dependencies]
11gtk = "*"  # Linux-only GUI toolkit
12
13[target.win-64.dependencies]
14pywin32 = "*"  # Windows-specific APIs
15
16[target.osx-64.dependencies]
17pyobjc = "*"  # macOS framework bindings
18
19[target.osx-arm64.dependencies]
20pyobjc = "*"
21tensorflow-metal = "*"  # Apple Silicon acceleration
22
23# Platform-specific PyPI packages from CloudRepo
24[target.linux-64.pypi-dependencies]
25company-linux-drivers = { version = "*", index = "cloudrepo" }
26
27[target.win-64.pypi-dependencies]
28company-windows-utils = { version = "*", index = "cloudrepo" }
29
30# Platform-specific build tasks
31[target.linux-64.tasks]
32build = "gcc -shared -fPIC -o lib.so src/native.c"
33
34[target.win-64.tasks]
35build = "cl /LD src\\native.c /Fe:lib.dll"
36
37[target.osx-64.tasks]
38build = "clang -shared -o lib.dylib src/native.c"

Build for all platforms:

Cross-Platform Build Commands
# Install for current platform
pixi install

# Build for all platforms using CI
for platform in linux-64 win-64 osx-64 osx-arm64; do
    pixi install --platform $platform
    pixi run --platform $platform build
done

Conda Integration Alongside PyPI

Leverage both conda and PyPI packages effectively:

pixi.toml - Conda and PyPI Integration
 1[project]
 2name = "scientific-computing"
 3channels = ["conda-forge", "bioconda", "pytorch"]
 4platforms = ["linux-64", "osx-64"]
 5
 6# Complex binary dependencies from conda
 7[dependencies]
 8python = "3.11.*"
 9numpy = ">=1.24.0"  # Optimized builds from conda
10scipy = "*"
11pytorch = ">=2.0.0"
12cudatoolkit = "11.8.*"
13mkl = "*"  # Intel Math Kernel Library
14gdal = "*"  # Geospatial libraries
15r-base = ">=4.0"  # R language support
16
17# Python-only packages from PyPI/CloudRepo
18[pypi-dependencies]
19# Public PyPI packages
20pandas = ">=2.0.0"
21scikit-learn = "*"
22
23# Private CloudRepo packages
24company-ml-models = { version = ">=3.0.0", index = "cloudrepo" }
25internal-bio-tools = { version = "*", index = "cloudrepo" }
26
27# Use conda for system dependencies, PyPI for Python packages
28[feature.bioinfo.dependencies]
29blast = "*"  # NCBI BLAST from bioconda
30samtools = "*"
31bedtools = "*"
32
33[feature.bioinfo.pypi-dependencies]
34biopython = "*"
35company-genomics = { version = ">=1.0.0", index = "cloudrepo" }

Task Runners and Scripts

Define reusable tasks in your Pixi configuration:

pixi.toml - Task Configuration
 1[project]
 2name = "task-runner-example"
 3
 4[tasks]
 5# Simple tasks
 6test = "pytest tests/"
 7lint = "ruff check src/"
 8format = "black src/ tests/"
 9
10# Complex multi-step tasks
11ci = { depends_on = ["lint", "test", "build"] }
12
13# Tasks with arguments
14test-verbose = "pytest -vvs tests/"
15test-coverage = "pytest --cov=src --cov-report=html"
16
17# Shell scripts
18deploy = """
19echo "Building package..."
20python -m build
21echo "Uploading to CloudRepo..."
22twine upload -r cloudrepo dist/*
23echo "Deployment complete!"
24"""
25
26# Python scripts
27process-data = { cmd = "python scripts/process.py", inputs = ["data/*.csv"], outputs = ["processed/"] }
28
29# Platform-specific tasks
30[target.linux-64.tasks]
31system-info = "uname -a && lscpu"
32
33[target.win-64.tasks]
34system-info = "systeminfo"
35
36# Environment-specific tasks
37[feature.dev.tasks]
38watch = "watchdog src/ --command='pixi run test'"
39debug = "python -m pdb src/main.py"
40
41[feature.prod.tasks]
42start-server = "gunicorn app:main --bind 0.0.0.0:8000"
43health-check = "curl http://localhost:8000/health"

Execute tasks:

Running Pixi Tasks
# Run single task
pixi run test
pixi run lint

# Run task with dependencies
pixi run ci  # Runs lint, test, and build in order

# Run environment-specific task
pixi run -e dev watch
pixi run -e prod start-server

# Pass arguments to tasks
pixi run test -- --maxfail=1
pixi run python -- script.py --arg value

Features and Environments

Create flexible feature combinations:

pixi.toml - Advanced Features Configuration
 1[project]
 2name = "feature-example"
 3
 4# Base dependencies
 5[dependencies]
 6python = "3.11.*"
 7
 8[pypi-dependencies]
 9core-lib = { version = ">=1.0.0", index = "cloudrepo" }
10
11# Testing feature
12[feature.test.dependencies]
13pytest = ">=7.0.0"
14
15[feature.test.pypi-dependencies]
16pytest-cov = "*"
17test-fixtures = { version = "*", index = "cloudrepo" }
18
19[feature.test.tasks]
20test = "pytest"
21test-ci = "pytest --junitxml=report.xml"
22
23# Documentation feature
24[feature.docs.dependencies]
25sphinx = ">=5.0.0"
26
27[feature.docs.pypi-dependencies]
28company-sphinx-theme = { version = ">=1.0.0", index = "cloudrepo" }
29
30[feature.docs.tasks]
31build-docs = "sphinx-build docs/ docs/_build"
32serve-docs = "python -m http.server --directory docs/_build"
33
34# GPU feature
35[feature.gpu.dependencies]
36cuda = "11.8.*"
37cudnn = "8.9.*"
38
39[feature.gpu.pypi-dependencies]
40torch = { version = ">=2.0.0", index = "pytorch" }
41company-gpu-utils = { version = "*", index = "cloudrepo" }
42
43# CPU-only feature (mutual exclusive with gpu)
44[feature.cpu.pypi-dependencies]
45torch = { version = ">=2.0.0+cpu", index = "pytorch-cpu" }
46
47# Define environment combinations
48[environments]
49default = []
50test = ["test"]
51docs = ["docs"]
52dev = ["test", "docs"]
53gpu-dev = ["test", "gpu"]
54cpu-dev = ["test", "cpu"]
55prod-gpu = ["gpu"]
56prod-cpu = ["cpu"]

Use different feature combinations:

Working with Features
# Install specific environment
pixi install -e gpu-dev
pixi install -e cpu-dev

# Run in specific environment
pixi run -e gpu-dev python train_model.py
pixi run -e docs build-docs

# List available environments
pixi info

# Clean specific environment
pixi clean -e test

CI/CD Integration

GitHub Actions

.github/workflows/pixi-package.yml
  1name: Pixi Package CI/CD
  2
  3on:
  4  push:
  5    branches: [main, develop]
  6  pull_request:
  7    branches: [main]
  8  release:
  9    types: [published]
 10
 11jobs:
 12  test:
 13    strategy:
 14      matrix:
 15        os: [ubuntu-latest, windows-latest, macos-latest]
 16        python: ["3.9", "3.10", "3.11"]
 17
 18    runs-on: ${{ matrix.os }}
 19
 20    steps:
 21    - uses: actions/checkout@v4
 22
 23    - name: Setup Pixi
 24      uses: prefix-dev/setup-pixi@v0.4.0
 25      with:
 26        pixi-version: latest
 27        cache: true
 28        cache-dependency-path: pixi.lock
 29
 30    - name: Configure CloudRepo Authentication
 31      env:
 32        PIXI_PYPI_USERNAME_CLOUDREPO: ${{ secrets.CLOUDREPO_USERNAME }}
 33        PIXI_PYPI_PASSWORD_CLOUDREPO: ${{ secrets.CLOUDREPO_PASSWORD }}
 34      run: |
 35        echo "CloudRepo authentication configured via environment variables"
 36
 37    - name: Install Dependencies
 38      run: pixi install -e test
 39
 40    - name: Run Tests
 41      run: pixi run -e test test-ci
 42
 43    - name: Upload Test Results
 44      uses: actions/upload-artifact@v3
 45      if: always()
 46      with:
 47        name: test-results-${{ matrix.os }}-${{ matrix.python }}
 48        path: report.xml
 49
 50  build:
 51    needs: test
 52    runs-on: ubuntu-latest
 53
 54    steps:
 55    - uses: actions/checkout@v4
 56
 57    - name: Setup Pixi
 58      uses: prefix-dev/setup-pixi@v0.4.0
 59      with:
 60        pixi-version: latest
 61
 62    - name: Build Package
 63      run: |
 64        pixi run python -m build
 65
 66    - name: Upload Build Artifacts
 67      uses: actions/upload-artifact@v3
 68      with:
 69        name: dist
 70        path: dist/
 71
 72  publish:
 73    needs: build
 74    runs-on: ubuntu-latest
 75    if: github.event_name == 'release'
 76
 77    steps:
 78    - uses: actions/checkout@v4
 79
 80    - name: Download Build Artifacts
 81      uses: actions/download-artifact@v3
 82      with:
 83        name: dist
 84        path: dist/
 85
 86    - name: Setup Pixi
 87      uses: prefix-dev/setup-pixi@v0.4.0
 88
 89    - name: Configure PyPI Publishing
 90      run: |
 91        cat > ~/.pypirc << EOF
 92        [distutils]
 93        index-servers = cloudrepo
 94
 95        [cloudrepo]
 96        repository = https://${{ secrets.CLOUDREPO_ORG }}.mycloudrepo.io/repositories/${{ secrets.CLOUDREPO_REPO }}
 97        username = ${{ secrets.CLOUDREPO_USERNAME }}
 98        password = ${{ secrets.CLOUDREPO_PASSWORD }}
 99        EOF
100
101    - name: Publish to CloudRepo
102      run: |
103        pixi add --pypi twine
104        pixi run twine upload -r cloudrepo dist/*

GitLab CI

.gitlab-ci.yml
 1stages:
 2  - test
 3  - build
 4  - publish
 5
 6variables:
 7  PIXI_PYPI_USERNAME_CLOUDREPO: ${CLOUDREPO_USERNAME}
 8  PIXI_PYPI_PASSWORD_CLOUDREPO: ${CLOUDREPO_PASSWORD}
 9  PIXI_CACHE_DIR: ${CI_PROJECT_DIR}/.pixi_cache
10
11default:
12  image: ghcr.io/prefix-dev/pixi:latest
13  cache:
14    key: ${CI_COMMIT_REF_SLUG}
15    paths:
16      - .pixi_cache/
17      - .pixi/
18
19test:linux:
20  stage: test
21  script:
22    - pixi install -e test
23    - pixi run -e test test-ci
24  artifacts:
25    when: always
26    reports:
27      junit: report.xml
28
29test:windows:
30  stage: test
31  tags:
32    - windows
33  script:
34    - pixi install -e test
35    - pixi run -e test test-ci
36
37build:
38  stage: build
39  script:
40    - pixi install
41    - pixi run python -m build
42  artifacts:
43    paths:
44      - dist/
45    expire_in: 1 week
46
47publish:
48  stage: publish
49  only:
50    - tags
51  dependencies:
52    - build
53  script:
54    - pixi add --pypi twine
55    - |
56      cat > ~/.pypirc << EOF
57      [distutils]
58      index-servers = cloudrepo
59
60      [cloudrepo]
61      repository = ${CLOUDREPO_URL}
62      username = ${CLOUDREPO_USERNAME}
63      password = ${CLOUDREPO_PASSWORD}
64      EOF
65    - pixi run twine upload -r cloudrepo dist/*

Azure DevOps

azure-pipelines.yml
  1trigger:
  2  branches:
  3    include:
  4      - main
  5      - develop
  6  tags:
  7    include:
  8      - v*
  9
 10pool:
 11  vmImage: 'ubuntu-latest'
 12
 13variables:
 14  PIXI_PYPI_USERNAME_CLOUDREPO: $(CloudRepoUsername)
 15  PIXI_PYPI_PASSWORD_CLOUDREPO: $(CloudRepoPassword)
 16
 17stages:
 18- stage: Test
 19  jobs:
 20  - job: TestMatrix
 21    strategy:
 22      matrix:
 23        Linux_Python39:
 24          imageName: 'ubuntu-latest'
 25          pythonVersion: '3.9'
 26        Windows_Python311:
 27          imageName: 'windows-latest'
 28          pythonVersion: '3.11'
 29        macOS_Python310:
 30          imageName: 'macOS-latest'
 31          pythonVersion: '3.10'
 32    pool:
 33      vmImage: $(imageName)
 34    steps:
 35    - task: UsePythonVersion@0
 36      inputs:
 37        versionSpec: '$(pythonVersion)'
 38
 39    - script: |
 40        curl -fsSL https://pixi.sh/install.sh | bash
 41        echo "##vso[task.prependpath]$HOME/.pixi/bin"
 42      displayName: 'Install Pixi'
 43      condition: ne(variables['Agent.OS'], 'Windows_NT')
 44
 45    - pwsh: |
 46        iwr -useb https://pixi.sh/install.ps1 | iex
 47        echo "##vso[task.prependpath]$env:USERPROFILE\.pixi\bin"
 48      displayName: 'Install Pixi (Windows)'
 49      condition: eq(variables['Agent.OS'], 'Windows_NT')
 50
 51    - script: |
 52        pixi install -e test
 53        pixi run -e test test-ci
 54      displayName: 'Run Tests'
 55
 56    - task: PublishTestResults@2
 57      inputs:
 58        testResultsFiles: 'report.xml'
 59        testRunTitle: 'Python $(pythonVersion) - $(Agent.OS)'
 60      condition: always()
 61
 62- stage: Build
 63  dependsOn: Test
 64  jobs:
 65  - job: BuildPackage
 66    steps:
 67    - script: |
 68        curl -fsSL https://pixi.sh/install.sh | bash
 69        export PATH="$HOME/.pixi/bin:$PATH"
 70        pixi install
 71        pixi run python -m build
 72      displayName: 'Build Package'
 73
 74    - task: PublishPipelineArtifact@1
 75      inputs:
 76        targetPath: 'dist'
 77        artifactName: 'packages'
 78
 79- stage: Publish
 80  dependsOn: Build
 81  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
 82  jobs:
 83  - job: PublishToCloudRepo
 84    steps:
 85    - task: DownloadPipelineArtifact@2
 86      inputs:
 87        artifactName: 'packages'
 88        targetPath: 'dist'
 89
 90    - script: |
 91        curl -fsSL https://pixi.sh/install.sh | bash
 92        export PATH="$HOME/.pixi/bin:$PATH"
 93        pixi add --pypi twine
 94
 95        cat > ~/.pypirc << EOF
 96        [distutils]
 97        index-servers = cloudrepo
 98
 99        [cloudrepo]
100        repository = $(CloudRepoUrl)
101        username = $(CloudRepoUsername)
102        password = $(CloudRepoPassword)
103        EOF
104
105        pixi run twine upload -r cloudrepo dist/*
106      displayName: 'Publish to CloudRepo'

Troubleshooting

Common Issues and Solutions

Authentication Failures

Debugging Authentication Issues
# Check environment variables
env | grep PIXI_PYPI

# Test authentication directly
curl -u [email]:[password] \
  https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple/

# Clear Pixi cache and retry
pixi clean
pixi install

# Use verbose mode for debugging
PIXI_VERBOSITY=3 pixi install

SSL/TLS Certificate Issues

Resolving SSL Issues
# For self-signed certificates (development only)
export PIXI_SSL_NO_VERIFY=true

# Add corporate CA certificate
export SSL_CERT_FILE=/path/to/ca-bundle.crt
export REQUESTS_CA_BUNDLE=/path/to/ca-bundle.crt

# Configure git for corporate certificates
git config --global http.sslCAInfo /path/to/ca-bundle.crt

Package Resolution Conflicts

Debugging Package Conflicts
# Show detailed solver information
PIXI_VERBOSITY=3 pixi install

# Clean all caches and reinstall
pixi clean --all
rm pixi.lock
pixi install

# Show dependency tree
pixi list --explicit

# Update specific packages only
pixi update numpy pandas

# Force reinstall
pixi install --force-reinstall

Platform-Specific Issues

Platform-Specific Debugging
# Check current platform
pixi info

# Install for specific platform
pixi install --platform linux-64

# List platform-specific packages
pixi list --platform win-64

# Clear platform-specific cache
pixi clean --platform osx-arm64

Index Priority Issues

Fixing Index Priority Problems
# Ensure correct priority order
[[project.pypi-indices]]
name = "cloudrepo"
url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
priority = "primary"  # Check CloudRepo first

[[project.pypi-indices]]
name = "pypi"
url = "https://pypi.org/simple"
priority = "supplemental"  # Fallback to PyPI

Lock File Corruption

Fixing Lock File Issues
# Backup current lock file
cp pixi.lock pixi.lock.backup

# Remove and regenerate
rm pixi.lock
pixi install

# Compare with backup if needed
diff pixi.lock pixi.lock.backup

# Update lock without installing
pixi lock

Slow Package Downloads

Improving Download Performance
# Use parallel downloads
export PIXI_MAX_WORKERS=10

# Configure timeout
export PIXI_REQUEST_TIMEOUT=60

# Use local cache server (if available)
export PIP_INDEX_URL=http://local-cache:8080/simple
export PIP_TRUSTED_HOST=local-cache

# Pre-download packages for offline use
pixi install --frozen
pixi list --json > packages.json

Best Practices

  1. Version Control: Always commit both pixi.toml and pixi.lock files

  2. Environment Isolation: Use features and environments for different contexts

  3. Security: Never commit credentials; use environment variables or keyring

  4. Cross-Platform: Test on all target platforms before releasing

  5. Caching: Leverage Pixi’s caching in CI/CD for faster builds

  6. Documentation: Document custom indices and authentication in README

  7. Updates: Regularly update dependencies with pixi update

  8. Reproducibility: Use pixi install --frozen in production

Performance Tips

  1. Index Configuration: Place CloudRepo as primary index if most packages are private

  2. Parallel Installation: Enable with PIXI_MAX_WORKERS environment variable

  3. Cache Management: Use pixi clean periodically to manage disk space

  4. Minimal Dependencies: Use features to avoid installing unnecessary packages

  5. Platform-Specific Builds: Build native extensions per platform for best performance

Getting Help

If you encounter issues not covered in this documentation:

  1. Check the Pixi documentation

  2. Review CloudRepo’s Knowledge Base

  3. Visit the Pixi Discord community

  4. Contact CloudRepo support at support@cloudrepo.io

CloudRepo support is included with all plans - we typically respond within a few business hours and are here to help you succeed with your cross-platform package management.

See also