Skip to main content

param

Enhanced function parameters

Installation

pip install git+https://github.com/tombulled/param.git@main

Usage

Functions

The @params annotation works seamlessly with functions:

from param import Param, params

@params
def get(url: str, params: dict = Param(default_factory=dict)):
    print("GET", url, params)
>>> get("https://httpbin.com/get")
GET https://httpbin.com/get {}

Classes

The @params annotation also works seamlessly with classes. Importantly, the @params annotation should be specified before @staticmethod or @classmethod.

from param import Param, params

class MyClass:
    @params
    def get(self, url: str, params: dict = Param(default_factory=dict)):
        print("GET", url, params)

    @classmethod
    @params
    def post(cls, url: str, params: dict = Param(default_factory=dict)):
        print("POST", url, params)

    @staticmethod
    @params
    def put(url: str, params: dict = Param(default_factory=dict)):
        print("PUT", url, params)
>>> obj = MyClass()
>>>
>>> obj.get("https://httpbin.com/get")
GET https://httpbin.com/get {}
>>>
>>> obj.post("https://httpbin.com/post")
POST https://httpbin.com/post {}
>>> MyClass.post("https://httpbin.com/post")
POST https://httpbin.com/post {}
>>>
>>> obj.put("https://httpbin.com/put")
PUT https://httpbin.com/put {}
>>> MyClass.put("https://httpbin.com/put")
PUT https://httpbin.com/put {}

Metadata

Release files for tombulled-param 0.1.14

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

Source distribution (sdist)

Source distribution for tombulled-param 0.1.14
File Size Uploaded
tombulled_param-0.1.14.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tombulled-param 0.1.14
File Interpreter ABI Platform
tombulled_param-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / tombulled_param-0.1.14.tar.gz

Download URL tombulled_param-0.1.14.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2e673165dd6514db2188cf71fa8ed016efc24148ab6ae943bd85d04177da1be9
BLAKE2b-256 checksum
How to use checksums
2e378ee9c9d29dc00b11dd808ea5c1a7b74b4fb552f899e66359a3e81280e30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-131-generic

Release files / tombulled_param-0.1.14-py3-none-any.whl

Download URL tombulled_param-0.1.14-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46d6abddc21304b9839ed4d034e67fac046eade78f7bbb789af99cd77f353e97
BLAKE2b-256 checksum
How to use checksums
96c417e9e2c5f0bfd482f2af5b4ffcaf76f821d9498342b466c755e200e3bc6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-131-generic

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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