-
Notifications
You must be signed in to change notification settings - Fork 1.2k
change: Update package metadata #3529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ecd7349
change: Update package metadata
ofek dba42d8
Merge branch 'master' into modernize-metadata
benieric 9fb6c68
address feedback
ofek 8a3ccf4
support and deprecate legacy installations
ofek e46e5f9
Update MANIFEST.in
ofek 8b01037
Update test_requirements.txt
ofek 105da7b
make tests faster
ofek f43d274
Merge branch 'master' into modernize-metadata
benieric 4580738
apply correct formatting
ofek 06448c8
add required __future__ import
ofek 1267a4d
Merge branch 'master' into modernize-metadata
benieric 223387e
Update tox.ini
ofek c12d5c1
Merge remote-tracking branch 'upstream/master' into modernize-metadata
ofek d2a6515
Update pyproject.toml
ofek 5dd6488
Merge branch 'master' into modernize-metadata
sagemaker-bot d73a2f7
address feedback
ofek be72fcf
Merge branch 'master' into modernize-metadata
ofek 6527e23
Merge branch 'master' into modernize-metadata
benieric File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"): | ||
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,91 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "sagemaker" | ||
dynamic = ["version", "optional-dependencies"] | ||
description = "Open source library for training and deploying models on Amazon SageMaker." | ||
readme = "README.rst" | ||
license = "Apache-2.0" | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{ name = "Amazon Web Services" }, | ||
] | ||
keywords = [ | ||
"AI", | ||
"AWS", | ||
"Amazon", | ||
"ML", | ||
"MXNet", | ||
"Tensorflow", | ||
] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Natural Language :: English", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
dependencies = [ | ||
"attrs>=23.1.0,<24", | ||
"boto3>=1.34.142,<2.0", | ||
"cloudpickle==2.2.1", | ||
"docker", | ||
"google-pasta", | ||
"importlib-metadata>=1.4.0,<7.0", | ||
"jsonschema", | ||
"numpy>=1.9.0,<2.0", | ||
"packaging>=20.0", | ||
"pandas", | ||
"pathos", | ||
"platformdirs", | ||
"protobuf>=3.12,<5.0", | ||
"psutil", | ||
"PyYAML~=6.0", | ||
"requests", | ||
"schema", | ||
"smdebug_rulesconfig==1.0.1", | ||
"tblib>=1.7.0,<4", | ||
"tqdm", | ||
"urllib3>=1.26.8,<3.0.0", | ||
] | ||
|
||
[project.scripts] | ||
sagemaker-upgrade-v2 = "sagemaker.cli.compatibility.v2.sagemaker_upgrade_v2:main" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/aws/sagemaker-python-sdk" | ||
|
||
[tool.hatch.version] | ||
path = "VERSION" | ||
pattern = "(?P<version>.+)" | ||
|
||
# Dynamically define optional dependencies from requirements.txt files so | ||
# they can be be tracked by Dependabot | ||
[tool.hatch.metadata.hooks.custom] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/sagemaker"] | ||
exclude = ["src/sagemaker/serve/model_server/triton/pack_conda_env.sh"] | ||
|
||
[tool.hatch.build.targets.wheel.shared-scripts] | ||
"src/sagemaker/serve/model_server/triton/pack_conda_env.sh" = "pack_conda_env.sh" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
only-include = [ | ||
"/requirements/extras", | ||
"/src", | ||
"/VERSION", | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = ["-vv"] | ||
testpaths = ["tests"] | ||
|
||
[tool.black] | ||
line-length = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
tox==3.24.5 | ||
build[virtualenv]==1.2.1 | ||
flake8==4.0.1 | ||
pytest==6.2.5 | ||
pytest-cov==3.0.0 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build==1.2.1 | ||
twine==5.0.0 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw this but can you change this to be
license = {file = "LICENSE.txt"}
like mentioned hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is outdated actually the standard is being updated by PEP 639 which was always planned (allowing a string value). The license file is automatically picked up by Hatchling and included in the source distribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only blocker I have with this one currently is that when I run
python setup.py sdist
locally I get an error like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because PEP 639 is still in Draft can we do
license = {file = "LICENSE.txt"}
until then?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I removed the field instead because the license is automatically added to the source distribution.