DepKit
DependencyManager
A flexible Python dependency manager that handles runtime dependencies and script imports.
Quick Start
from depkit import DependencyManager
# Simple usage
manager = DependencyManager(requirements=["requests>=2.31.0"])
manager.install()
import requests
# ... do your work ...
manager.uninstall() # optional cleanup
Recommended Usage (Context Managers)
# Synchronous
with DependencyManager(requirements=["requests"]) as manager:
import requests
# ... do your work ...
# cleanup happens automatically
# Asynchronous
async with DependencyManager(requirements=["requests"]) as manager:
import requests
# ... do your work ...
# cleanup happens automatically
Features
- Simple install/uninstall methods for quick usage
- Context managers for proper resource management
- PEP 723 dependency declaration support
- Support for both pip and uv package managers
- Custom pip index URL support
- Temporary script importing
- Path management for imports
Installation
pip install depkit
Basic Usage
The DependencyManager supports both synchronous and asynchronous context managers:
Async Usage
from depkit import DependencyManager
async with DependencyManager(
requirements=["requests>=2.31.0", "pandas"],
prefer_uv=True
) as manager:
import requests
import pandas
Sync Usage
from depkit import DependencyManager
with DependencyManager(
requirements=["requests>=2.31.0", "pandas"],
prefer_uv=True
) as manager:
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
- Use as a context manager to ensure proper cleanup
- Specify exact version requirements when possible
- Use PEP 723 for script dependencies
- Handle DependencyError exceptions appropriately
- 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
Metadata
Release files for depkit 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| depkit-1.0.3.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| depkit-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.1 kB
Release files / depkit-1.0.3.tar.gz
| Download URL | depkit-1.0.3.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd99b0539cf963222539496ad59ff6e86324c9c2886773af48c5e82c3238782d
|
|
BLAKE2b-256 checksum How to use checksums |
d5b5159c10374734998a2298a6010d79f14af66c4c6a8b8fdd36430389dd8548
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2025.
Transparency logRelease files / depkit-1.0.3-py3-none-any.whl
| Download URL | depkit-1.0.3-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f573ee66a802ae7bfd1ea4f40966cb5b1da0a1b6749626ea71a2b94cbb7f7a35
|
|
BLAKE2b-256 checksum How to use checksums |
d3b37157b3a43813e8eaa8184bec405588ae6a332abf1ef52c1423db82a1acde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2025.
Transparency log