cjnfuncs - A framework and collection of utility functions for script writing
cjnfuncs is comprised of several modules (follow links to respective documentation)
NOTE: These link point to the github repo since relative links to other .md files do not work on PyPI.
| module | Description/Purpose |
|---|---|
| core | Set up the base environment |
| configman | Feature-rich configuration file toolset |
| timevalue | Handle time values with units, such as '5m' (5 minutes), and schedule future operations |
| mungePath | Ease-of-use pathlib extension for constructing and manipulating file paths |
| rwt / run_with_timeout | Execute any function with an enforced timeout |
| deployfiles | Push bundled setup files within a package to the proper user/system locations |
| resourcelock | Inter-process resource lock mechanism |
| SMTP | Send notification and email messages |
Developed and tested on Python 3.9, 3.11, and 3.13. Supported on all higher Python versions. Developed on Linux. Supported on Windows, except for the resourcelock module (posix-ipc module dependency).
In this documentation, "tool script" refers to a Python project that imports and uses cjnfuncs. Some may be simple scripts, and others may themselves be installed packages.
Installation and usage
pip install cjnfuncs
A package template using cjnfuncs is available at https://github.com/cjnaz/tool_template, which is the basis of PyPI posted tools such as:
Project repo: https://github.com/cjnaz/cjnfuncs
Key changes since the prior major public release (version 3.1)
3.2.3 changes
- Minor, isolated changes
- configman.write() - the target directory tree is created if not existing, oneliner comment at top of written file
- configman.write() - config_timestamp only updated when written by persistent_config.save()
- configman.loadconfig() - remap_logdirbase is disabled for secondary configs
- configman tuned up debug logging
- resource lock moved signal traps inside of cli(), else they become global to the entire application -->
3.2.2 change
- periodic_log output now includes
[category - <package>.<module>.<function>(<line number>)]for debug traceability of where the log event came from.
3.2.1 change
- periodic_log returns True/False whether call was logged - useful for follow on code that needs to run if the logging event happened.
3.2 changes
-
persistent_config- Layered on top of config_item, this new class provides a clean and simple tool for carrying runtime data across tool script restarts and system reboots. -
Shared memory block handling - Extending resourcelock's features, read/write access is provided to the shared memory block associated with a user-defined lock.
Revision history
- 3.2.3 - 261022 - Minor, isolated features tuning to configman and resource_lock
- 3.2.2 - 261002 - periodic_log output now includes
[category - <package>.<module>.<function>(<line number>)]for debug traceability of where the log event came from. - 3.2.1 - 260526 - periodic_log now returns True/False whether the the call was logged. Minor changes in resourcelock.
- 3.2 - 260506 - New features: persistent_config and shared memory block handling
- 3.1.1 260207 - separate resourcelock_islocked logger, get_next_dt days/weeks offset
- 3.1 251109 Support for and use of child loggers, deployfiles create empty dir, Windows fixes, config_item() safe_mode switch, mungePath set_attributes from default False
- 3.0.1 251005 - Allow '.' in config section names
- 3.0 250705 - Added run_with_timeout, set / restore_logging_level, periodic_logging, get_next_dt. Functional change to mungePath.
- 2.5 250206 - Added multi-line and quoted string support to configman
- 2.4.1 241118 - resource_lock only init lock_info if not existing
- 2.4 241105 - Twilio support in snd_notif, resource_lock trace/debug features, check_path_exists exception fix
- 2.3 240821 - Added mungePath ./ support.
Resolved check_path_exists() memory leak.
Added
same_process_okto resourcelock.getlock() Added prereload_callback to config_item.loadconfig() - 2.2 240119 - Added SMTP DKIM support. Set SMTP server connect timeout to EmailRetryWait.
- 2.1 240104 - Partitioned to separate modules. Added modify_configfile. Added native support for float, list, tuple, and dict in loadconfig(). Added getcfg() type checking. Documentation touch for logging formats in config file. Improved snd_notif failure logging. Added email/notif send retries. Added resourcelock module.
- 2.0.1 230222 - deploy_files() fix for files from package
- 2.0 230208 - Refactored and converted to installed package. Renamed funcs3 to cjnfuncs.
- ...
- 0.1 180524 - New. First github posting
Metadata
Release files for cjnfuncs 3.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cjnfuncs-3.2.3.tar.gz | 51.5 kB | Without provenance | Details for cjnfuncs-3.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cjnfuncs-3.2.3-py3-none-any.whl | Python 3 | none | any | Details for cjnfuncs-3.2.3-py3-none-any.whl |
Total release size: 105.1 kB
Release files / cjnfuncs-3.2.3.tar.gz
| Download URL | cjnfuncs-3.2.3.tar.gz |
|---|---|
| Size | 51.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d11275a78b101a8f60c4458ca49decb07ab948a7f78c8be4c99c3eb5a09aaa0c
|
|
BLAKE2b-256 checksum How to use checksums |
3c4f16aa546790188388201512bae16efafd993d7f21b020351a305452133f5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / cjnfuncs-3.2.3-py3-none-any.whl
| Download URL | cjnfuncs-3.2.3-py3-none-any.whl |
|---|---|
| Size | 53.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fba9c8d44851a28eb8c4038add5777ba5311e61ea9ec30f494e713eedd2e365c
|
|
BLAKE2b-256 checksum How to use checksums |
aad67475adc287666186456d8b65e4fa72f084c1ba5386dae444e4243ff55cd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Security for cjnfuncs 3.2.3
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.