This package does command line processing, allows for logging, and keeps track of start, end, and elapsed time, along with a bunch of other stuff.
Project description
How to use CMD Log time:
Write a Command file that teaches cmdlogtime how to parse your input args:
# first line is the description of what the program does.
# subsequent lines list positional arguments (PA), then key-value (KV)arguments (KVA).
# Positional line:
# PA_name|PA_Description|Is_out_dir|Is_Dir|Check_Directory|Is_file|Check_File|||
# Key/Value Line:
# KVA_name|KVA_Description|Is_out_dir|Is_Dir|Check_Directory|Is_file|Check_File|alternate_KVA_name|default value|type
# -print_x_thresh|print every X threshold|0|0|0|0|0|--print_every_x_threshold|1|int
# For KVAs for booleans, set default value to BOOLEANFALSE or BOOLEANTRUE.
# If default is BOOLEANFALSE, then if you set the flag it will be True. (or vice-versa)
# -get_top_words|get top most probable words|0|0|0|0|0|--get_top_probable_words|BOOLEANFALSE|
# out_dir must be given.
#
# Example below. First line describes the program
Compute AUCROC and other stats from infile. Print AUCROC and PR curves.
out_dir|Top level directory that holds all the results|1|1|1|0|0|||
infile|file path of file with a file with header in format call(1 or 0)\tX\tValue|0|0|0|1|1|||
-print_x_thresh|print every X threshold|0|0|0|0|0|--print_every_x_threshold|1|int
Call cmdlinetime from your code as follows:
#!/usr/bin/env python
# need to import cmdlogtime
import cmdlogtime
#need to specify a command line definition file. See example command line definition file in this directory.
COMMAND_LINE_DEF_FILE = "./processLincsCommandLine.txt"
#There is also an example python file that uses all this stuff in this directory.
def main():
# Call cmdlogtime.begin() at the beginning of main()
(start_time_secs, pretty_start_time, my_args, logfile) = cmdlogtime.begin(COMMAND_LINE_DEF_FILE, sys.argv[0])
# the command line arguments will be in the my_args dictionary returned, so you can access them like this:
get_treats_vectors = my_args["get_treats_vectors"]
# Then you put all of your code here.....
# if you want to add stuff to the logfile:
logfile.write("Run Skim here for each of the B terms files in B_TERMS_DIR")
#The only functions you probably will ever need in cmdlogtime are begin(), end(), and maybe make_dir. Here's an example:
cmdlogtime.make_dir(intermediate_out_dir)
# Call cmdlogtime.end() at the end of main()
cmdlogtime.end(logfile, start_time_secs)
if __name__ == "__main__":
main()
Reference Blog: https://towardsdatascience.com/an-end-to-end-guide-to-publish-your-python-package-bdb56639662c
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cmdlogtime-0.0.4.tar.gz
(4.9 MB
view details)
Built Distribution
File details
Details for the file cmdlogtime-0.0.4.tar.gz
.
File metadata
- Download URL: cmdlogtime-0.0.4.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 398358ac7b80001b89f403380349811ae4e3e0509d15a280a2053ed72ab4c953 |
|
MD5 | 51940452996e7597ddcaa2cb6d4c8e63 |
|
BLAKE2b-256 | 1407b86c9b83983134d28b2c100f54b7f2d0b6261aaa455c7b523b44b1a7a24c |
File details
Details for the file cmdlogtime-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: cmdlogtime-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89f5d43db81f8d4d8e91e63ed5c73ef3dcb05a7302c84b0b5cd00f143ba9180 |
|
MD5 | 07a1f1fd58f148dad6321101ed16086c |
|
BLAKE2b-256 | 79be3f75c6f34afb48237529c7ba2620b203d13908e6f42c148ce5b6372a5301 |