Python Requisites
Python Requisites is a dynamic tool for the explicit declaration and analysis of dependencies in Python objects, streamlining the process of identifying and managing required elements in your code.
Introduction
Python Requisites (or python-requisites) provides an intuitive way to analyze and declare the dependencies in Python objects like functions, classes, and modules. This tool is particularly useful for developers looking to gain better insight into their code's structure and dependencies.
Features
- Explicit Dependency Declaration: Clearly outlines the dependencies within Python objects.
- Streamlined Analysis: Simplifies the process of identifying required arguments and dependencies in functions, classes, and modules.
- Easy Integration: Designed to seamlessly integrate with existing Python projects.
Installation
You can install Python Requisites using pip:
pip install python-requisites
Usage
This library provides a utility to collect function parameters dynamically, either as positional or keyword arguments. Below are examples demonstrating how to use this functionality:
Collecting Positional or Keyword Arguments
from requisites import collect_params
def sample_function(argument):
return argument
# Example 1: Collecting positional arguments
args, kwargs = collect_params(sample_function, "hello")
# args will be ("hello",)
# kwargs will be {}
assert sample_function(*args, **kwargs) == "hello"
# Example 2: Collecting keyword arguments
args, kwargs = collect_params(sample_function, argument="hello")
# args will be ()
# kwargs will be {"argument": "hello"}
assert sample_function(*args, **kwargs) == "hello"
# Example 3: Combining positional and keyword arguments
args, kwargs = collect_params(sample_function, "hello", argument="world")
# args will be ()
# kwargs will be {"argument": "world"}
assert sample_function(*args, **kwargs) == "world"
Collecting Parameters with Variable Arguments
from requisites import collect_params
def complex_function(a, b, *args, c, d=1, **kwargs):
return "OK"
# Example 1: Handling required parameters
args, kwargs = collect_params(complex_function, "hello", "world", c="see")
# args will be ("hello", "world")
# kwargs will be {"c": "see", "d": 1}
assert complex_function(*args, **kwargs) == "OK"
# Example 2: Handling extra positional and keyword arguments
args, kwargs = collect_params(complex_function, "hello", "world", "!", c="see", e="extra", f="fun")
# args will be ("hello", "world", "!")
# kwargs will be {"c": "see", "d": 1, "e": "extra", "f": "fun"}
assert complex_function(*args, **kwargs) == "OK"
Metadata
Release files for python-requisites 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_requisites-0.1.0.tar.gz | 6.8 kB | Without provenance | Details for python_requisites-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_requisites-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for python_requisites-0.1.0-py3-none-any.whl |
Total release size: 14.2 kB
Release files / python_requisites-0.1.0.tar.gz
| Download URL | python_requisites-0.1.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
533cd6924453b822c281aabe8283f3d9772e1b49c6c917d83cd7550d34231d52
|
|
BLAKE2b-256 checksum How to use checksums |
a48e03e48f4bcde19234e04865f217a6d3bde1e72c7d10c83f31a4e5dab54ff1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0
|
Release files / python_requisites-0.1.0-py3-none-any.whl
| Download URL | python_requisites-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bf167b63df426f99c0f2791e9302568d9ed9aecc5f538495b788ee04c6d3266
|
|
BLAKE2b-256 checksum How to use checksums |
485155f6260e067c3f07e0caa6ea3322fc4e3083a1c4f66c5955ebe3b5e737c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0
|
Security for python-requisites 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.