Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions sagemaker-mlops/src/sagemaker/__init__.py

This file was deleted.

38 changes: 38 additions & 0 deletions sagemaker-mlops/tests/unit/test_namespace_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Regression guard for GH #5795.

sagemaker-mlops must not ship its own top-level ``sagemaker/__init__.py``:
sagemaker-core owns that file, and having two distributions install the same
path makes strict installers / OS package managers refuse to co-install them.
The ``sagemaker`` package is a namespace shared across the sub-distributions.
"""

from __future__ import absolute_import

from pathlib import Path

_SRC = Path(__file__).resolve().parents[2] / "src"


def test_does_not_ship_top_level_sagemaker_init():
top_level_init = _SRC / "sagemaker" / "__init__.py"
assert not top_level_init.exists(), (
f"{top_level_init} must not exist: sagemaker-core owns "
"sagemaker/__init__.py (see GH #5795)."
)


def test_still_ships_the_subpackage_init():
# The distribution's own sub-package must remain a real package.
assert (_SRC / "sagemaker" / "mlops" / "__init__.py").exists()
4 changes: 2 additions & 2 deletions sagemaker-mlops/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ setenv =
deps =
-r ../requirements/tox/pylint_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc -j 0 src/sagemaker --fail-under=9.9
python -m pylint --rcfile=../.pylintrc -j 0 --recursive=y src/sagemaker --fail-under=9.9

[testenv:spelling]
skipdist = true
skip_install = true
deps =
-r ../requirements/tox/spelling_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US src/sagemaker/{posargs}
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US --recursive=y src/sagemaker/{posargs}

[testenv:twine]
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup
Expand Down
3 changes: 0 additions & 3 deletions sagemaker-serve/src/sagemaker/__init__.py

This file was deleted.

38 changes: 38 additions & 0 deletions sagemaker-serve/tests/unit/test_namespace_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Regression guard for GH #5795.

sagemaker-serve must not ship its own top-level ``sagemaker/__init__.py``:
sagemaker-core owns that file, and having two distributions install the same
path makes strict installers / OS package managers refuse to co-install them.
The ``sagemaker`` package is a namespace shared across the sub-distributions.
"""

from __future__ import absolute_import

from pathlib import Path

_SRC = Path(__file__).resolve().parents[2] / "src"


def test_does_not_ship_top_level_sagemaker_init():
top_level_init = _SRC / "sagemaker" / "__init__.py"
assert not top_level_init.exists(), (
f"{top_level_init} must not exist: sagemaker-core owns "
"sagemaker/__init__.py (see GH #5795)."
)


def test_still_ships_the_subpackage_init():
# The distribution's own sub-package must remain a real package.
assert (_SRC / "sagemaker" / "serve" / "__init__.py").exists()
4 changes: 2 additions & 2 deletions sagemaker-serve/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ setenv =
deps =
-r ../requirements/tox/pylint_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc -j 0 src/sagemaker --fail-under=9.9
python -m pylint --rcfile=../.pylintrc -j 0 --recursive=y src/sagemaker --fail-under=9.9

[testenv:spelling]
skipdist = true
skip_install = true
deps =
-r ../requirements/tox/spelling_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US src/sagemaker/{posargs}
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US --recursive=y src/sagemaker/{posargs}

[testenv:twine]
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup
Expand Down
3 changes: 0 additions & 3 deletions sagemaker-train/src/sagemaker/__init__.py

This file was deleted.

38 changes: 38 additions & 0 deletions sagemaker-train/tests/unit/test_namespace_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Regression guard for GH #5795.

sagemaker-train must not ship its own top-level ``sagemaker/__init__.py``:
sagemaker-core owns that file, and having two distributions install the same
path makes strict installers / OS package managers refuse to co-install them.
The ``sagemaker`` package is a namespace shared across the sub-distributions.
"""

from __future__ import absolute_import

from pathlib import Path

_SRC = Path(__file__).resolve().parents[2] / "src"


def test_does_not_ship_top_level_sagemaker_init():
top_level_init = _SRC / "sagemaker" / "__init__.py"
assert not top_level_init.exists(), (
f"{top_level_init} must not exist: sagemaker-core owns "
"sagemaker/__init__.py (see GH #5795)."
)


def test_still_ships_the_subpackage_init():
# The distribution's own sub-package must remain a real package.
assert (_SRC / "sagemaker" / "train" / "__init__.py").exists()
4 changes: 2 additions & 2 deletions sagemaker-train/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ setenv =
deps =
-r ../requirements/tox/pylint_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc -j 0 src/sagemaker --fail-under=9.9
python -m pylint --rcfile=../.pylintrc -j 0 --recursive=y src/sagemaker --fail-under=9.9

[testenv:spelling]
skipdist = true
skip_install = true
deps =
-r ../requirements/tox/spelling_requirements.txt
commands =
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US src/sagemaker/{posargs}
python -m pylint --rcfile=../.pylintrc --disable all --enable spelling --spelling-dict en_US --recursive=y src/sagemaker/{posargs}

[testenv:twine]
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup
Expand Down
Loading