Skip to main content

Extension of Python Language

Project description

extepy: Extension of Python Language

Documentation

Docs: https://extepy.github.io

Install

It can be installed with pip.

pip install --upgrade extepy

It works in both Python 2 and Python 3.

Features

Extension of hashlib

  • extepy.filehash(obj, method="sha256", batchsize=4096) computes the hash value of a file.

Example:

from extepy import filehash
filehash("test.txt")

Extension of importlib

  • extepy.reload(obj, update_global=True, update_local=True) provides advanced module and object reloading capabilities for Python, so that developer can modify code without restarting the interpreter.

This function solves key limitations of Python's built-in reloading functionality by:

  • Supporting all import styles: import X, import A as X, from A import X, and from A import B as X;
  • Automatically updating references without requiring reassignment;
  • Offering granular control over namespace updates (global and/or local namespace).

Examples: Reload modules and objects.

from mymodule import myfunction
# ... modify myfunction() in mymodule.py ...
from extepy import reload
reload(myfunction)  # reload function
from mymodule import myfunction as myfunction1
# ... modify myfunction() in mymodule.py ...
from extepy import reload
reload(myfunction1)  # reload function alias
import mymodule
# ... modify mymodule.py ...
from extepy import reload
reload(mymodule)  # reload module
reload("mymodule")  # reload module by module name
import mymodule as mymodule1
# ... modify mymodule.py ...
from extepy import reload
reload(mymodule1)  # reload module alias
from extepy import reload
from mymodule import myfunction as myfunction1, myfunction as myfunction2
# ... modify myfunction() in mymodule.py ...
reload(myfunction1)  # update both myfunction1 and myfunction2

Examples: Update selective namespaces

from extepy import reload
myfunction = None  # global reference
def f():
    global myfunction
    from mymodule import myfunction
    # ... modify myfunction() in mymodule.py ...
    reload(myfunction, update_local=False)  # update global namespace only
from extepy import reload
def f():
    from mymodule import myfunction
    # ... modify myfunction() in mymodule.py ...
    reload(myfunction, update_global=False)  # update the local namespace only

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

extepy-1.0.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

extepy-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file extepy-1.0.0.tar.gz.

File metadata

  • Download URL: extepy-1.0.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for extepy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d5f344e4655ef512b65cca3c7dd072021feaf4431315c60298bf1108b719080f
MD5 ea30fed8c01a1f681644fee5b16d2a0b
BLAKE2b-256 9e0da19b8792f6ee493c7ec3ffcccb195b41b4fc50bf9f4604be6fbbe0862bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for extepy-1.0.0.tar.gz:

Publisher: publish.yml on extepy/extepydev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file extepy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: extepy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for extepy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4b17ba7c2478a0ddac3e56ef06f6d23fec7f5635241014540d19868a11dc845
MD5 d6b79d330801bfa4495ca4cc95013157
BLAKE2b-256 857138ecea96f5828afd4adac2d095f012773c35d036e5735ca284ea9ebdeb06

See more details on using hashes here.

Provenance

The following attestation bundles were made for extepy-1.0.0-py3-none-any.whl:

Publisher: publish.yml on extepy/extepydev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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