Skip to main content

A package for efficient programming

Project description

efficiency

Pypi Downloads Downloads MIT_License

This is a package of useful one-line logging functions made by Zhijing.

Installation

Requirement: Python 3

pip install --upgrade git+git://github.com/zhijing-jin/efficiency.git
pip install --user -r requirements.txt

Logging Shortcuts

Obtain time:

>>> from efficiency.log import show_time, fwrite
>>> time_stamp = show_time()
	time: 11241933-41
>>> time_stamp
'11241933' # means: Nov 24th, 19:33

Writing out to files by one line:

>>> text = "This is handy!"
>>> fwrite(text, "temp.txt")

Printing out variables (name + value) easily:

>>> num1 = 7
>>> num2 = 2
>>> num3 = 9
>>> show_var(["num1", "num2", "num3"])
num1 : 7
num2 : 2
num3 : 9

ML-Related

>>> from efficiency.log import gpu_mem
>>> gpu_mem(gpu_id=0)
4101 # Currently, GPU Memory of GPU #0 is 4101 MiB
>>> from efficiency.function import set_seed
>>> set_seed(0)
[Info] seed set to: 0 # set the seed for random, numpy and pytorch

Useful Functions

>>> from efficiency.function import shell
>>> stdout, stderr = shell("cat temp.txt")
>>> stdout
b'This is handy!'

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

efficiency-1.2.1.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

efficiency-1.2.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file efficiency-1.2.1.tar.gz.

File metadata

  • Download URL: efficiency-1.2.1.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for efficiency-1.2.1.tar.gz
Algorithm Hash digest
SHA256 ad0bf2af1c961806699fc5021141ac6714f7527b550525edb45e98dfd3a51274
MD5 f0e04a1683497a7c9814ffc4fde4bba2
BLAKE2b-256 b8ef0a8fc466d8076104a2d83ff81b79ddac4a3ebcc1122e70de6c06df9da2e6

See more details on using hashes here.

File details

Details for the file efficiency-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: efficiency-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for efficiency-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6000474335142f358d09da373d2dca83bfa9c9476b27e34ce9b0557560eee302
MD5 c854e283af735f5cec67335e46428a5d
BLAKE2b-256 e8d0b8f948a5c32bb873f998ae89ed0d67088ab76ae15f8039bd4af352d5e6d0

See more details on using hashes here.

Supported by

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