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.1.tar.gz (1.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: onetrick-2.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 94c804c9f2a8b99dc97fa4e405b4d4bb1f42b6990ddccd7bb0c44397b2b35d4e
MD5 37098d4d3f491fa4bde4231dc0975fa7
BLAKE2b-256 a3df737d621a30cb5c9f0c62472027737fbba1416368743ac5b5acca0e55e821

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