Skip to main content

Vendor internal packages from private PyPI for offline production deployments

Project description

Poetry Vendor Plugin

PyPI version Python versions

Vendor internal packages from private PyPI repositories for offline/air-gapped production deployments.

The Problem

You have internal Python packages hosted on a PyPI server inside your company LAN. Development machines can reach it, but production servers cannot (either air-gapped or on a different network). You need a way to bundle those internal packages as wheels into your project so production can install them without network access.

The Solution

This plugin adds poetry vendor pull — a command that downloads your configured internal packages as wheels into a vendor/ directory. You commit those wheels, and production installs from them using Poetry path dependencies.

Installation

Poetry plugins are installed into Poetry's own environment:

poetry self add poetry-vendor-plugin

Verify the plugin is loaded:

poetry self show plugins

Example

See the example/ directory for a complete, runnable project that configures one private PyPI server and two vendored packages.

Usage

1. Configure vendor packages in your project

You can edit pyproject.toml directly, or use the convenience commands:

# Register a private PyPI server
poetry vendor add-server https://internal-pypi.company.local/simple/ internal

# Register a plain-HTTP server as trusted
poetry vendor add-server http://192.168.1.10/simple/ internal --trusted

# Add a package from that server
poetry vendor add my-build-tools --server internal --constraint "^1.0.0"

The equivalent manual configuration looks like this:

[tool.vendor]
vendor-dir = "vendor"

[tool.vendor.server]
internal = "https://internal-pypi.company.local/simple/"

[tool.vendor.packages.internal]
my-build-tools = "^1.0.0"
my-ui-elements = ">=2.0.0,<3.0.0"

2. Pull vendor packages

poetry vendor pull

This downloads wheels to vendor/ with their original versioned filenames:

vendor/
├── my_build_tools-1.2.0-py3-none-any.whl
├── my_ui_elements-2.1.0-py2.py3-none-any.whl
└── vendor.lock

vendor.lock records the resolved version and the actual wheel filename. Commit both the wheels and the lock file.

3. Use path dependencies in production

In your pyproject.toml, add path dependencies for the vendored wheels:

[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31"
my-build-tools = { path = "vendor/my_build_tools-1.2.0-py3-none-any.whl" }
my-ui-elements = { path = "vendor/my_ui_elements-2.1.0-py2.py3-none-any.whl" }

After each poetry vendor pull or poetry vendor update, the plugin automatically updates these path dependencies to the current wheel filenames in pyproject.toml.

4. List vendored packages

poetry vendor list

5. Update vendor packages

poetry vendor update          # Update all
poetry vendor update -p my-build-tools  # Update specific package

Commands

Command Description
poetry vendor add-server <url> <name> Register a PyPI server in pyproject.toml
poetry vendor add-server <url> <name> --trusted Register a server and mark its host as trusted
poetry vendor add <package> --server <name> Add a package, download it, and add a path dependency
poetry vendor add <package> --server <name> --constraint <spec> Add a package with a specific version specifier
poetry vendor pull Download vendor packages to vendor/
poetry vendor pull --force Re-download even if already present
poetry vendor pull --dry-run Preview what would be downloaded
poetry vendor list Show all vendored packages with sizes
poetry vendor update Force re-download all packages

Configuration Reference

[tool.vendor]
vendor-dir = "vendor"  # Directory for vendored wheels (default: "vendor")

# Optional: list hosts that should be trusted when using plain HTTP indexes.
# Pip ignores HTTP indexes by default unless the host is marked as trusted.
trusted-hosts = ["internal-pypi.local"]

[tool.vendor.server]
server1 = "https://..."  # Named private PyPI index URL

[tool.vendor.packages.server1]
package-name = "^1.0.0"  # Package name and PEP 440 version specifier

You can define multiple servers and group packages under the server they come from:

[tool.vendor.server]
internal = "https://internal-pypi.company.local/simple/"
legacy = "https://legacy-pypi.company.local/simple/"

[tool.vendor.packages.internal]
my-build-tools = "^1.0.0"

[tool.vendor.packages.legacy]
old-ui-elements = ">=1.0.0,<2.0.0"

Lock File

After running poetry vendor pull, a <vendor-dir>/vendor.lock file is created. It tracks the resolved version, source, and requested version specifier for each package. Commit this file alongside the wheels so that poetry vendor list can show accurate version information and so updates behave predictably across machines.

Requirements

  • Python 3.9+
  • Poetry 2.0+

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_vendor_plugin-0.4.2.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_vendor_plugin-0.4.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file poetry_vendor_plugin-0.4.2.tar.gz.

File metadata

  • Download URL: poetry_vendor_plugin-0.4.2.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for poetry_vendor_plugin-0.4.2.tar.gz
Algorithm Hash digest
SHA256 4a43bfa6eed6732cb3306ea897ecc6419727da8e22c8eb2ef95420d9a78ae003
MD5 f9e3b40cfc48f1ec43a4b7d5c16bb245
BLAKE2b-256 504c89eac26d1380d0e5588b8c66a729ee810ad9411800e3b7f3190279698f3e

See more details on using hashes here.

File details

Details for the file poetry_vendor_plugin-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: poetry_vendor_plugin-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for poetry_vendor_plugin-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9012530293206085105c075fcdcdff9af3868119a44b04a27c56a3374863f906
MD5 81e6889c89b86361f55aa22c5dd54f66
BLAKE2b-256 98c4a0c4030b5dc1b16ca53a249dd264a26d5f886efd4d000676204c775faf6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page