Skip to content

Commit ff4f62d

Browse files
authored
Merge branch 'master' into fastapi-inprocess
2 parents 04887c6 + 9f372a5 commit ff4f62d

File tree

99 files changed

+1884
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1884
-509
lines changed

.github/workflows/codeql.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "CodeQL"
2+
on:
3+
push:
4+
branches: [ "master" ]
5+
pull_request:
6+
branches: [ "master" ]
7+
schedule:
8+
- cron: '30 8 * * *'
9+
jobs:
10+
analyze:
11+
name: Analyze (${{ matrix.language }})
12+
runs-on: ${{ 'ubuntu-latest' }}
13+
permissions:
14+
security-events: write
15+
packages: read
16+
17+
strategy:
18+
matrix:
19+
include:
20+
- language: python
21+
build-mode: none
22+
- language: java-kotlin
23+
build-mode: none
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@4b1d7da102ff94aca014c0245062b1a463356d72
29+
with:
30+
languages: ${{ matrix.language }}
31+
build-mode: ${{ matrix.build-mode }}
32+
- name: Perform CodeQL Analysis
33+
uses: github/codeql-action/analyze@4b1d7da102ff94aca014c0245062b1a463356d72
34+
with:
35+
category: "/language:${{matrix.language}}"

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## v2.227.0 (2024-07-30)
4+
5+
### Features
6+
7+
* added code scanning through CodeQL
8+
9+
### Bug Fixes and Other Changes
10+
11+
* Fixed cpu isntance type for the estimator register test
12+
* update image_uri_configs 07-29-2024 11:28:28 PST
13+
* avoid AccessDenied error for a while on SageMaker Studio wtih do…
14+
* SMP PT 2.3 Fix
15+
* chore: pin framework version in serverless inference tests
16+
* image uri in TGI 2.2.0 image
17+
* explicitly access enum member values to avoid Python version related regression
18+
* chore: add huggingface TGI 2.2.0 config
19+
* update image_uri_configs 07-22-2024 11:53:54 PST
20+
* update image_uri_configs 07-17-2024 07:17:38 PST
21+
* update image_uri_configs 07-16-2024 07:17:45 PST
22+
* add support for new regions
23+
24+
## v2.226.1 (2024-07-17)
25+
26+
## v2.226.0 (2024-07-12)
27+
28+
### Features
29+
30+
* Curated hub improvements
31+
* InferenceSpec support for MMS and testing
32+
33+
### Bug Fixes and Other Changes
34+
35+
* ModelBuilder not passing HF_TOKEN to model.
36+
* update image_uri_configs 07-10-2024 07:18:04 PST
37+
338
## v2.225.0 (2024-07-10)
439

540
### Features

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ recursive-include requirements *
88
include VERSION
99
include LICENSE.txt
1010
include README.rst
11+
include hatch_build.py
1112

1213
prune tests
1314

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.225.1.dev0
1+
2.227.1.dev0

