A Python toolkit for managing runtime asset packages
Project description
๐ฆ AssetKit
A Python toolkit for packaging, discovering, and loading structured runtime assets.
๐ Features
- โ
Structured asset packaging with a clean
resources/assets/convention - โ
AssetManager: Pythonic runtime asset access interface - โ
Optional
assets.pyauto-generated mapping with dot-access convenience - โ CLI scaffolding for reusable asset packages and app templates
- โ
Optional asset injection at creation (
--add <files/dirs>) - โ
Optional
--installafter generation - โ
Optional
--gen-assets-pyto include reusableassets.pyfor import - โ
Auto-discovery of installed asset packages via
entry_points - โ Fully pip-installable โ no source directory needed at runtime
- โ Supports plain files, binaries, even GitHub repositories
๐ฆ Installation
pip install assetkit
During development:
pip install -e .
๐ CLI Usage
Create a new asset package:
assetkit new my_assets
Add asset files or folders at creation time:
assetkit new my_assets --add /path/to/data.csv /path/to/config/
Auto-install the package after creation:
assetkit new my_assets --install
Also generate reusable assets.py mapping file:
assetkit new my_assets --gen-assets-py
Put it all together
assetkit new my_assets --add myfile.txt --gen-assets-py --install
Scaffold an AI/ML application project:
assetkit scaffold mlkit my_app_project
๐ Example Asset Package Structure
my_assets/
โโโ pyproject.toml
โโโ setup.cfg
โโโ MANIFEST.in
โโโ my_assets/
โโโ __init__.py
โโโ assets.py <-- optional, auto-generated
โโโ resources/
โโโ assets/
โโโ config/
โ โโโ model.yaml
โโโ data/
โ โโโ sample.csv
โโโ myfile.txt
โก Quick Python Usage Example
Manual access via AssetManager:
from assetkit.asset_manager import AssetManager
assets = AssetManager(package_root="my_assets", resource_dir="resources/assets")
print(assets.list()) # List all available assets
print(assets["config/model.yaml"].text()) # Read file contents
Auto-importable mapping via assets.py (if generated):
from my_assets.assets import assets
print(assets.config_model_yaml.text())
print(assets.data_sample_csv.text())
print(assets.myfile_txt.path()) # Full file path
๐ Discover All Installed Asset Packages
from assetkit.discovery import discover_asset_managers
packages = discover_asset_managers()
for name, assets in packages.items():
print(f"{name}: {assets.list()}")
๐งช Testing an Installed Asset Package
After creating and installing:
cd my_assets
pip install .
Then test in Python:
from my_assets.assets import assets
print(assets.config_model_yaml.text())
Or with raw AssetManager if no assets.py:
from assetkit import AssetManager
assets = AssetManager(package_root="my_assets", resource_dir="resources/assets")
print(assets.list())
๐ณ Dockerized Example (Optional)
FROM python:3.12-slim
RUN pip install assetkit
WORKDIR /app
RUN assetkit new my_assets --add /dev/null --gen-assets-py
WORKDIR /app/my_assets
RUN pip install .
CMD ["python", "-c", "from my_assets.assets import assets; print(assets.myfile_txt.text())"]
๐ License
MIT โ See LICENSE
๐ฌ More Info
๐ Roadmap (Coming Soon)
assetkit bundleandassetkit extractCLI tooling- Language-agnostic
assetkit.yamlasset manifests assetkit.ext.yaml,assetkit.ext.pandashelpers- CLI dispatch of packaged binary tools (
assetkit run <tool>) - GitHub Actions publishing workflows
- Plugin-style extension system for asset loaders
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file assetkit-0.1.16.tar.gz.
File metadata
- Download URL: assetkit-0.1.16.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e02e8494a8908f1d74ff41b6b6cc6d454df9393b65ac4036d14dca3726313157
|
|
| MD5 |
8fa9ce0f7ca674df5d309aa40b322cca
|
|
| BLAKE2b-256 |
45f6019ccfc1ef18cffaffe0d25e86328ba35e457500bd7571109a3cb4122975
|
File details
Details for the file assetkit-0.1.16-py3-none-any.whl.
File metadata
- Download URL: assetkit-0.1.16-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f579ebcbb664b890046af655a2c407f2606ff42a6a17c6b579c723ce23f644c
|
|
| MD5 |
63e7221e8c06d8b6edbc26f6ab96037d
|
|
| BLAKE2b-256 |
60058a2dd76858e371cde9d9e561f450c17c4fa0f73b47dde6172390c1eb7538
|