Skip to content

Commit 15e9e7c

Browse files
authored
feature: Add release to PyPI. Change package name to sagemaker-pytorch-inference. (#39)
1 parent 00af7af commit 15e9e7c

10 files changed

+82
-19
lines changed

MANIFEST.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
recursive-include src/sagemaker_pytorch_serving_container *
2+
3+
include VERSION
4+
include LICENSE
5+
include README.rst
6+
7+
prune test
8+
9+
recursive-exclude * __pycache__
10+
recursive-exclude * *.py[co]

buildspec-deploy.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 0.2
2+
3+
phases:
4+
build:
5+
commands:
6+
- PACKAGE_FILE="$CODEBUILD_SRC_DIR_ARTIFACT_1/sagemaker_pytorch_inference-*.tar.gz"
7+
8+
# publish to pypi
9+
- publish-pypi-package $PACKAGE_FILE

buildspec-release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 0.2
2+
3+
phases:
4+
build:
5+
commands:
6+
# prepare the release (update versions, changelog etc.)
7+
- git-release --prepare
8+
9+
# run linters
10+
- tox -e flake8,twine
11+
12+
# run unit tests
13+
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
14+
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
15+
tox -e py27,py36 -- test/unit
16+
17+
# run local integ tests
18+
#- $(aws ecr get-login --no-include-email --region us-west-2)
19+
#- IGNORE_COVERAGE=- tox -e py27,py36 -- test/integ/local
20+
21+
# run sagemaker integ tests
22+
#- IGNORE_COVERAGE=- tox -e py27,py36 -- test/integ/sagemaker
23+
24+
# generate the distribution package
25+
- python3 setup.py sdist
26+
27+
# publish the release to github
28+
- git-release --publish
29+
30+
artifacts:
31+
files:
32+
- dist/sagemaker_pytorch_inference-*.tar.gz
33+
name: ARTIFACT_1
34+
discard-paths: yes

buildspec.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ phases:
3737
# run unit tests
3838
- pytest test/unit
3939

40-
# create wheel in dist/
41-
- python3 setup.py bdist_wheel
42-
- whl_name=$(ls dist/sagemaker_pytorch_serving_container*.whl)
43-
- cp $whl_name sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
40+
# create tar in dist/
41+
- python3 setup.py sdist
42+
- tar_name=$(ls dist/sagemaker_pytorch_inference-*.tar.gz)
43+
- cp $tar_name sagemaker_pytorch_inference.tar.gz
4444

4545
- cpu_dockerfile="Dockerfile.cpu"
4646
- gpu_dockerfile="Dockerfile.gpu"
4747

4848
# build py2 images
4949
- build_dir="docker/$FRAMEWORK_VERSION/py$CPU_PY2_VERSION"
50-
- cp sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl $build_dir/
50+
- cp sagemaker_pytorch_inference.tar.gz $build_dir/
5151
- cp -r docker/build_artifacts/* $build_dir/
5252
- CPU_PY2_TAG="$FRAMEWORK_VERSION-cpu-py2-$BUILD_ID"
5353
- GPU_PY2_TAG="$FRAMEWORK_VERSION-gpu-py2-$BUILD_ID"
@@ -56,7 +56,7 @@ phases:
5656

5757
# build py3 image
5858
- build_dir="docker/$FRAMEWORK_VERSION/py$GPU_PY3_VERSION"
59-
- cp sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl $build_dir/
59+
- cp sagemaker_pytorch_inference.tar.gz $build_dir/
6060
- cp -r docker/build_artifacts/* $build_dir/
6161
- CPU_PY3_TAG="$FRAMEWORK_VERSION-cpu-py3-$BUILD_ID"
6262
- GPU_PY3_TAG="$FRAMEWORK_VERSION-gpu-py3-$BUILD_ID"

docker/1.3.1/py2/Dockerfile.cpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ COPY config.properties /home/model-server
7777

7878
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py
7979

80-
COPY sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
80+
COPY sagemaker_pytorch_inference.tar.gz /sagemaker_pytorch_inference.tar.gz
8181
RUN pip install --no-cache-dir \
82-
/sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl \
83-
&& rm /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
82+
/sagemaker_pytorch_inference.tar.gz \
83+
&& rm /sagemaker_pytorch_inference.tar.gz
8484

8585
RUN curl https://aws-dlc-licenses.s3.amazonaws.com/pytorch/license.txt -o /license.txt
8686

docker/1.3.1/py2/Dockerfile.gpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ RUN apt-get install -y --no-install-recommends \
101101

102102
# RUN pip install --no-cache-dir 'opencv-python>=4.0,<4.1'
103103

104-
COPY sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
104+
COPY sagemaker_pytorch_inference.tar.gz /sagemaker_pytorch_inference.tar.gz
105105
RUN pip install --no-cache-dir \
106-
/sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl \
107-
&& rm /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
106+
/sagemaker_pytorch_inference.tar.gz \
107+
&& rm /sagemaker_pytorch_inference.tar.gz
108108

109109
RUN curl https://aws-dlc-licenses.s3.amazonaws.com/pytorch/license.txt -o /license.txt
110110

docker/1.3.1/py3/Dockerfile.cpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ COPY config.properties /home/model-server
7676

7777
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py
7878

79-
COPY sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
79+
COPY sagemaker_pytorch_inference.tar.gz /sagemaker_pytorch_inference.tar.gz
8080
RUN pip install --no-cache-dir \
81-
/sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl \
82-
&& rm /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
81+
/sagemaker_pytorch_inference.tar.gz \
82+
&& rm /sagemaker_pytorch_inference.tar.gz
8383

8484
RUN curl https://aws-dlc-licenses.s3.amazonaws.com/pytorch/license.txt -o /license.txt
8585

docker/1.3.1/py3/Dockerfile.gpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ COPY config.properties /home/model-server
9393

9494
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py
9595

96-
COPY sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
96+
COPY sagemaker_pytorch_inference.tar.gz /sagemaker_pytorch_inference.tar.gz
9797
RUN pip install --no-cache-dir \
98-
/sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl \
99-
&& rm /sagemaker_pytorch_serving_container-1.3-py2.py3-none-any.whl
98+
/sagemaker_pytorch_inference.tar.gz \
99+
&& rm /sagemaker_pytorch_inference.tar.gz
100100

101101
RUN curl https://aws-dlc-licenses.s3.amazonaws.com/pytorch/license.txt -o /license.txt
102102

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def read(fname):
2525

2626

2727
setup(
28-
name='sagemaker_pytorch_serving_container',
28+
name='sagemaker_pytorch_inference',
2929
version='1.3',
3030
description='Open source library for creating PyTorch containers to run on Amazon SageMaker.',
3131

tox.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ deps =
6969
flake8
7070
flake8-future-import
7171
commands = flake8
72+
73+
[testenv:twine]
74+
basepython = python3
75+
# https://github.com/pypa/twine/blob/master/docs/changelog.rst
76+
deps =
77+
twine>=1.12.0
78+
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup
79+
commands =
80+
python setup.py sdist
81+
twine check dist/*.tar.gz

0 commit comments

Comments
 (0)