Skip to main content

one module, one call

Project description

If your project exposes a module

mymodule.py:

import onetrick

@onetrick(__name__)
def myfunction():
    print("Hello world!")

Then it can be called from elsewhere:

import mymodule

#Either like this
mymodule() # (Hello world!)

#Or like this
mymodule.myfunction() # (Hello world!)

If your project exposes a package

.
+-- mypackage
|   +-- __init__.py
|   +-- mymodule.py

mymodule.py:

import onetrick

@onetrick
def myfunction():
    print("Hello world!")

__init__.py:

from .mymodule import myfunction

myfunction.onetrick(__name__)

Then it can be called from elsewhere:

import mypackage

#Either like this
mypackage() # (Hello world!)

#Or like this
mypackage.myfunction() # (Hello world!)```

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

onetrick-2.1.0.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file onetrick-2.1.0.tar.gz.

File metadata

  • Download URL: onetrick-2.1.0.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for onetrick-2.1.0.tar.gz
Algorithm Hash digest
SHA256 ddf5d703a2b1c0aa0041214551382d403671f890c6afdecb32e87933a9542203
MD5 f6e5fc295bf753c03e5475f05e5ec68f
BLAKE2b-256 245833718b5d6331b26f38669d47658b59876ffe2147d2f0681ae1741356d6de

See more details on using hashes here.

Supported by

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