filenamemanager-0.3.0
توضیحات
A simple library to handle filenames automatically for artifacts..
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | filenamemanager-0.3.0 |
| نام | filenamemanager |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Cornelius Emde |
| ایمیل نویسنده | c.emde@me.com |
| آدرس صفحه اصلی | https://github.com/cemde/FilenameManager |
| آدرس اینترنتی | https://pypi.org/project/filenamemanager/ |
| مجوز | BSD-3-Clause |
# Filename-Manager
[](https://pypi.org/project/FilenameManager/)
[](https://pypi.org/project/FilenameManager/)
[](https://github.com/cemde/FilenameManager/actions/workflows/dev.yml)
[](https://codecov.io/github/cemde/FilenameManager)
A simple Python library to handle filenames automatically for artifacts.
[//]: <> (* Documentation: <https://cemde.github.io/FilenameManager>)
* GitHub: <https://github.com/cemde/FilenameManager>
* PyPI: <https://pypi.org/project/FilenameManager/>
## Install
```bash
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 `0`s and with 4 digits. For example, `1.2` will be `0001.2000`.
### Save artifacts
```python
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
```python
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"
- `str` for string parameters.
- `str*` for string parameters with * characters padded with 0 in the end.
- `*str` for string parameters with * characters padded with 0 in the beginning.
- `bool` for boolean parameters.
- `*int` for integer parameters with * leading zeros.
## Credits
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [waynerv/cookiecutter-pypackage](https://github.com/waynerv/cookiecutter-pypackage) project template.
نیازمندی
| مقدار | نام |
|---|---|
| >=22.6,<23.0 | black |
| >=1.0.1,<2.0.0 | bump2version |
| >=3.9.2,<4.0.0 | flake8 |
| >=1.6.0,<2.0.0 | flake8-docstrings |
| >=5.8.0,<6.0.0 | isort |
| >=1.1.2,<2.0.0 | mkdocs |
| >=0.2.1,<0.3.0 | mkdocs-autorefs |
| >=1.0.0,<2.0.0 | mkdocs-include-markdown-plugin |
| >=6.1.7,<7.0.0 | mkdocs-material |
| >=1.0.1,<2.0.0 | mkdocs-material-extensions |
| >=0.15.2,<0.16.0 | mkdocstrings |
| >=0.900,<0.901 | mypy |
| >=20.3.1,<21.0.0 | pip |
| >=2.12.0,<3.0.0 | pre-commit |
| >=6.2.4,<7.0.0 | pytest |
| >=2.12.0,<3.0.0 | pytest-cov |
| >=0.10.2,<0.11.0 | toml |
| >=3.20.1,<4.0.0 | tox |
| >=3.3.0,<4.0.0 | twine |
| >=20.2.2,<21.0.0 | virtualenv |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6.2,<4.0 | Python |
نحوه نصب
نصب پکیج whl filenamemanager-0.3.0:
pip install filenamemanager-0.3.0.whl
نصب پکیج tar.gz filenamemanager-0.3.0:
pip install filenamemanager-0.3.0.tar.gz