-
Notifications
You must be signed in to change notification settings - Fork 3
/
tox.ini
130 lines (109 loc) · 3.17 KB
/
tox.ini
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[tox]
envlist = py37, py36, py38
[testenv] # the default env - coverage + parallalism
whitelist_externals =
/bin/echo
/bin/ls
deps =
pytest-xdist
coverage
pytest-cov
sagemaker[local]
passenv =
AWS_DEFAULT_REGION
AWS_REGION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
commands =
pytest --cov=simple_sagemaker --cov-append --cov-report=term-missing -n 4 --basetemp="{envtmpdir}" {posargs}
[testenv:single_proc] # no coverage nor parallelism
deps =
sagemaker[local]
pytest
commands =
pytest --basetemp="{envtmpdir}" {posargs}
[testenv:ssm] # run ssm cli
deps =
sagemaker[local]
commands =
ssm {posargs}
[testenv:bash] # run ssm cli
whitelist_externals =
/usr/bin/bash
/bin/bash
commands =
bash {posargs}
[testenv:no-coverage] # no coverage
commands =
pytest -n 4 --basetemp="{envtmpdir}" {posargs}
deps =
pytest-xdist
[testenv:report] # generate a coverage report
skip_install = true
deps = coverage
commands =
coverage html -i --include="*simple_sagemaker*" --omit="*worker_toolkit*","*shell_launcher.py"
coverage report --include="*simple_sagemaker*" --omit="*worker_toolkit*","*shell_launcher.py" --fail-under=85
coverage report --help
[testenv:clean] # clean up coverage data
skip_install = true
deps = coverage
commands = coverage erase
[tool:pytest]
testpaths = tests
### Formatting & linting
[flake8]
max-line-length = 127
extend-ignore = E203
[testenv:lint]
skip_install = true
setenv =
deps =
flake8
black
isort
commands =
flake8 ./src ./tests ./examples --count --statistics
isort --check-only ./src ./tests ./examples
black --check ./src ./tests ./examples
[testenv:cf] # Code Format
skip_install = true
deps =
black
isort
commands =
isort ./src ./tests ./examples
black ./src ./tests ./examples
[testenv:publish] # build & publish the code
skip_install = true
basepython = python3.7
setenv =
deps =
setuptools
wheel
twine
commands =
python setup.py sdist bdist_wheel
twine upload dist/*
[testenv:docs]
description = invoke sphinx-build to build the HTML docs
basepython = python3.7
changedir = docs
deps =
sphinx
sphinx-rtd-theme
whitelist_externals =
/usr/bin/make
commands =
sphinx-apidoc -f -o ./source ../src/simple_sagemaker ../src/simple_sagemaker/sm_task.py ../src/simple_sagemaker/s3_sync.py ../src/simple_sagemaker/iam_utils.py ../src/simple_sagemaker/ecr_sync.py ../src/simple_sagemaker/cli.py
make html
# Run a single test, e.g. for debugging
# tox -e single_proc -- --capture=no --log-cli-level=INFO -k single_file
# Run an ssm command line
# tox -e ssm -- run -p simple-sagemaker-example-cli -t task1 -e ./examples/cli_simple/worker.py --cs -o ./output --use_spot_instances 0
# Ececute a shell command
# tox -e bash -- ./examples/cli_simple/run.sh ./output
# Ececute a shell job
# tox -e ssm -- shell -p shell-cli -t shell-cli-task --cmd_line "ls -la" -o ./output --dir_files=./src/simple_sagemaker
# tox -e ssm -- shell -p shell-cli -t shell-cli-task --cmd_line "ls -la" -o ./output --df "RUN pip3 install pandas==0.25.3 scikit-learn==0.21.3" --repo_name "tt_repo" --aws_repo_name "tt_repo"