resource-getters
A minimal utility package for accessing application resources (icons, images, translations) in a clean and reusable way.
🔧 Features
- Safe, Pythonic access to resource files inside packages
- Uses
importlib.resources(Python 3.9+) - Extensible
ResourceGetterclass - Supports logical grouping (e.g. icons, images, translations)
- Compatible with zipped packages, wheels, and editable installs
- Designed to support PySide6/Qt apps, but fully framework-agnostic
📦 Installation
pip install resource-getters
🚀 Usage
1. Structure your local resources
Your application should have a structure like:
your_app/
└── resources/
├── __init__.py
├── icons/
├── images/
└── translations/
Only __init__.py in resources/ is required to make it a proper package.
No code logic is needed in resources/ — just the files.
2. Initialize resource-getters in your app
# your_app/app.py
import resource_getters
import your_app.resources as app_resources
resource_getters.configure(resource_package=app_resources)
3. Use resource getters to access files
import importlib.resources
from PySide6.QtGui import QPixmap
from resourcetools import Image
with importlib.resources.as_file(Image("image.png")) as real_path:
pixmap: QPixmap = QPixmap(str(real_path))
📚 API Reference
configure(resource_package: ModuleType)
Sets the base resource package to use for Icon, Image, and Translations.
Icon(filename: str) -> Traversable
Returns a Traversable object (e.g. file path) to an icon file.
Same for:
Image(filename: str)
Translations(filename: str)
✅ Why importlib.resources?
- Built into the Python standard library
- Zip-safe (works with packages in wheels or zipapps)
- Avoids hardcoded filesystem paths
🧪 Compatibility
- Python 3.9+
- Works with importlib.resources standard API
- No external dependencies
📜 License
MIT License
Metadata
Release files for resource-getters 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| resource_getters-1.0.0.tar.gz | 2.7 kB | Without provenance | Details for resource_getters-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| resource_getters-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for resource_getters-1.0.0-py3-none-any.whl |
Total release size: 6.6 kB
Release files / resource_getters-1.0.0.tar.gz
| Download URL | resource_getters-1.0.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
421e1714480668ed2a8a284156c9d3be82a6fae3d145151db069deeffd47983b
|
|
BLAKE2b-256 checksum How to use checksums |
d4a6b52721535476088f7ea9cbd2d9fdfb1fdd15f3720a22ebd1b8534bd9625e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|
Release files / resource_getters-1.0.0-py3-none-any.whl
| Download URL | resource_getters-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b22293acb8b165b1fc78e3456885c5e4b9c692e3d9827a8c39ab5681ccdb1a7
|
|
BLAKE2b-256 checksum How to use checksums |
131237de156af8f26c650824dc463a8760a0dde460ba15ccc49c5e407d5d9866
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|
Security for resource-getters 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.