Skip to main content

A Python toolkit for managing runtime asset packages

Project description

๐Ÿ“ฆ AssetKit

A Python toolkit for packaging, discovering, and loading structured runtime assets.

PyPI version License CI Coverage


๐Ÿš€ Features

  • โœ… Structured asset packaging with a clean resources/assets/ convention
  • โœ… AssetManager: Pythonic runtime asset access interface
  • โœ… Optional assets.py auto-generated mapping with dot-access convenience
  • โœ… CLI scaffolding for reusable asset packages and app templates
  • โœ… Optional asset injection at creation (--add <files/dirs>)
  • โœ… Optional --install after generation
  • โœ… Optional --gen-assets-py to include reusable assets.py for 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 bundle and assetkit extract CLI tooling
  • Language-agnostic assetkit.yaml asset manifests
  • assetkit.ext.yaml, assetkit.ext.pandas helpers
  • CLI dispatch of packaged binary tools (assetkit run <tool>)
  • GitHub Actions publishing workflows
  • Plugin-style extension system for asset loaders

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

assetkit-0.1.16.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

assetkit-0.1.16-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

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

Hashes for assetkit-0.1.16.tar.gz
Algorithm Hash digest
SHA256 e02e8494a8908f1d74ff41b6b6cc6d454df9393b65ac4036d14dca3726313157
MD5 8fa9ce0f7ca674df5d309aa40b322cca
BLAKE2b-256 45f6019ccfc1ef18cffaffe0d25e86328ba35e457500bd7571109a3cb4122975

See more details on using hashes here.

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

Hashes for assetkit-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 7f579ebcbb664b890046af655a2c407f2606ff42a6a17c6b579c723ce23f644c
MD5 63e7221e8c06d8b6edbc26f6ab96037d
BLAKE2b-256 60058a2dd76858e371cde9d9e561f450c17c4fa0f73b47dde6172390c1eb7538

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