fifo_folder
A FIFO folder management library that manages files using queue-like principles.
Install
pip install fifo_folder
Example
Here's an example logger using fifo_folder
to limit the resources used by log files:
import os
from fifo_folder import FIFOFolder
LOG_DIR_PATH = "/path/to/your/log/folder/"
log_manager = FIFOFolder(
LOG_DIR_PATH, # path to the folder to manage
count_limit=100, # keep at most 100 files
total_size_limit=(1 << 30), # keep sum of file sizes no greater than 1GB
)
def log(file_name: str, text: str) -> None:
# create a new log file
file_path = os.path.join(LOG_DIR_PATH, file_name)
with open(file_path, "w") as file:
file.write(text)
log_manager.load_items() # load current files
removed_items = log_manager.manage() # removed extra files
if len(removed_items): # display removed files
print(
"removed log files:",
[os.path.basename(item.data.path) for item in removed_items]
)
Links
Metadata
Release files for fifo-folder 0.3.0
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 |
|---|---|---|---|---|
| fifo_folder-0.3.0.tar.gz | 4.7 kB | Without provenance | Details for fifo_folder-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fifo_folder-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for fifo_folder-0.3.0-py3-none-any.whl |
Total release size: 10.7 kB
Release files / fifo_folder-0.3.0.tar.gz
| Download URL | fifo_folder-0.3.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
328e415de5d301c3fc726a18d7ce56c2100d62e222d5cda582f066f5c6d6d489
|
|
BLAKE2b-256 checksum How to use checksums |
89dcbd33914c95e9ed53fabf6f0868f9b4fce853c0197abde36f125cc245ece6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / fifo_folder-0.3.0-py3-none-any.whl
| Download URL | fifo_folder-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c63ea97a20dbb1d68504eebd8dd099d5fc167d549b2bf218c1472cb217fac5b5
|
|
BLAKE2b-256 checksum How to use checksums |
a1e569977d8b199aa0dfd4f9565e23068bc2633f19ec5e715b5330f9ebd2e463
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Security for fifo-folder 0.3.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.