This project has been archived by its maintainers, and is no longer receiving any updates.
dlpt
Damogran Labs Python Tools, a collection of modules with utility functions to ease everyday Python usage.
Why?
This package main purpose is to stop reinventing the wheel on top of the built-in Python functions in every single project. Everyday struggle with:
- how do I initialize logger and add file handler?
- how do I temporary change current working directory?
- how do I get only folders inside some location?
- how do I parse JSON file with comments?
- how do I format time to string in one line?
- how do I dynamically import some module that is not on a
sys.path? - ...
These and many more everyday Python code questions should be covered with this library. Nothing extra,
just simplified.
Mostly built upon standard built-in code, but with a lot more straight-forward and less cluttered API.
What?
Paths, processes, loggers, JSON handlers, pytest fixtures, time utils, watchdog, ... Example:
import os
import time
import dlpt
import dlpt.log as log
LOG_FILE_NAME = "dlpt_example.log"
startTime = time.time()
# init default logger with console and file handler (file in <cwd>/log subfolder)
logger = log.LogHandler()
logger.addConsoleHandler()
logFilePath = logger.addFileHandler(LOG_FILE_NAME)
log.debug("Logger initialised...")
# search log file path
files = dlpt.pth.getFilesInFolderTree(os.getcwd())
for filePath in files:
fileName = dlpt.pth.getName(filePath)
if fileName == LOG_FILE_NAME:
log.info(f"Log file found: {filePath}")
break
else:
log.error(f"Log file not found, expected in a default folder: '{log.DEFAULT_LOG_FOLDER_NAME}'")
# process example
pid = os.getpid()
executable = dlpt.proc.getExecutable(pid)
log.info(f"This process was run with python: {executable}")
args = dlpt.proc.getCmdArgs(pid)
log.info(f"\tArgs: {dlpt.utils.getListStr(args[1:])}")
# utils
endTime = time.time()
log.info(f"Example duration: {dlpt.time.secondsToString(endTime - startTime)}")
# close logger and remove log file
log.closeAllLoggers()
dlpt.pth.removeFile(logFilePath)
Metadata
Release files for dlpt 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dlpt-1.0.1.tar.gz | 28.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dlpt-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.4 kB
Release files / dlpt-1.0.1.tar.gz
| Download URL | dlpt-1.0.1.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71e14f00e324756cc452d83a243f31bc7fdaa5666d81383de71003cc8e6d7171
|
|
BLAKE2b-256 checksum How to use checksums |
1c72ea79ae8eb456d804242e0d1ed75bbed47b93760498a961b97047e1fac2cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2
|
Release files / dlpt-1.0.1-py3-none-any.whl
| Download URL | dlpt-1.0.1-py3-none-any.whl |
|---|---|
| Size | 32.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31e4b048a90940ceffbde85fa2a3c759d20ac2a2465cb01e5ffbad76f74e204c
|
|
BLAKE2b-256 checksum How to use checksums |
790245416191e8667594b9ce91e07ab7530f8f525a962bd86ead928d2ecb2064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2
|