Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
43 lines (31 loc) · 1.5 KB

File metadata and controls

43 lines (31 loc) · 1.5 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import absolute_import
import os
import sys
from hatchling.metadata.plugin.interface import MetadataHookInterface
class CustomMetadataHook(MetadataHookInterface):
def update(self, metadata):
metadata["optional-dependencies"] = get_optional_dependencies(self.root)
def get_optional_dependencies(root):
def read_feature_deps(feature):
req_file = os.path.join(root, "requirements", "extras", f"{feature}_requirements.txt")
with open(req_file, encoding="utf-8") as f:
return list(filter(lambda d: not d.startswith("#"), f.read().splitlines()))
optional_dependencies = {"all": []}
for feature in ("feature-processor", "huggingface", "local", "scipy", "sagemaker-mlflow"):
dependencies = read_feature_deps(feature)
optional_dependencies[feature] = dependencies
optional_dependencies["all"].extend(dependencies)
# Test dependencies come last because we don't want them in `all`
optional_dependencies["test"] = read_feature_deps("test")
optional_dependencies["test"].extend(optional_dependencies["all"])
# remove torch and torchvision if python version is not 3.10/3.11
if sys.version_info.minor not in (10, 11):
optional_dependencies["test"] = list(
filter(
lambda d: not d.startswith(
("sentencepiece", "transformers", "torch", "torchvision")
),
optional_dependencies["test"],
)
)
return optional_dependencies
Morty Proxy This is a proxified and sanitized view of the page, visit original site.