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

  • Unified: Load your configuration either from .<mytool>.toml, .config/mytool.toml or pyproject.toml (section [tool.mytool]) using single line: tool_config = loadfig.config(name="<mytool>")
  • Load pyproject.toml: Find and load the whole pyproject.toml using 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-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.

Where can I use it?

When creating Python tools and you want to:

  • give your users a standard place to configure it (pyproject.toml or .<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.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.1.tar.gz (13.4 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.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

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

Hashes for loadfig-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2c31a39bdf37afd49afb1c26202cf0870b679da84d5e9f01a28394ce6b8e73a
MD5 a00d00c3fca924c38d3f85a7669f1bc6
BLAKE2b-256 6a4c93a640d200fca2550999a5f4c19f7ef0239ca2f3f21b8b66c94c2590cb1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfig-0.1.1.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.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

Hashes for loadfig-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11ea9382802b3bb255e4694959c0e076151ba9028ce3956f91b617ab8164a10e
MD5 d1e95751b4ea78529185c7f7bb389676
BLAKE2b-256 37ab1a45aa10592bf63253705df769518545dc245f34b8d3ccd40e7576ed53f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for loadfig-0.1.1-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