Skip to main content

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 TOML configuration files adhering to modern standards:

  • Unified: Load your configuration either from .mytool.toml or pyproject.toml (section [tool.mytool]).
  • One-liner: loadfig.config(name="mytool") returns a basic Python dictionary and that is all you need.
  • No dependencies: Python-only, no third-party dependencies.
  • Do one thing well: Only load the configuration, use other libraries like python-dotenv for bells and whistles.
  • Git-aware: Automatically detects project's root using git (or other VCS), no need to specify the path to your configuration file.

Quick start

Installation

> pip install loadfig

Usage

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.toml can 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loadfig-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

loadfig-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file loadfig-0.1.0.tar.gz.

File metadata

  • Download URL: loadfig-0.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for loadfig-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dcf14e9f1daa027b90d4811314f97531de1f00aa3520e477f5025de36afbc158
MD5 5e0da74c4d0582a7365d9be7dda7b7cc
BLAKE2b-256 48f372dd40bd37ab26c40441f8b4235b9b35f0e757d491cb42c4108a521c0f5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfig-0.1.0.tar.gz:

Publisher: release.yml on open-nudge/loadfig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file loadfig-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: loadfig-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for loadfig-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c8d15fbb79888782e1e86e64a937881defd00df89a6f7990044f2f865fc41c0
MD5 f01b25770cd0a4895e0b1135ea98fdd9
BLAKE2b-256 5940f844b67648bd48e262528ef497a4c82f84a708445cdcb8e30792e8447281

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfig-0.1.0-py3-none-any.whl:

Publisher: release.yml on open-nudge/loadfig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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