hatch_build.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from __future__ import absolute_import
2+
3+
import os
4+
import sys
5+
6+
from hatchling.metadata.plugin.interface import MetadataHookInterface
7+
8+
9+
class CustomMetadataHook(MetadataHookInterface):
10+
def update(self, metadata):
11+
metadata["optional-dependencies"] = get_optional_dependencies(self.root)
12+
13+
14+
def get_optional_dependencies(root):
15+
16+
def read_feature_deps(feature):
17+
req_file = os.path.join(root, "requirements", "extras", f"{feature}_requirements.txt")
18+
with open(req_file, encoding="utf-8") as f:
19+
return list(filter(lambda d: not d.startswith("#"), f.read().splitlines()))
20+
21+
optional_dependencies = {"all": []}
22+
23+
for feature in ("feature-processor", "huggingface", "local", "scipy"):
24+
dependencies = read_feature_deps(feature)
25+
optional_dependencies[feature] = dependencies
26+
optional_dependencies["all"].extend(dependencies)
27+
28+
# Test dependencies come last because we don't want them in `all`
29+
optional_dependencies["test"] = read_feature_deps("test")
30+
optional_dependencies["test"].extend(optional_dependencies["all"])
31+
32+
# remove torch and torchvision if python version is not 3.10/3.11
33+
if sys.version_info.minor not in (10, 11):
34+
optional_dependencies["test"] = list(
35+
filter(
36+
lambda d: not d.startswith(
37+
("sentencepiece", "transformers", "torch", "torchvision")
38+
),
39+
optional_dependencies["test"],
40+
)
41+
)
42+
43+
return optional_dependencies

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,90 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "sagemaker"
7+
dynamic = ["version", "optional-dependencies"]
8+
description = "Open source library for training and deploying models on Amazon SageMaker."
9+
readme = "README.rst"
10+
requires-python = ">=3.8"
11+
authors = [
12+
{ name = "Amazon Web Services" },
13+
]
14+
keywords = [
15+
"AI",
16+
"AWS",
17+
"Amazon",
18+
"ML",
19+
"MXNet",
20+
"Tensorflow",
21+
]
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"License :: OSI Approved :: Apache Software License",
26+
"Natural Language :: English",
27+
"Programming Language :: Python",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
]
33+
dependencies = [
34+
"attrs>=23.1.0,<24",
35+
"boto3>=1.34.142,<2.0",
36+
"cloudpickle==2.2.1",
37+
"docker",
38+
"google-pasta",
39+
"importlib-metadata>=1.4.0,<7.0",
40+
"jsonschema",
41+
"numpy>=1.9.0,<2.0",
42+
"packaging>=20.0",
43+
"pandas",
44+
"pathos",
45+
"platformdirs",
46+
"protobuf>=3.12,<5.0",
47+
"psutil",
48+
"PyYAML~=6.0",
49+
"requests",
50+
"schema",
51+
"smdebug_rulesconfig==1.0.1",
52+
"tblib>=1.7.0,<4",
53+
"tqdm",
54+
"urllib3>=1.26.8,<3.0.0",
55+
]
56+
57+
[project.scripts]
58+
sagemaker-upgrade-v2 = "sagemaker.cli.compatibility.v2.sagemaker_upgrade_v2:main"
59+
60+
[project.urls]
61+
Homepage = "https://github.com/aws/sagemaker-python-sdk"
62+
63+
[tool.hatch.version]
64+
path = "VERSION"
65+
pattern = "(?P<version>.+)"
66+
67+
# Dynamically define optional dependencies from requirements.txt files so
68+
# they can be be tracked by Dependabot
69+
[tool.hatch.metadata.hooks.custom]
70+
71+
[tool.hatch.build.targets.wheel]
72+
packages = ["src/sagemaker"]
73+
exclude = ["src/sagemaker/serve/model_server/triton/pack_conda_env.sh"]
74+
75+
[tool.hatch.build.targets.wheel.shared-scripts]
76+
"src/sagemaker/serve/model_server/triton/pack_conda_env.sh" = "pack_conda_env.sh"
77+
78+
[tool.hatch.build.targets.sdist]
79+
only-include = [
80+
"/requirements/extras",
81+
"/src",
82+
"/VERSION",
83+
]
84+
85+
[tool.pytest.ini_options]
86+
addopts = ["-vv"]
87+
testpaths = ["tests"]
88+
189
[tool.black]
290
line-length = 100

requirements/extras/test_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
tox==3.24.5
2+
build[virtualenv]==1.2.1
23
flake8==4.0.1
34
pytest==6.2.5
45
pytest-cov==3.0.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
build==1.2.1
12
twine==5.0.0

setup.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

setup.py

Lines changed: 28 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -14,122 +14,55 @@
1414
from __future__ import absolute_import
1515

1616
import os
17-
from glob import glob
17+
import re
1818
import sys
19+
from ast import literal_eval
20+
from glob import glob
21+
from pathlib import Path
1922

2023
from setuptools import find_packages, setup
2124

