One-liner Python pyproject config loader. Lightweight, simple, and VCS-aware with root auto-discovery.
Project description
loadfig
One-liner Python pyproject config loader. Lightweight, simple, and VCS-aware with root auto-discovery.
✨ Features 🚀 Quick start 📚 Documentation 🤝 Contribute 👍 Adopters 📜 Legal
Features
loadfig is a Python package designed to load
pyproject and TOML configuration files adhering to modern standards:
- Unified: Load your configuration either from
.<mytool>.toml,.config/mytool.tomlorpyproject.toml(section[tool.mytool]) using single line:tool_config = loadfig.config(name="<mytool>") - Load
pyproject.toml: Find and load the wholepyproject.tomlusing single line:pyproject = loadfig.pyproject() - No dependencies: Python-only, no third-party dependencies.
- Do one thing well: Only load the configuration,
use other libraries like
python-dotenvfor bells and whistles. - Git-aware: Automatically detects project's
rootusing git (or other VCS), no need to specify the path to your configuration file.
Where can I use it?
When creating Python tools and you want to:
- give your users a standard place to configure it
(
pyproject.tomlor.<mytool>.toml) - make the choices readable and findable
- create tools without maintaining boilerplate
Quick start
Installation
> pip install loadfig
Usage
pyproject.toml loading
One line is all you need:
# Returns dict with all pyproject contents
pyproject = loadfig.pyproject()
# Get the name of the project
print(pyproject["project"]["name"])
Tool configuration loading
Assume you have the following section in your pyproject.toml
file at the root of your project:
[tool.mytool]
name = "My Tool"
version = "1.0.0"
You can load the configuration for mytool using:
import loadfig
config = loadfig.config("mytool")
config["name"] # "My Tool"
config["version"] # "1.0.0"
That is all you will likely need to do to load your configuration for your Python project (in a modern, unified way).
[!IMPORTANT]
pyproject.tomlcan be located at the root of your project, while the loading file can be in a subfolder (e.g.src/mytool/loader.py).
See documentation for more details about the arguments and options available.
Contribute
We welcome your contributions! Start here:
Legal
- This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- This project is copyrighted by open-nudge - the appropriate copyright notice is included in each file.
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 loadfig-0.1.1.tar.gz.
File metadata
- Download URL: loadfig-0.1.1.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2c31a39bdf37afd49afb1c26202cf0870b679da84d5e9f01a28394ce6b8e73a
|
|
| MD5 |
a00d00c3fca924c38d3f85a7669f1bc6
|
|
| BLAKE2b-256 |
6a4c93a640d200fca2550999a5f4c19f7ef0239ca2f3f21b8b66c94c2590cb1d
|
Provenance
The following attestation bundles were made for loadfig-0.1.1.tar.gz:
Publisher:
release.yml on open-nudge/loadfig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loadfig-0.1.1.tar.gz -
Subject digest:
f2c31a39bdf37afd49afb1c26202cf0870b679da84d5e9f01a28394ce6b8e73a - Sigstore transparency entry: 1520145270
- Sigstore integration time:
-
Permalink:
open-nudge/loadfig@83f443aee105c464bc8d64c1a5aab11443376b26 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/open-nudge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83f443aee105c464bc8d64c1a5aab11443376b26 -
Trigger Event:
release
-
Statement type:
File details
Details for the file loadfig-0.1.1-py3-none-any.whl.
File metadata
- Download URL: loadfig-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.1 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 |
11ea9382802b3bb255e4694959c0e076151ba9028ce3956f91b617ab8164a10e
|
|
| MD5 |
d1e95751b4ea78529185c7f7bb389676
|
|
| BLAKE2b-256 |
37ab1a45aa10592bf63253705df769518545dc245f34b8d3ccd40e7576ed53f2
|
Provenance
The following attestation bundles were made for loadfig-0.1.1-py3-none-any.whl:
Publisher:
release.yml on open-nudge/loadfig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loadfig-0.1.1-py3-none-any.whl -
Subject digest:
11ea9382802b3bb255e4694959c0e076151ba9028ce3956f91b617ab8164a10e - Sigstore transparency entry: 1520145273
- Sigstore integration time:
-
Permalink:
open-nudge/loadfig@83f443aee105c464bc8d64c1a5aab11443376b26 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/open-nudge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83f443aee105c464bc8d64c1a5aab11443376b26 -
Trigger Event:
release
-
Statement type: