Skip to main content

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+https://github.com/zhijing-jin/efficiency.git

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
>>> 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!'

Miscellaneous Functions

Formatting README.md Better

This is the way to automatically generate table of contents for an .md file using markdown_toc:

# Step 1. download the file to your local execution path `/usr/local/bin/`
curl \
  https://raw.githubusercontent.com/alexharv074/markdown_toc/master/mdtoc.rb -o \
  /usr/local/bin/mdtoc.rb

# Step 2. generate the ToC in the "copy" mode
mdtoc.rb README.md

# Alternatively, you can automatically add the content to your copyboard and paste it to your .md
mdtoc.rb README.md | pbcopy

Metadata

Release files for efficiency 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for efficiency 2.0
File Size Uploaded Provenance Actions
efficiency-2.0.tar.gz 28.7 kB Without provenance Details for efficiency-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for efficiency 2.0
File Interpreter ABI Platform Actions
efficiency-2.0-py3-none-any.whl Python 3 none any Details for efficiency-2.0-py3-none-any.whl

Total release size: 61.6 kB

Release files / efficiency-2.0.tar.gz

Download URL efficiency-2.0.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b786908ef529cb8c6d28fc4e0f3c10e15b35f8063a8d26b6b14c860031e3784a
BLAKE2b-256 checksum
How to use checksums
c9516966acac64587376d8de4654f69144788268f10a5e4f21da9d7d78d8904a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.8

Release files / efficiency-2.0-py3-none-any.whl

Download URL efficiency-2.0-py3-none-any.whl
Size 32.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
111ac18e29cb656476bcac420306d68cd5595dae350959a6d7c8773834e35c0e
BLAKE2b-256 checksum
How to use checksums
4c36274e2337fea7f4290cf5e20171f530ff205f5e0f369702ace3fcba5fc67d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.8

Security for efficiency 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page