Skip to main content

Vendor synchronization tool.

Project description

splurge-vendor-sync

PyPI version Python versions License: MIT

CI Coverage Ruff mypy

Docs

A powerful CLI tool for one-way vendor synchronization of Python libraries and applications. Automatically synchronize internal package dependencies into your project's vendor directory with selective file filtering and automatic cleanup.

Features

  • One-way synchronization: Clean removal and fresh copy of vendor packages
  • Selective file filtering: Include only the file types you need (default: .py, .json, .yml, .yaml, .ini)
  • Automatic cleanup: Removes outdated vendor files before syncing new ones
  • Exclusion support: Automatically excludes __pycache__ and other build artifacts
  • Version scanning: Scan vendored packages to extract version information with --scan
    • Recursive nested vendor discovery: Detects transitive vendor dependencies at any depth
    • Hierarchical output: Shows parent-child relationships between vendored packages
    • Custom version tags: Search for __version__ or custom version variable names
  • Cross-platform: Works on Windows, Linux, and macOS
  • Safe I/O: Uses deterministic newline normalization and secure path validation
  • Clear error reporting: Domain-based exception hierarchy with actionable error messages

Quick Start

Installation

# From source
pip install -e .

# Or after packaging
pip install splurge-vendor-sync

Basic Usage

Synchronize a source package to your project's vendor directory:

splurge-vendor-sync \
  --source /path/to/splurge-vendor-sync \
  --package splurge_exceptions \
  --target /path/to/my-project/my_project

This will:

  1. Remove all existing files from /path/to/my-project/my_project/_vendor/splurge_exceptions/
  2. Copy all .py, .json, .yml, .yaml, .ini files from the source package
  3. Preserve the directory structure
  4. Exclude __pycache__ directories

With Custom Extensions

splurge-vendor-sync \
  --source /path/to/splurge-vendor-sync \
  --package splurge_exceptions \
  --target /path/to/my-project/my_project \
  --ext "py;json;yaml"

With Custom Vendor Directory

splurge-vendor-sync \
  --source /path/to/splurge-vendor-sync \
  --package splurge_exceptions \
  --target /path/to/my-project/my_project \
  --vendor "_vendored"

Scan Vendored Packages

# Scan for __version__ in all vendored packages (including nested vendors)
splurge-vendor-sync \
  --target /path/to/my-project/my_project \
  --scan

# Scan with custom version tag
splurge-vendor-sync \
  --target /path/to/my-project/my_project \
  --scan MY_VERSION

# Scan with custom vendor directory
splurge-vendor-sync \
  --target /path/to/my-project/my_project \
  --vendor custom_vendor \
  --scan

Scan Output with Nested Vendors:

The scanner displays hierarchical relationships when vendors are nested:

library-a 1.0.0
  library-b 2.0.0
    library-f 3.0.0
    library-g 4.0.0

This shows that library-b is vendored under library-a, and both library-f and library-g are vendored under library-b.

Documentation

  • CLI Reference: Complete command-line interface documentation with examples
  • API Reference: Complete Python API reference for programmatic use
  • Features & Errors: Comprehensive guide to features, error handling, and troubleshooting

Exit Codes

  • 0: Synchronization completed successfully
  • 1: Runtime error (I/O failure, permission denied, etc.)
  • 2: Validation error (invalid paths, missing arguments, etc.)

Common Scenarios

Sync after updating source package

# Re-run the same command - old files are automatically removed
splurge-vendor-sync \
  --source /path/to/splurge-vendor-sync \
  --package splurge_exceptions \
  --target /path/to/my-project/my_project

Sync multiple packages

# Create a script to sync all your vendored dependencies
splurge-vendor-sync --source /path/to/splurge-vendor-sync --package splurge_exceptions --target /path/to/my-project/my_project
splurge-vendor-sync --source /path/to/splurge-safe-io --package splurge_safe_io --target /path/to/my-project/my_project

Troubleshooting

Q: "File not found" error
A: Verify the --source and --target paths exist and the --package directory name is correct.

Q: "Permission denied" error
A: Ensure you have write permissions to the target directory.

Q: Files not being copied
A: Check that the file extensions match your --ext parameter (default: py;json;yml;yaml;ini)

For more help, see Features & Errors.

Development

Running Tests

pytest tests/
pytest --cov=splurge_vendor_sync tests/

Code Quality

ruff .
mypy .

License

See LICENSE for details.

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

splurge_vendor_sync-2025.1.3.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

splurge_vendor_sync-2025.1.3-py3-none-any.whl (57.0 kB view details)

Uploaded Python 3

File details

Details for the file splurge_vendor_sync-2025.1.3.tar.gz.

File metadata

  • Download URL: splurge_vendor_sync-2025.1.3.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for splurge_vendor_sync-2025.1.3.tar.gz
Algorithm Hash digest
SHA256 0b8247f75f9c1ae8ca4f36e4f54a40cf0de2099a27c8ebd0b64abf3ba2141bd1
MD5 b488a41e0b0d9c5970c2f6d4c562cc28
BLAKE2b-256 5d5837e52d208a72f68afef5ea4a66ec96b1da0545f4e88b80fa7f3579af64de

See more details on using hashes here.

File details

Details for the file splurge_vendor_sync-2025.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for splurge_vendor_sync-2025.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 52fd2d059a1008efe3dc0b21ceb13f548908efab41478d2ac762bf8738834cf2
MD5 86d1d859e8580f8a207b857dc5cef88c
BLAKE2b-256 0e756f6e346b35b84544ca8be3bc332b81dfcc5e28db6e84d6453a82b79a8c3f

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