Zero-configuration, OS-independent asset management for Python
Project description
rune
Overview
A Python library for zero-configuration, OS-independent asset management. It automatically discovers and provides an intuitive API to access project files, eliminating the need for hardcoded relative paths or complex configuration.
Built on top of Python's native pathlib, rune eliminates boilerplate code related to path management. It adapts to your existing project structure, allowing you to focus on your application's logic instead of worrying about file locations.
Key Features
- Zero Configuration: Works out-of-the-box by automatically detecting your project root and common asset directories (
assets/orresources/). - Intuitive, Pythonic API: Access your assets as if they were Python objects (
assets.images.player_icon). - Cross-Platform Reliability: Identical behavior across Windows, macOS, and Linux.
pathlibIntegration: Returns standardpathlib.Pathobjects for full compatibility with modern Python libraries.- Path-like Behavior: Supports natural path joining with the
/operator (assets.fonts / "main.ttf"). - Excellent Developer Experience: Provides clear, helpful error messages with suggestions for typos.
Installation
uv add rune
Quick Start
Imagine you have the following project structure:
my_awesome_project/
├── resources/
│ ├── images/
│ │ ├── player.png
│ │ └── background.jpg
│ └── fonts/
│ └── main.ttf
└── src/
└── main.py
In main.py, you can access your assets like this:
NOTE: The asset paths are resolved relative to the project root, making it easy to manage assets without worrying about their physical locations. NOTE: The asset paths are case-insensitive, allowing for flexible access regardless of the original file naming. NOTE: The name
runeis used as a namespace for now... I'm looking for a way to use it if possible, if not I'll just change the name of the pkg to something that fits better!
from rune import assets
# Get the path to the player image
player_image_path = assets.images.player
# You can also use the / operator to join paths
main_font_path = assets.fonts / "main.ttf"
print(f"Player image: {player_image_path}")
print(f"Main font: {main_font_path}")
API Behavior
rune dynamically maps your directory structure to a Python object.
- Directory Access:
assets.imagesmaps to the first discoverable directory namedimages/. - File Access:
assets.images.playermaps to the fileimages/player.png. The file extension is optional and normalized. - Path Joining:
assets.images / "enemies/goblin.png"works just likepathlib. - Iteration:
for file in assets.images: print(file)allows you to iterate over contents.
Usage Examples
See the examples directory for complete sample applications demonstrating various project layouts and use cases.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 manifold-0.0.1.tar.gz.
File metadata
- Download URL: manifold-0.0.1.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9a456abbe29c997a808ad0efd7c08a8ef2c5e78277a4353d57abcf6b8004bbb
|
|
| MD5 |
d9a076c2d25996e005eb82a56728501e
|
|
| BLAKE2b-256 |
0b8127ade41174ac34a7456674a013f848219b65acfe137b7f4af3f2ee5356b2
|
File details
Details for the file manifold-0.0.1-py3-none-any.whl.
File metadata
- Download URL: manifold-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fccea391efddf62ebaefeac7a8ef3677b1d515a32b588fa836f4858d56fcd34
|
|
| MD5 |
ab1c1a5797b33628dbe57d88fb3910b8
|
|
| BLAKE2b-256 |
d06ebc384a1a0c509257c4b835cb3daee19a9ba84abfbb612ab3667ec689f462
|