No project description provided
Project description
👊 TARIFF 🔥
The GREATEST, most TREMENDOUS Python package that makes importing great again!
This is a fork of https://github.com/hxu296/tariff with the following enhancements:
- fixed loop-holes where users can bypass tariffs by using
importlib.import_moduleorimportlib.__import__.- adds an decorator
tariff.exports.set_tariffto impose export tariffs (with retaliatory tariff mode) on your exported functions.
About
TARIFF is a fantastic tool that lets you impose import tariffs on Python packages. We're going to bring manufacturing BACK to your codebase by making foreign imports more EXPENSIVE!
Installation
pip install tariff
Usage
import tariff
# Set your tariff rates (package_name: percentage)
tariff.set({
"numpy": 50, # 50% tariff on numpy
"pandas": 200, # 200% tariff on pandas
"requests": 150 # 150% tariff on requests
})
# Now when you import these packages, they'll be TARIFFED!
import numpy # This will be 50% slower
import pandas # This will be 200% slower
How It Works
When you import a package that has a tariff:
- TARIFF measures how long the original import takes
- TARIFF makes the import take longer based on your tariff percentage
- TARIFF announces the tariff with a TREMENDOUS message
Example Output
JUST IMPOSED a 50% TARIFF on numpy! Original import took 45000 us, now takes 67500 us. American packages are WINNING AGAIN! #MIGA
Why TARIFF?
Because foreign packages have been STEALING our CPU cycles for TOO LONG! It's time to put AMERICA FIRST and make importing FAIR and BALANCED again!
TARIFF.exports
TARIFF is now extended with exports functionality. You can now set tariffs on your exported functions.
You can even selectively set export tariffs for unfriendly packages who had unilaterally imposed a tariff on your package!
Usage
from tariff.exports import set_tariff
# Set a fixed tariff rate for everyone using your function.
@set_tariff(10)
def everyone_has_tariff(message: str):
return message
# Set a variable tariff rate based who is using your function.
@set_tariff({
"numpy": 50, # 50% tariff if numpy is using the function
"pandas": 200, # 200% tariff if pandas is using the function
"requests": 150 # 150% tariff if requests is using the function
})
def selective_tariff(message: str):
return message
# Impose a tariff only when tariff is also applied on your package by the user.
@set_tariff(10, retaliatory_only=True)
def with_retaliatory_tariff(message: str):
return message
# Impose a variable tariff based on user only if user imposes a tariff on your package.
@set_tariff({
"numpy": 50, # 50% tariff on numpy if numpy impose a tariff on your package
"pandas": 200, # 200% tariff on pandas if numpy impose a tariff on your package
"requests": 150 # 150% tariff on requests if numpy impose a tariff on your package
}, retaliatory_only=True)
def selective_retaliatory_tariff(message: str):
return message
How It Works
When someone uses your TARIFFIED function:
- TARIFF checks if your function is a normal export tariff or a retaliatory tariff
- For normal export tariff, TARIFF penalizes the function for everyone or based on the earmarked users
- For retaliatory tariff, TARIFF only penalizes the function if your package is penalized by the user
- TARIFF announces the retaliatory tariff with a YYDS messages from Pooh bear and company.
Example Output
[my_package] JUST IMPOSED a 100% TARIFF on `my_func` because `usa_number_one` imposed a TARIFF on `my_package`! Original response took 2.0 sec, now takes 4.0 sec. 保护主义没有出路,贸易战和关税战没有赢家。
License
This is a parody package. Use at your own risk. MAKE IMPORTING GREAT AGAIN!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tariff_exports-1.1.0.tar.gz.
File metadata
- Download URL: tariff_exports-1.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1ea134367d29ee03630e73062431bcd8f2f623259a924c68b406235431db93b
|
|
| MD5 |
90968fc1af81192466a5479bc05a9b23
|
|
| BLAKE2b-256 |
f5b5b788232b967eaa2a7fddb2d3b31bb2313ce37ade3eede4371625a50014d3
|
File details
Details for the file tariff_exports-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tariff_exports-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e15dbf31f1e6f002487280600c3cf821f44872abe0ffd2ce8dbd90a046317767
|
|
| MD5 |
5a1fd1f3407a3be92042728b5d501bc4
|
|
| BLAKE2b-256 |
e04b7a072f2f7b6f49350fb62e0d6b40d2cfeb3213bb17569a6a8ed8243794a6
|