Skip to main content

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

nshconfig_extra-0.6.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nshconfig_extra-0.6.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file nshconfig_extra-0.6.0.tar.gz.

File metadata

  • Download URL: nshconfig_extra-0.6.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-55-generic

File hashes

Hashes for nshconfig_extra-0.6.0.tar.gz
Algorithm Hash digest
SHA256 6455962152b5335551264b3a336f6335dde9c3ab0afab0f03e1dd9c131faf205
MD5 3b99368dddb532a50e27a1dc186b6aa8
BLAKE2b-256 26d7e3dac2c09c9b36b39f1ac776a607bb496a24a9a46b8a0fc2f9c786cc7e1f

See more details on using hashes here.

File details

Details for the file nshconfig_extra-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: nshconfig_extra-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-55-generic

File hashes

Hashes for nshconfig_extra-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 266e4388d7690b9afcde1fe2a6ecdbf1951a594c28f41c1f2d06dcfe6d3ba4f5
MD5 dbcb7ee36a70139e44b3056ae9f2d933
BLAKE2b-256 e9ceecb835aae2dedde9024e98f3d4f917f11570fbf1ee74221f7181f19ce794

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page