22-
23-
def read(fname):
25+
sys.stderr.write(
2426
"""
25-
Args:
26-
fname:
27-
"""
28-
return open(os.path.join(os.path.dirname(__file__), fname)).read()
29-
27+
===============================
28+
Unsupported installation method
29+
===============================
3030
31-
def read_version():
32-
return read("VERSION").strip()
31+
This version of sagemaker no longer supports installation with `python setup.py install`.
3332
33+
Please use `python -m pip install .` instead.
34+
"""
35+
)
3436

35-
def read_requirements(filename):
36-
"""Reads requirements file which lists package dependencies.
37-
38-
Args:
39-
filename: type(str) Relative file path of requirements.txt file
37+
HERE = Path(__file__).parent.absolute()
38+
PYPROJECT = HERE.joinpath("pyproject.toml").read_text(encoding="utf-8")
39+
BUILD_SCRIPT = HERE.joinpath("hatch_build.py").read_text(encoding="utf-8")
4040

41-
Returns:
42-
list of dependencies extracted from file
43-
"""
44-
with open(os.path.abspath(filename)) as fp:
45-
deps = [line.strip() for line in fp.readlines()]
46-
return deps
4741

42+
def get_dependencies():
43+
pattern = r"^dependencies = (\[.*?\])$"
44+
array = re.search(pattern, PYPROJECT, flags=re.MULTILINE | re.DOTALL).group(1)
45+
return literal_eval(array)
4846

49-
# Declare minimal set for installation
50-
required_packages = [
51-
"attrs>=23.1.0,<24",
52-
"boto3>=1.34.142,<2.0",
53-
"cloudpickle==2.2.1",
54-
"google-pasta",
55-
"numpy>=1.9.0,<2.0",
56-
"protobuf>=3.12,<5.0",
57-
"smdebug_rulesconfig==1.0.1",
58-
"importlib-metadata>=1.4.0,<7.0",
59-
"packaging>=20.0",
60-
"pandas",
61-
"pathos",
62-
"schema",
63-
"PyYAML~=6.0",
64-
"jsonschema",
65-
"platformdirs",
66-
"tblib>=1.7.0,<4",
67-
"urllib3>=1.26.8,<3.0.0",
68-
"requests",
69-
"docker",
70-
"tqdm",
71-
"psutil",
72-
]
7347

74-
# Specific use case dependencies
75-
# Keep format of *_requirements.txt to be tracked by dependabot
76-
extras = {
77-
"local": read_requirements("requirements/extras/local_requirements.txt"),
78-
"scipy": read_requirements("requirements/extras/scipy_requirements.txt"),
79-
"feature-processor": read_requirements(
80-
"requirements/extras/feature-processor_requirements.txt"
81-
),
82-
"huggingface": read_requirements("requirements/extras/huggingface_requirements.txt"),
83-
}
84-
# Meta dependency groups
85-
extras["all"] = [item for group in extras.values() for item in group]
86-
# Tests specific dependencies (do not need to be included in 'all')
87-
test_dependencies = read_requirements("requirements/extras/test_requirements.txt")
88-
# test dependencies are a superset of testing and extra dependencies
89-
test_dependencies.extend(extras["all"])
90-
# remove torch and torchvision if python version is not 3.10/3.11
91-
if sys.version_info.minor != 10 or sys.version_info.minor != 11:
92-
test_dependencies = [
93-
module
94-
for module in test_dependencies
95-
if not (
96-
module.startswith("transformers")
97-
or module.startswith("sentencepiece")
98-
or module.startswith("torch")
99-
or module.startswith("torchvision")
100-
)
101-
]
48+
def get_optional_dependencies():
49+
pattern = r"^def get_optional_dependencies.+"
50+
function = re.search(pattern, BUILD_SCRIPT, flags=re.MULTILINE | re.DOTALL).group(0)
51+
identifiers = {}
52+
exec(function, None, identifiers)
53+
return identifiers["get_optional_dependencies"](str(HERE))
10254

103-
extras["test"] = (test_dependencies,)
10455

10556
setup(
10657
name="sagemaker",
107-
version=read_version(),
108-
description="Open source library for training and deploying models on Amazon SageMaker.",
58+
version=HERE.joinpath("VERSION").read_text().strip(),
10959
packages=find_packages("src"),
11060
package_dir={"": "src"},
11161
package_data={"": ["*.whl"]},
11262
py_modules=[os.path.splitext(os.path.basename(path))[0] for path in glob("src/*.py")],
11363
include_package_data=True,
114-
long_description=read("README.rst"),
115-
author="Amazon Web Services",
116-
url="https://github.com/aws/sagemaker-python-sdk/",
117-
license="Apache License 2.0",
118-
keywords="ML Amazon AWS AI Tensorflow MXNet",
119-
python_requires=">= 3.8",
120-
classifiers=[
121-
"Development Status :: 5 - Production/Stable",
122-
"Intended Audience :: Developers",
123-
"Natural Language :: English",
124-
"License :: OSI Approved :: Apache Software License",
125-
"Programming Language :: Python",
126-
"Programming Language :: Python :: 3.8",
127-
"Programming Language :: Python :: 3.9",
128-
"Programming Language :: Python :: 3.10",
129-
"Programming Language :: Python :: 3.11",
130-
],
131-
install_requires=required_packages,
132-
extras_require=extras,
64+
install_requires=get_dependencies(),
65+
extras_require=get_optional_dependencies(),
13366
entry_points={
13467
"console_scripts": [
13568
"sagemaker-upgrade-v2=sagemaker.cli.compatibility.v2.sagemaker_upgrade_v2:main",

0 commit comments

Comments
 (0)