You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
30
33
@@ -37,7 +40,7 @@ reported the issue. Please try to include as much information as you can. Detail
37
40
* A description of your environment or deployment.
38
41
39
42
40
-
## Contributing via Pull Requests (PRs)
43
+
## Contribute via Pull Requests (PRs)
41
44
42
45
Contributions via pull requests are much appreciated.
43
46
@@ -48,53 +51,53 @@ Before sending us a pull request, please ensure that:
48
51
* You open an issue to discuss any significant work - we would hate for your time to be wasted.
49
52
50
53
51
-
### Setting up Your Development Environment *[Optional, but Recommended]*
54
+
### Set up Your Development Environment *[Optional, but Recommended]*
52
55
53
56
1. Set up the Cloud9 environment:
54
57
1. Instance type: You'll need at least 4 GB of RAM to avoid running into memory issues. We recommend at least a t3.medium to run the unit tests. A larger host will reduce the chance of encountering resource limits.
55
58
1. Follow the instructions at [Creating a Cloud9 EC2 Environment](https://docs.aws.amazon.com/cloud9/latest/user-guide/create-environment.html#create-environment-main) to set up a Cloud9 EC2 environment.
56
59
1. Expand the storage of the EC2 instance from 10GB to 20GB:
57
-
1. Because you'll need a minimum of 11GB of disk storage on the EC2 instance to run the repository's unit tests, you'll need to expand your EC2 volume size. We recommend at least 20GB. A larger volume will reduce the chance of encountering resource limits.
60
+
1. Because you'll need a minimum of 11GB of disk storage on the EC2 instance to run the repository's unit tests, you'll need to expand your EC2 volume size. We recommend at least 20GB. A larger volume will reduce the chance of encountering resource limits.
58
61
1. Follow the instructions at [Modifying an EBS Volume Using Elastic Volumes (Console)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html#modify-ebs-volume) to increase the EBS volume size associated with the newly created EC2 instance.
59
62
1. Wait 5-10min for the new EBS volume increase to finalize.
60
63
1. Allow EC2 to claim the additional space by stopping and then starting your EC2 host.
61
64
62
65
63
-
### Pulling Down the Code
66
+
### Pull Down the Code
64
67
65
68
1. If you do not already have one, create a GitHub account by following the prompts at [Join Github](https://github.com/join).
66
69
1. Create a fork of this repository on GitHub. You should end up with a fork at `https://github.com/<username>/sagemaker-python-sdk`.
67
70
1. Follow the instructions at [Fork a Repo](https://help.github.com/en/articles/fork-a-repo) to fork a GitHub repository.
68
71
1. Clone your fork of the repository: `git clone https://github.com/<username>/sagemaker-python-sdk` where `<username>` is your github username.
69
72
70
73
71
-
### Running the Unit Tests
74
+
### Run the Unit Tests
72
75
73
76
1. Install tox using `pip install tox`
74
77
1. Install coverage using `pip install .[test]`
75
78
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
76
79
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`
77
80
78
-
You can also run a single test with the following command: `tox -e py36 -- -s -vv <path_to_file><file_name>::<test_function_name>`
81
+
You can also run a single test with the following command: `tox -e py36 -- -s -vv <path_to_file><file_name>::<test_function_name>`
79
82
* Note that the coverage test will fail if you only run a single test, so make sure to surround the command with `export IGNORE_COVERAGE=-` and `unset IGNORE_COVERAGE`
Our CI system runs integration tests (the ones in the `tests/integ` directory), in parallel, for every Pull Request.
86
-
You should only worry about manually running any new integration tests that you write, or integration tests that test an area of code that you've modified.
88
+
Our CI system runs integration tests (the ones in the `tests/integ` directory), in parallel, for every Pull Request.
89
+
You should only worry about manually running any new integration tests that you write, or integration tests that test an area of code that you've modified.
87
90
88
91
1. Follow the instructions at [Set Up the AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html).
89
92
1. To run a test, specify the test file and method you want to run per the following command: `tox -e py36 -- -s -vv <path_to_file><file_name>::<test_function_name>`
90
93
* Note that the coverage test will fail if you only run a single test, so make sure to surround the command with `export IGNORE_COVERAGE=-` and `unset IGNORE_COVERAGE`
If you are writing or modifying a test that creates a SageMaker job (training, tuner, or transform) or endpoint, it's important to assign a concurrency-friendly `job_name` (or `endpoint_name`), or your tests may fail randomly due to name collisions. We have a helper method `sagemaker.utils.unique_name_from_base(base, max_length)` that makes test-friendly names. You can find examples of how to use it [here](https://github.com/aws/sagemaker-python-sdk/blob/3816a5658d3737c9767e01bc8d37fc3ed5551593/tests/integ/test_tfs.py#L37) and
96
+
If you are writing or modifying a test that creates a SageMaker job (training, tuner, or transform) or endpoint, it's important to assign a concurrency-friendly `job_name` (or `endpoint_name`), or your tests may fail randomly due to name collisions. We have a helper method `sagemaker.utils.unique_name_from_base(base, max_length)` that makes test-friendly names. You can find examples of how to use it [here](https://github.com/aws/sagemaker-python-sdk/blob/3816a5658d3737c9767e01bc8d37fc3ed5551593/tests/integ/test_tfs.py#L37) and
94
97
[here](https://github.com/aws/sagemaker-python-sdk/blob/3816a5658d3737c9767e01bc8d37fc3ed5551593/tests/integ/test_tuner.py#L616), or by searching for "unique\_name\_from\_base" in our test code.
95
98
96
99
97
-
### Making and Testing Your Change
100
+
### Make and Test Your Change
98
101
99
102
1. Create a new git branch:
100
103
```shell
@@ -105,11 +108,12 @@ If you are writing or modifying a test that creates a SageMaker job (training, t
105
108
1. Prove that your code works correctly.
106
109
1. Guard against future breaking changes to lower the maintenance cost.
107
110
1. Please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
108
-
1. Run all the unit tests as per [Running the Unit Tests](#running-the-unit-tests), and verify that all checks and tests pass.
109
-
1. Note that this also runs tools that may be necessary for the automated build to pass (ex: code reformatting by 'black').
111
+
1. Run all the unit tests as per [Run the Unit Tests](#run-the-unit-tests), and verify that all checks and tests pass.
112
+
1. Note that this also runs tools that may be necessary for the automated build to pass (ex: code reformatting by 'black').
113
+
1. If your changes include documentation changes, please see the [Documentation Guidelines](#documentation-guidelines).
110
114
111
115
112
-
### Committing Your Change
116
+
### Commit Your Change
113
117
114
118
We use commit messages to update the project version number and generate changelog entries, so it's important for them to follow the right format. Valid commit messages include a prefix, separated from the rest of the message by a colon and a space. Here are a few examples:
115
119
@@ -135,17 +139,107 @@ Some of the prefixes allow abbreviation ; `break`, `feat`, `depr`, and `doc` are
135
139
For the rest of the message, use imperative style and keep things concise but informative. See [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) for guidance.
136
140
137
141
138
-
### Sending a Pull Request
142
+
### Send a Pull Request
139
143
140
144
GitHub provides additional document on [Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request/).
141
145
142
146
Please remember to:
143
-
* Use commit messages (and PR titles) that follow the guidelines under [Committing Your Change](#committing-your-change).
147
+
* Use commit messages (and PR titles) that follow the guidelines under [Commit Your Change](#commit-your-change).
144
148
* Send us a pull request, answering any default questions in the pull request interface.
145
149
* Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
146
150
147
151
148
-
## Finding Contributions to Work On
152
+
## Documentation Guidelines
153
+
154
+
We use reStructuredText (RST) for most of our documentation. For a quick primer on the syntax,
155
+
see [the Sphinx documentation](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html).
156
+
157
+
In this repository, we have two main categories of documentation: overviews and API references.
158
+
"How to" tutorials are housed in the [Amazon SageMaker Examples repository](https://github.com/awslabs/amazon-sagemaker-examples).
159
+
Overviews and API references are discussed in more detail below.
160
+
161
+
Here are some general guidelines to follow when writing either kind of documentation:
162
+
* Use present tense.
163
+
* 👍 "The estimator fits a model."
164
+
* 👎 "The estimator will fit a model."
165
+
* When referring to an AWS product, use its full name in the first invocation.
166
+
(This applies only to prose; use what makes sense when it comes to writing code, etc.)
167
+
* 👍 "Amazon S3"
168
+
* 👎 "s3"
169
+
* Provide links to other ReadTheDocs pages, AWS documentation, etc. when helpful.
170
+
Try to not duplicate documentation when you can reference it instead.
171
+
* Use meaningful text in a link.
172
+
* 👍 You can learn more about [hyperparameter tuning with SageMaker](https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html) in the SageMaker docs.
173
+
* 👎 Read more about it [here](#).
174
+
175
+
176
+
### Overviews
177
+
178
+
This section refers to documentation that discusses a specific topic or feature to
179
+
help the reader deepen their understanding, and may include short snippets of how to do specific tasks.
180
+
Examples include "[Amazon SageMaker Debugger](https://sagemaker.readthedocs.io/en/stable/amazon_sagemaker_debugger.html)"
181
+
and "[Use MXNet with the SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/using_mxnet.html)."
182
+
183
+
The goal of these documents is to explain basic usage.
184
+
This includes the general purpose of the topic or feature,
185
+
and common ways to use the SageMaker Python SDK in that context.
186
+
187
+
This type of documentation should not be a step-by-step tutorial.
188
+
That is better suited for the [example notebooks](https://github.com/awslabs/amazon-sagemaker-examples).
189
+
Instead, keep the content focused on the unique aspects of the feature.
190
+
For example, if one is writing specifically about deploying models,
191
+
there is no need to also include instructions on how to train a model first.
192
+
In this case, consider linking to existing documentation about training models and any other prerequisites.
193
+
194
+
Lastly, in addition to the general guidelines listed above:
195
+
* Use the imperative mood for headings.
196
+
* 👍 "Prepare a Training Script"
197
+
* 👎 "Preparing a Training Script"
198
+
* Don’t refer to features as "new" - they might be at the time of writing, but they won’t always be!
199
+
200
+
### API References (docstrings)
201
+
202
+
The API references are generated from docstrings.
203
+
A docstring is the comment in the source code that describes a module, class, function, or variable.
204
+
205
+
```python
206
+
def foo():
207
+
"""This comment is a docstring for the function foo."""
208
+
```
209
+
210
+
We use [Google-style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).
211
+
There should be a docstring for every public module, class, and function.
212
+
For functions, make sure your docstring covers all of the arguments, exceptions, and any other relevant information.
213
+
When possible, link to classes and functions, e.g. use ":class:~\`sagemaker.session.Session\`" over just "Session."
214
+
215
+
If a parameter of a function has a default value, please note what the default is.
216
+
If that default value is `None`, it can also be helpful to explain what happens when the parameter is `None`.
217
+
If `**kwargs` is part of the function signature, link to the parent class(es) or method(s) so that the reader knows where to find the available parameters.
218
+
219
+
For an example file with docstrings, see [the `processing` module](https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/processing.py).
220
+
221
+
To have a class's docstrings included in the API reference, it needs to be included in one of the files in the `doc/` folder.
222
+
For example, see the [Processing API reference](https://github.com/aws/sagemaker-python-sdk/blob/master/doc/processing.rst).
223
+
224
+
225
+
### Build and Test Documentation
226
+
227
+
To build the Sphinx docs, run the following commandin the `doc/` directory:
228
+
229
+
```shell
230
+
make html
231
+
```
232
+
233
+
You can then find the generated HTML files in`doc/_build/html/`.
234
+
235
+
To check both the README and API documentation for build errors, you can run the following:
236
+
237
+
```shell
238
+
tox -e twine,sphinx
239
+
```
240
+
241
+
242
+
## Find Contributions to Work On
149
243
150
244
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws/sagemaker-python-sdk/labels/help%20wanted) issues is a great place to start.
0 commit comments