rules_python
  • Python Rules for Bazel
  • Getting started
  • Using PyPI
    • Lock
    • Download (bzlmod)
    • Download (WORKSPACE)
    • Use in BUILD.bazel files
    • Advanced topics
      • Circular dependencies
      • Patching wheels
      • How-to: Multi-Platform PyPI Dependencies
  • Toolchains
  • Setting up coverage
  • Precompiling
  • Gazelle Plugin
  • REPL
  • Extending
  • How-to Guides
  • Contributing
  • Dev Guide
  • Support Policy
  • Changelog
  • API Reference
  • Environment Variables
  • Sphinxdocs
  • Glossary
  • Index
rules_python
  • Using PyPI
  • Edit on GitHub

Using PyPI

Using PyPI packages (aka “pip install”) involves the following main steps:

  1. Generating requirements file

  2. Installing third-party packages in bzlmod or WORKSPACE.

  3. Using third-party packages as dependencies

With the advanced topics covered separately:

  • Dealing with circular dependencies.

  • Handling multi-platform dependencies.

  • Lock
    • requirements.txt
      • pip compile
        • pip compile Dependency groups
      • uv pip compile (bzlmod only)
  • Download (bzlmod)
    • Interpreter selection
    • Requirements for a specific OS/Architecture
    • Multi-platform support
      • Using download_only attribute
      • Customizing Requires-Dist resolution
      • Bazel downloader and multi-platform wheel hub repository.
    • Internal dependencies and private repositories
      • How the config is parsed:
      • References:
    • Credential Helper
  • Download (WORKSPACE)
    • Interpreter selection
    • Requirements for a specific OS/Architecture
    • Vendoring the requirements.bzl file
  • Use in BUILD.bazel files
    • Entry points
    • ‘Extras’ dependencies
    • Consuming Wheel Dists Directly
    • Creating a filegroup of files within a whl
    • A note about using the requirement helper

Advanced topics

  • Circular dependencies
  • Patching wheels
  • How-to: Multi-Platform PyPI Dependencies
Previous Next

© Copyright 2023, The Bazel Authors. Revision eef6df6d5e533c87437ebcd61f14ce0961306feb.

Built with Sphinx using a theme provided by Read the Docs.