Skip to main content

python-args

python-args, inspired by attrs, removes the boilerplate of processing arguments to functions and methods.

Decorating your functions with python-args decorators like arg.validators can make your code more composable, more readable, and easier to test. Along with this, functions decorated with python-args can be used to by other tools and frameworks to build more expressive interfaces. The django-args and django-action-framework libraries are two examples.

The core python-args decorators are as follows:

  1. @arg.validators(*validation_funcs): Runs validation functions that can take the same named arguments as the decorated function. When decorating a function with arg.validators, you not only de-couple your function from argument validation logic, but python-args will allow other interfaces to only run the validators of your function.

  2. @arg.defaults(**arg_default_funcs): Sets arguments to default values. The default functions can similarly take the same named parameters of the decorated function.

  3. @arg.parametrize(**parametrize_funcs): Runs a function multiple times for a particular input.

  4. @arg.contexts(*context_funcs): Enters context managers before a function. Context managers can take the same named parameters as the decorated function.

View the docs here for a tutorial and more examples of how python-args can be used in practice.

Documentation

View the python-args docs here.

Installation

Install python-args with:

pip3 install python-args

Contributing Guide

For information on setting up python-args for development and contributing changes, view CONTRIBUTING.rst.

Primary Authors

  • @wesleykendall (Wes Kendall)

Metadata

Release files for python-args 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-args 1.0.2
File Size Uploaded
python-args-1.0.2.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-args 1.0.2
File Interpreter ABI Platform
python_args-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / python-args-1.0.2.tar.gz

Download URL python-args-1.0.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
414ff6f74f42fdfbc279587b8394f89331a6d9db22c890e3fb8be4dc45e8ff49
BLAKE2b-256 checksum
How to use checksums
7715a6cc05ff70629d4eba5d7b3eed1486508c44ab6e5ac7677f4d132a662919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-1067-aws

Release files / python_args-1.0.2-py3-none-any.whl

Download URL python_args-1.0.2-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe96c87aa9622a33d058821a9cd96fc61489bdad743cfcc0b729e1db951f9698
BLAKE2b-256 checksum
How to use checksums
3655f7e6042c6074401786d6d035ab2a52221753bdf1a9389e1936f9adf35cdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-1067-aws

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page