skillfed

func_args

A lightweight Python library for creating wrapper functions with enhanced argument handling using sentinel values to mark parameters as required or optional.

func-args v1.0.2 851.8K downloads/30d#4,901 on PyPI1
Permissive license MIT Active released

What it is and what it does

func_args is a lightweight, zero-dependency Python library that solves a common problem when wrapping third-party APIs: cleanly separating required parameters from optional ones and automatically validating or filtering them. It provides two sentinel values—REQ to mark required parameters and OPT to mark optional ones—along with utility functions like prepare_kwargs() that validate required arguments and remove optional ones in a single pass.

Beyond simple wrapper functions, the package includes dataclass mixins (BaseModel and BaseFrozenModel) that let you define dataclasses with REQ and OPT defaults in any order, bypassing Python's standard restriction that fields without defaults must come before fields with defaults. This is useful for building configuration objects or data structures where the order of definition matters more than the order of required versus optional fields.

Use it for:

  • Creating a cleaner wrapper around a third-party API where you want to enforce required parameters and exclude optional ones.
  • Building configuration dataclasses where optional fields need to appear before required ones in the class definition.
  • Validating function arguments in a wrapper that passes them through to an underlying API, raising an error early if required.
  • Constructing kwargs dictionaries that filter out sentinel values before passing them to external functions.
  • Defining frozen configuration objects with computed fields that require some parameters but not others.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides sentinel values (REQ and OPT) and utility functions to simplify wrapper function creation around third-party APIs by marking parameters as required or optional and automatically validating or filtering them.

Yes. The package solves a genuine problem in API wrapper design with zero dependencies, active maintenance, and a permissive license. It is well-suited for anyone building wrapper functions around third-party APIs or defining dataclasses with flexible required/optional field ordering. No known vulnerabilities and straightforward installation make it a low-risk addition.

Install

func-args on PyPI

pip

pip install func-args

uv

uv add func-args

poetry

poetry add func-args

Installing func_args

Before you install

Zero runtime dependencies and a pure Python wheel make installation straightforward. The package is actively maintained with recent releases and supports modern Python versions from 3.10 through 3.14.

License in practice

MIT license is permissive and places no restrictions on use, modification, or distribution in commercial or private projects.

Quickstart

from func_args.api import REQ, OPT, prepare_kwargs

def wrapper(required_arg=REQ, optional_arg=OPT):
    kwargs = dict(required_arg=required_arg, optional_arg=optional_arg)
    return prepare_kwargs(**kwargs)

wrapper(required_arg="value")

Requires Python 3.10 or later.

Verify before relying

  • Whether the dataclass mixins work correctly with all standard dataclass decorators and field configurations.
  • Performance characteristics when used with large numbers of parameters or high-frequency call patterns.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 108 days since the last release
Last repo commit
First released
Downloads 851,788/month — #4,901 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: func_args-1.0.2-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

wrapper function argument handlingrequired optional parameter markersthird-party api wrapper utilitiesfunction parameter validationsentinel values for function argsdataclass with required optional fieldskwargs preparation and filtering
api-wrapperparameter-validationdataclass-utilities

More Software Development packages