SuperPy
There are 5 sub modules:
- sp.logging
- sp.testing
- sp.concurrency
- sp.dicts
- sp.disk
- sp.string
sp.logging
SuperPy's logging system is a simple abstraction from the standard library logging module. It also provides some nice extra functionalities. Here are some examples:
Logging messages
import super_py as sp
log = sp.logging.Logger("info",
ts_color="bright_green",
terminal=True,
files=["info.log", "combined.log"],
)
log("This is a simple log!")
This will write the following log line to the terminal, and the files info.log and comnined.log:
[info ] 2022-10-04 15:53:09 This is a simple log!
where the name and timestamp will be colored in bright_green.
Logging function benchmarks
You can also use the provided decorator to log benchmarks of your functions:
import super_py as sp
log = sp.logging.Logger("benchmark",
ts_color="bright_green",
terminal=True,
)
@log.benchmark(with_args=[0])
def wait(seconds):
time.sleep(seconds)
for i in range(10):
wait(i / 10)
This will write the following log lines:
[benchmark ] 2022-10-04 16:03:39 0.0ms wait((0.0))
[benchmark ] 2022-10-04 16:03:39 105.1ms wait((0.1))
[benchmark ] 2022-10-04 16:03:39 205.1ms wait((0.2))
[benchmark ] 2022-10-04 16:03:40 308.3ms wait((0.3))
[benchmark ] 2022-10-04 16:03:40 403.5ms wait((0.4))
[benchmark ] 2022-10-04 16:03:40 505.1ms wait((0.5))
[benchmark ] 2022-10-04 16:03:41 605.1ms wait((0.6))
[benchmark ] 2022-10-04 16:03:42 705.1ms wait((0.7))
[benchmark ] 2022-10-04 16:03:43 804.1ms wait((0.8))
[benchmark ] 2022-10-04 16:03:43 903.3ms wait((0.9))
You can use benchmark without calling the decorator, it will still work:
@log.benchmark
def wait(seconds):
time.sleep(seconds)
The benchmark decorator takes the following keyword arguments:
with_args: list[int]: The list of indices of function arguments which should be logged.with_kwargs: list[str]: The list of keyword argument names of the function which should be logged.
Metadata
Release files for super-py 1.0.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 |
|---|---|---|---|---|
| super_py-1.0.3.tar.gz | 7.6 kB | Without provenance | Details for super_py-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| super_py-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for super_py-1.0.3-py3-none-any.whl |
Total release size: 16.2 kB
Release files / super_py-1.0.3.tar.gz
| Download URL | super_py-1.0.3.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5b4bc25dac16aece22cca67c75fa150287f93aef281f3ed83582d7308f18c24
|
|
BLAKE2b-256 checksum How to use checksums |
ef2f6d31ca5b343f9fd7f4692f00ce5544dcd2a2becf95f6c8dfc343f81efa93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0
|
Release files / super_py-1.0.3-py3-none-any.whl
| Download URL | super_py-1.0.3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
384e2e6ae70453561093fadd9596d7aa3dd0e8095b5f52b8ba01f7f5d5b220d0
|
|
BLAKE2b-256 checksum How to use checksums |
c67873b43bf145a2a533362a43198916fbdc8d1129a197f64ebc82e519f7dd19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0
|
Security for super-py 1.0.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.