Filename-Manager
A simple Python library to handle filenames automatically for artifacts.
Install
pip install filenamemanager
Features
This library helps to convert a set of parameters into filenames and vice versa.
When running a script depending on parameters par1 (str) and par2 (float), you might want to save artifacts with a filename generated by these parameters.
You can decide how to format each parameter in the saved filename, e.g. fp4.4 will padd the float with leading 0s and with 4 digits. For example, 1.2 will be 0001.2000.
Save artifacts
from filename_manager import FilenameManager
fm = FilenameManager({"par1": "str", "par2": "fp.4.4}"}, prefix="subfolder/prefix", postfix=".csv")
# define your parameters
par1 = "Hello"
par2 = "3.11"
# super fancy script
results = "placeholder"
# create filename
filename=fm.encode(par1=par1, par2=par2)
# save
...
the filename will be subfolder/prefix_par1_Hello_par2_0003.1100.csv.
Load artifacts
from filename_manager import FilenameManager
fm = FilenameManager({"par1": "str", "par2": "fp.4.4}"}, prefix="subfolder/prefix", postfix=".csv")
# get your filename
filename = "subfolder/prefix_par1_Hello_par2_0003.1100.csv"
# parse filename
pars = fm.decode(filename)
The variable pars is a dictionary with {"par1": "Hello", "par2": 3.11}.
Documentation
The documentation is given in the docstrings. Only two classes exist. Parameter and FilenameManager.
The supported formats are
fp*.*for floating point parameters. E.g. "fp4.3" formats 1.2 as "0001.200"strfor string parameters.str*for string parameters with * characters padded with 0 in the end.*strfor string parameters with * characters padded with 0 in the beginning.boolfor boolean parameters.*intfor integer parameters with * leading zeros.
Credits
This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.
Metadata
Release files for filenamemanager 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 |
|---|---|---|---|---|
| filenamemanager-0.3.0.tar.gz | 7.4 kB | Without provenance | Details for filenamemanager-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filenamemanager-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for filenamemanager-0.3.0-py3-none-any.whl |
Total release size: 13.6 kB
Release files / filenamemanager-0.3.0.tar.gz
| Download URL | filenamemanager-0.3.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fc3015debe073eeba454d07cd27022a9bbef5ef2af1f1efb6c75a498f880c47
|
|
BLAKE2b-256 checksum How to use checksums |
51bd81830f0ebc3e7f51ad4235501716327dd9b79ecaa0bcf6e6559208c33233
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / filenamemanager-0.3.0-py3-none-any.whl
| Download URL | filenamemanager-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fd8016697fa5803c3423903b689c8c5cd03df3f814606080cb7b6cb78f4827e
|
|
BLAKE2b-256 checksum How to use checksums |
091a5a34966c350e5df076836413d333884192a3f1b984fa3e6ded67cf987317
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for filenamemanager 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.