Skip to content

Commit 91f4cd8

Browse files
author
Sam Harrison
committed
docs: update the Docker test integration docs
A top-level Dockerfile is now present which can be used to test this repo with prism.
1 parent 6728946 commit 91f4cd8

13 files changed

+23
-582
lines changed

CONTRIBUTING.md

+23-87
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,21 @@ All third party contributors acknowledge that any contributions they provide wil
77
- [Please use our Bug Report Template](#please-use-our-bug-report-template)
88
- [Improvements to the Codebase](#improvements-to-the-codebase)
99
- [Development Environment](#development-environment)
10-
- [There are two ways to get set up:](#there-are-two-ways-to-get-set-up)
11-
- [1. Using Docker](#1-using-docker)
12-
- [- OR -](#or)
13-
- [2. Install and Run Locally](#2-install-and-run-locally)
14-
- [Prerequisites](#prerequisites)
15-
- [Initial setup:](#initial-setup)
16-
- [Environment Variables](#environment-variables)
17-
- [Execute:](#execute)
10+
- [Prerequisites](#prerequisites)
11+
- [Initial setup](#initial-setup)
12+
- [Environment Variables](#environment-variables)
13+
- [Execute:](#execute)
1814
- [Understanding the Code Base](#understanding-the-code-base)
1915
- [Testing](#testing)
20-
- [Testing Multiple Versions of Python](#testing-multiple-versions-of-python)
21-
- [Prerequisites:](#prerequisites)
22-
- [Initial setup:](#initial-setup-1)
23-
- [Execute:](#execute-1)
2416
- [Style Guidelines & Naming Conventions](#style-guidelines--naming-conventions)
25-
- [Creating a Pull Request<a name="creating-a-pull-request"></a>](#creating-a-pull-requesta-name%22creating-a-pull-request%22a)
17+
- [Creating a Pull Request](#creating-a-pull-request)
2618
- [Code Reviews](#code-reviews)
2719

2820
<a name="roadmap"></a>
2921
We use [Milestones](https://github.com/sendgrid/sendgrid-python/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community reviews, comments, suggestions, and additional PRs are welcomed and encouraged.
3022

3123
There are a few ways to contribute, which we'll enumerate below:
3224

33-
<a name="feature-request"></a>
3425
## Feature Request
3526

3627
If you'd like to make a feature request, please read this section.
@@ -40,7 +31,6 @@ The GitHub issue tracker is the preferred channel for library feature requests,
4031
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
4132
- Please be respectful and considerate of others when commenting on issues
4233

43-
<a name="submit-a-bug-report"></a>
4434
## Submit a Bug Report
4535

4636
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
@@ -57,34 +47,28 @@ Before you decide to create a new issue, please try the following:
5747

5848
In order to make the process easier, we've included a [sample bug report template](ISSUE_TEMPLATE.md).
5949

60-
<a name="improvements-to-the-codebase"></a>
6150
## Improvements to the Codebase
6251

6352
We welcome direct contributions to the sendgrid-python code base. Thank you!
6453

65-
### Development Environment ###
66-
#### There are two ways to get set up: ####
67-
#### 1. Using Docker ####
68-
This is usually the easiest and fastest way to get set up.
69-
You can use our Docker image to avoid setting up the development environment yourself. See [USAGE.md](https://github.com/sendgrid/sendgrid-python/blob/master/docker/USAGE.md).
54+
### Development Environment
7055

71-
#### - OR - ####
72-
#### 2. Install and Run Locally ####
56+
#### Prerequisites
7357

74-
##### Prerequisites #####
75-
76-
- Python 2.7 and 3.4+
58+
- Python version 2.7, 3.5, 3.6, 3.7, or 3.8
7759
- [python_http_client](https://github.com/sendgrid/python-http-client)
7860
- [ecdsa_python](https://github.com/starkbank/ecdsa-python)
61+
- [pyenv](https://github.com/yyuu/pyenv)
62+
- [tox](https://pypi.python.org/pypi/tox)
7963

80-
##### Initial setup: #####
64+
#### Initial setup
8165

8266
```bash
8367
git clone https://github.com/sendgrid/sendgrid-python.git
8468
cd sendgrid-python
8569
```
8670

87-
### Environment Variables
71+
#### Environment Variables
8872

8973
First, get your free Twilio SendGrid account [here](https://sendgrid.com/free?source=sendgrid-python).
9074

@@ -101,78 +85,31 @@ Then edit `.env` and insert your API key.
10185
source .env
10286
```
10387

104-
##### Execute: #####
88+
#### Execute
10589

10690
See the [examples folder](https://github.com/sendgrid/sendgrid-python/tree/master/examples) to get started quickly.
10791

10892
If testing from the root directory of this repo, create a new file (e.g. test.py) and replace `import sendgrid` with `from sendgrid import *`
10993

110-
<a name="understanding-the-codebase"></a>
11194
## Understanding the Code Base
11295

113-
**/examples**
114-
115-
Working examples that demonstrate usage.
116-
117-
**/tests**
118-
119-
Currently, we have unit and profiling tests.
96+
- **/examples**
97+
- Working examples that demonstrate usage.
98+
- **/tests**
99+
- Currently, we have unit and profiling tests.
100+
- **/sendgrid**
101+
- The Web API v3 client is `sendgrid.py`, the other files are legacy code for our mail send v2 endpoint.
120102

121-
**/sendgrid**
122-
123-
The Web API v3 client is `sendgrid.py`, the other files are legacy code for our mail send v2 endpoint.
124-
125-
<a name="testing"></a>
126103
## Testing
127104

128105
The PR must pass all the tests before it is reviewed.
129106

130-
All test files are in the [`test`](https://github.com/sendgrid/sendgrid-python/test) directory.
131-
132-
For the purposes of contributing to this repo, please update the [`test_sendgrid.py`](https://github.com/sendgrid/sendgrid-python/tree/master/test/test_sendgrid.py) file with unit tests as you modify the code.
133-
134-
`python -m unittest discover -v`
135-
136-
### Testing Multiple Versions of Python
137-
138-
The PR must pass all the tests before it is reviewed.
139-
140-
#### Prerequisites: ####
141-
142-
The above local "Initial setup" is complete
107+
All test files are in the [`test`](https://github.com/sendgrid/sendgrid-python/test) directory. For the purposes of contributing to this repo, please update the [`test_sendgrid.py`](https://github.com/sendgrid/sendgrid-python/tree/master/test/test_sendgrid.py) file with unit tests as you modify the code.
143108

144-
* [pyenv](https://github.com/yyuu/pyenv)
145-
* [tox](https://pypi.python.org/pypi/tox)
146-
* [prism](https://github.com/stoplightio/prism) v0.6 - It should be available in your PATH, but unittest script
147-
will try to install it locally if not found. Apart from PATH env variable it will check in `~/bin` and `/usr/local/bin`.
148-
You can install it by yourself in user dir by calling `source test/prism.sh`.
109+
The integration tests require a Twilio SendGrid mock API in order to execute. We've simplified setting this up using Docker to run the tests. You will just need [Docker Desktop](https://docs.docker.com/get-docker/) and `make`.
149110

150-
#### Initial setup: ####
151-
152-
Add ```eval "$(pyenv init -)"``` to your shell environment (.profile, .bashrc, etc) after installing tox, you only need to do this once.
153-
154-
```
155-
pyenv install 2.7.11
156-
pyenv install 3.4.3
157-
pyenv install 3.5.0
158-
```
159-
Make sure to change the current working directory to your local version of the repo before running the following command:
160-
```
161-
python setup.py install
162-
```
163-
```
164-
pyenv local 3.5.0 3.4.3 2.7.11
165-
pyenv rehash
166-
```
167-
168-
#### Execute: ####
169-
170-
```
171-
source venv/bin/activate
172-
tox
173-
```
111+
Once these are available, simply execute the Docker test target to run all tests: `make test-docker`. This command can also be used to open an interactive shell into the container where this library is installed. To start a *bash* shell for example, use this command: `command=bash make test-docker`.
174112

175-
<a name="style-guidelines-and-naming-conventions"></a>
176113
## Style Guidelines & Naming Conventions
177114

178115
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
@@ -185,7 +122,7 @@ Please run your code through:
185122
- [pylint](https://www.pylint.org/)
186123
- [pep8](https://pypi.python.org/pypi/pep8)
187124

188-
## Creating a Pull Request<a name="creating-a-pull-request"></a>
125+
## Creating a Pull Request
189126

190127
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
191128
and configure the remotes:
@@ -240,6 +177,5 @@ Please run your code through:
240177
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
241178
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
242179

243-
<a name="code-reviews"></a>
244180
## Code Reviews
245181
If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, GitHub has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).

docker-test/Dockerfile

-20
This file was deleted.

docker-test/README.md

-47
This file was deleted.

docker-test/entrypoint.sh

-17
This file was deleted.

docker-test/prism.sh

-50
This file was deleted.

docker/Dockerfile

-52
This file was deleted.

0 commit comments

Comments
 (0)