Skip to main content

No project description provided

Project description

👊 TARIFF 🔥

The GREATEST, most TREMENDOUS Python package that makes importing great again!

MIGA

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_module or importlib.__import__.
  • adds an decorator tariff.exports.set_tariff to 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!

meme

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:

  1. TARIFF measures how long the original import takes
  2. TARIFF makes the import take longer based on your tariff percentage
  3. 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:

  1. TARIFF checks if your function is a normal export tariff or a retaliatory tariff
  2. For normal export tariff, TARIFF penalizes the function for everyone or based on the earmarked users
  3. For retaliatory tariff, TARIFF only penalizes the function if your package is penalized by the user
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tariff_exports-1.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tariff_exports-1.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

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

Hashes for tariff_exports-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c1ea134367d29ee03630e73062431bcd8f2f623259a924c68b406235431db93b
MD5 90968fc1af81192466a5479bc05a9b23
BLAKE2b-256 f5b5b788232b967eaa2a7fddb2d3b31bb2313ce37ade3eede4371625a50014d3

See more details on using hashes here.

File details

Details for the file tariff_exports-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tariff_exports-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e15dbf31f1e6f002487280600c3cf821f44872abe0ffd2ce8dbd90a046317767
MD5 5a1fd1f3407a3be92042728b5d501bc4
BLAKE2b-256 e04b7a072f2f7b6f49350fb62e0d6b40d2cfeb3213bb17569a6a8ed8243794a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page