Fluent builder for Android resources
Project description
resforge
A fluent Python library for generating Android XML resource files.
Installation
pip install resforge
Android
from resforge.android import PluralValues, ValuesWriter, dp, sp
with ValuesWriter("res/values/resources.xml") as res:
res.comment("Strings")
res.string(
app_name="My App",
welcome_message="Welcome to My App!",
)
res.comment("Booleans")
res.boolean(
feature_enabled=True,
dark_mode=False,
)
res.comment("Colors")
res.color(
primary="#FF6200EE",
secondary="#FF03DAC5",
accent=0x6200EE,
)
res.comment("Dimensions")
res.dimension(
padding_small=dp(8),
padding_large=dp(24),
text_body=sp(16),
text_heading=sp(24),
)
res.comment("Integers")
res.integer(
max_retries=3,
timeout_seconds=30,
)
res.comment("Resource IDs")
res.res_id("btn_submit", "tv_title", "iv_logo")
res.comment("String arrays")
res.string_array("planets", ["Mercury", "Venus", "Earth", "Mars"])
res.comment("Integer arrays")
res.integer_array("fibonacci", [1, 1, 2, 3, 5, 8, 13])
res.comment("Typed arrays")
res.typed_array(
"icons", ["@drawable/home", "@drawable/settings", "@drawable/logout"]
)
res.comment("Plurals")
res.plurals(
item_count=PluralValues(one="%d item", other="%d items"),
file_count=PluralValues(one="%d file", other="%d files"),
)
res.comment("Styles")
res.style(
"AppTheme",
parent="Theme.MaterialComponents.DayNight",
colorPrimary="@color/primary",
colorSecondary="@color/secondary",
)
iOS
Coming in v0.2.0.
License
MIT
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
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 resforge-0.1.0.tar.gz.
File metadata
- Download URL: resforge-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d04ee6491ab0cb383976d7eef2575ebef28987b8549e9a0d9e6ff012d355a63
|
|
| MD5 |
db7c6cab47389f965d86589110d4a6aa
|
|
| BLAKE2b-256 |
4a4173ffd9cfbf7f9c9812a8d58dc005d140406349a4ff7c47e4a3b2a8aa6c00
|
Provenance
The following attestation bundles were made for resforge-0.1.0.tar.gz:
Publisher:
publish.yml on ok100/resforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resforge-0.1.0.tar.gz -
Subject digest:
0d04ee6491ab0cb383976d7eef2575ebef28987b8549e9a0d9e6ff012d355a63 - Sigstore transparency entry: 1191584604
- Sigstore integration time:
-
Permalink:
ok100/resforge@3b9badd3c2e540a1762643371723648a8f0b448d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ok100
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b9badd3c2e540a1762643371723648a8f0b448d -
Trigger Event:
release
-
Statement type:
File details
Details for the file resforge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: resforge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eec74145dba577828e9c23e84947d1f16b2042c46b306ac7b5689289b89e973
|
|
| MD5 |
e6b271a8d23d68e8eea6dc27309c0f91
|
|
| BLAKE2b-256 |
93f308afa0301d1b5191563c6d2f82507edb32c62ad86e385d87c25f97849879
|
Provenance
The following attestation bundles were made for resforge-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ok100/resforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resforge-0.1.0-py3-none-any.whl -
Subject digest:
0eec74145dba577828e9c23e84947d1f16b2042c46b306ac7b5689289b89e973 - Sigstore transparency entry: 1191584606
- Sigstore integration time:
-
Permalink:
ok100/resforge@3b9badd3c2e540a1762643371723648a8f0b448d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ok100
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b9badd3c2e540a1762643371723648a8f0b448d -
Trigger Event:
release
-
Statement type: