Skip to main content

Tools to manage (uv) environemnts programmatically.

Project description

DepKit

PyPI License Package status Daily downloads Weekly downloads Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Discussions Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this week Github commits this month Github commits this year Package status Code style: black PyUp

DependencyManager

A flexible Python dependency manager that handles runtime dependencies, script imports, and supports both pip and uv package installers.

Features

  • PEP 723 dependency declaration support
  • Automatic dependency installation
  • Support for both pip and uv package managers
  • Custom pip index URL support
  • Temporary script importing
  • Path management for imports
  • Async context manager interface

Installation

pip install depkit

Basic Usage

from depkit import DependencyManager

# Simple dependency management
async with DependencyManager(
    requirements=["requests>=2.31.0", "pandas"],
    prefer_uv=True  # Use uv if available
) as manager:
    # Dependencies are installed and ready to use
    import requests
    import pandas

Working with Scripts

The DependencyManager can handle scripts with PEP 723 dependency declarations:

# example_script.py
# /// script
# dependencies = [
#   "requests>=2.31.0",
#   "pandas>=2.0.0"
# ]
# requires-python = ">=3.12"
# ///

import requests
import pandas as pd

Load and use the script:

async with DependencyManager(
    scripts=["path/to/example_script.py"],
    extra_paths=["."]  # Add paths to Python's import path
) as manager:
    # Script's dependencies are installed automatically
    from example_script import some_function

Configuration Options

DependencyManager(
    prefer_uv: bool = False,          # Prefer uv over pip if available
    requirements: list[str] = None,   # List of PEP 508 requirement specifiers
    extra_paths: list[str] = None,    # Additional Python import paths
    scripts: list[str] = None,        # Scripts to load and process
    pip_index_url: str = None,        # Custom PyPI index URL
)

Features in Detail

UV Integration

The manager automatically detects and can use uv for faster package installation:

manager = DependencyManager(prefer_uv=True)

Custom Package Index

Specify a custom PyPI index:

manager = DependencyManager(
    requirements=["private-package>=1.0.0"],
    pip_index_url="https://private.pypi.org/simple"
)

Path Management

Add custom import paths:

manager = DependencyManager(
    extra_paths=[
        "./src",
        "./lib",
    ]
)

Error Handling

from depkit import DependencyError

try:
    async with DependencyManager(requirements=["nonexistent-package"]):
        pass
except DependencyError as e:
    print(f"Dependency management failed: {e}")

Best Practices

  1. Use as a context manager to ensure proper cleanup
  2. Specify exact version requirements when possible
  3. Use PEP 723 for script dependencies
  4. Handle DependencyError exceptions appropriately
  5. Consider using uv in production for better performance

Limitations

  • Requires Python 3.12 or higher
  • Some features may not work on all platforms
  • UV support requires uv to be installed separately

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

depkit-0.2.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

depkit-0.2.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file depkit-0.2.2.tar.gz.

File metadata

  • Download URL: depkit-0.2.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for depkit-0.2.2.tar.gz
Algorithm Hash digest
SHA256 be6bb8ac7b980b7de216980a3baab7945f6dd7cee1d932d1fa4a70d10a205c4c
MD5 cb36f237a86333264a304c99fb52e096
BLAKE2b-256 47f564e479762d84cc6f2fcdcd8dc7c0ba1cd07412ee113e5ea8a677ff5420d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for depkit-0.2.2.tar.gz:

Publisher: build.yml on phil65/depkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file depkit-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: depkit-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for depkit-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c64cacffc5c89174bd3cb9f580ee583fccf5f33ea24d5730d1a823580a2789de
MD5 ed3ec9abc4eca6b4712a2990ff591b6c
BLAKE2b-256 c13158b9a5e68285b6e78176fb7fc6f0c4af45196d0dd8978952edd0469dabfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for depkit-0.2.2-py3-none-any.whl:

Publisher: build.yml on phil65/depkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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