Utilities for hydra-core library
Project description
hydra-utils
Wrapper for (hydra-core to add flexible configuration treatment.
Requirement
- Python 3.13, 3.12, 3.11, 3.10
Installation
pip install hydra-utils
Usage
@hydra_utils.hydra_wrapper(
app_name='my_app',
app_version='0.1.0',
app_file=__file__,
config_path='conf',
config_name='config',
version_base='1.2',
verbose=1,
)
def main(conf: dict[Any, Any]) -> None: ...
if __name__ == '__main__':
main()
app_nameandapp_versionare used to log information of current version.- It is useful if app_version is set to
__version__of the app.
- It is useful if app_version is set to
app_fileis used to check the file place's git status to log the git commit hash and diff from the last commit.- The argument which the main function takes is
dict[Any, Any]instead ofDictConfig. - Configuration file can be passed by the first argument or
conf_file=...at the command line, which will be merged to the configuration file specified by conf_path and conf_name. - Configuration file can have
includekeyword which has the list of configuration files to include.- Included files are merged to the main configuration file.
- It is resolved at the place of
include. If the main file has other configurations after theinclude, they will overwrite the included configurations.
n_jobsis fixed to the number of CPUs.- It is used to set the number of jobs for parallel processing.
- If
n_jobsis set to 0 or 1, it is set to 1. - If
n_jobsis set to -1, it is set to the number of logical cores. - If
n_jobsis set to None, it is set to the number of physical cores. - If
n_jobsis set to a negative number, it is set to the number of logical cores + 1 + n_jobs, i.e. -1 is the same as the number of logical cores.
It is recommended to define hydra.job.name in your default configuration file (<conf_pth>/<conf_name>.yaml):
hydra:
job:
name: my_custom_job_name
Otherwise the job name is utils as hydra detect the file where hydra.main is executed.
There is also wrapper function for to_absolute_path.
from hydra_utils import to_absolute_path
- It returns empty string if the input is empty.
- It returns the input as is if the input includes
:(e.g.,http://,s3://, ...).
Based on rcmdnk/python-template, v0.1.2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hydra_utils-0.3.3.tar.gz.
File metadata
- Download URL: hydra_utils-0.3.3.tar.gz
- Upload date:
- Size: 103.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f55f5436213700b50d7b2782a85fee229b880468a867e40c5cf141e10ae68d2d
|
|
| MD5 |
e08f3216eeb5238ce8dbb15834f3eda8
|
|
| BLAKE2b-256 |
c13d2171976c4c5ce8fe33a71667c20074124b63b0fb157ee65e7256601f8f84
|
File details
Details for the file hydra_utils-0.3.3-py3-none-any.whl.
File metadata
- Download URL: hydra_utils-0.3.3-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6539fd00b599b7a2c241f3afb718442f7a7a1e76cf4e04aea3c5ea5f7da7c56
|
|
| MD5 |
33cc6ded06f24b2b4ef7925c856c94ed
|
|
| BLAKE2b-256 |
f06781c866a3c747a15dc1798038a984217e2ed2da7b5bc03e8007c59c0d0a73
|