No project description provided
Project description
nshconfig-extra
nshconfig-extra
is a collection of additional configuration types for the nshconfig library. It extends the functionality of nshconfig
by providing support for some additional custom configuration types, such as HFPath
for working with Hugging Face paths and URLs.
Installation
To install nshconfig-extra
, use the following command:
pip install nshconfig-extra
If you want to use the this library with optional dependencies, you can install the extra dependencies using the following command:
pip install nshconfig-extra[extra]
Usage
HFPath
The HFPath
configuration type allows you to define and work with Hugging Face paths and URLs seamlessly. It provides methods for parsing Hugging Face paths and URLs and downloading the corresponding files.
Parsing Hugging Face Paths
To parse a Hugging Face path, use the HFPath.from_hf_path()
method:
from nshconfig_extra import HFPath
path = HFPath.from_hf_path("user/repo@branch/path/to/file")
The path should be in the format {user}/{repo}@{branch}/{path/to/file}
. If the branch is not specified, the default branch "main" will be used. If the file path is not specified, an empty string will be used.
Parsing Hugging Face URLs
To parse a Hugging Face URL, use the HFPath.from_hf_url()
method:
from nshconfig_extra import HFPath
path = HFPath.from_hf_url("https://huggingface.co/user/repo/resolve/branch/path/to/file")
The URL should be a valid Hugging Face URL pointing to a specific file in a repository.
Downloading Files
Once you have an HFPath
instance, you can download the corresponding file using the download()
method:
local_path = path.download()
The download()
method will download the file if it doesn't exist locally and return the local path to the downloaded file.
Contributing
Contributions to nshconfig-extra
are welcome! If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request on the GitHub repository.
License
nshconfig-extra
is open-source software licensed under the MIT License.
Acknowledgements
nshconfig-extra
(and nshconfig
) are heavily dependent on the Pydantic library for defining and validating configuration types.
Project details
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
File details
Details for the file nshconfig_extra-0.2.0.tar.gz
.
File metadata
- Download URL: nshconfig_extra-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c0ee904c1c05db11d88df78cba7b369849734d523ce3cd33bd2cb073be7430b |
|
MD5 | 446ff3c92e3d4d16157f7b71e3282d18 |
|
BLAKE2b-256 | 3c1312c9081bfcadb55282965350e8b23397995753f4cee152625131683d7691 |
File details
Details for the file nshconfig_extra-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: nshconfig_extra-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-39-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a72c3fabb134b89c2f09955b4381fdaed267cdc6d32c245ff649bfb279d6303d |
|
MD5 | 95c0c7fadc3f278c55cb23dd2b9615dc |
|
BLAKE2b-256 | 98b428591a27df36fb2f0674bdd5ad6bca098b2ae4abd6405a9c3c0c790cf2c5 |