|
| 1 | +You can use Docker to easily try out or test sendgrid-python. |
| 2 | + |
| 3 | +<a name="Quickstart"></a> |
| 4 | +# Quickstart |
| 5 | + |
| 6 | +1. Install Docker on your machine. |
| 7 | +2. Run `docker run -it sendgrid/sendgrid-python`. |
| 8 | + |
| 9 | +<a name="Info"></a> |
| 10 | +# Info |
| 11 | + |
| 12 | +This Docker image contains |
| 13 | + - `sendgrid-python` and `python-http-client` |
| 14 | + - Stoplight's Prism, which lets you try out the API without actually sending email |
| 15 | + - `tox` and all supported Python versions, set up to test `sendgrid-python` or your own fork |
| 16 | + |
| 17 | +Run it in interactive mode with `-it`. |
| 18 | + |
| 19 | +You can mount repositories in the `/mnt/sendgrid-python` and `/mnt/python-http-client` directories to use them instead of the default SendGrid libraries. Read on for more info. |
| 20 | + |
| 21 | +<a name="Options"></a> |
| 22 | +# Options |
| 23 | + |
| 24 | +## Using an old version |
| 25 | + |
| 26 | +The easiest way to use an old version is to use an [old tag](https://github.com/sendgrid/sendgrid-python/releases). |
| 27 | + |
| 28 | +```sh-session |
| 29 | +$ docker run -it sendgrid/sendgrid-python:v3.6.1 |
| 30 | +``` |
| 31 | + |
| 32 | +Tags from before this Docker image was created might not exist yet. You may [manually download](#Versions) [old versions](https://github.com/sendgrid/sendgrid-python/releases) in order to use them. |
| 33 | + |
| 34 | +<a name="Versions"></a> |
| 35 | +## Specifying specific versions |
| 36 | + |
| 37 | +To use different versions of sendgrid-python or python-http-client - for instance, to replicate your production setup - mount them with the `-v <host_dir>:<container_dir>` option. When you put either repository under `/mnt`, the container will automatically detect it and make the proper symlinks. You can edit these files from the host machine while the container is running. |
| 38 | + |
| 39 | +For instance, to install sendgrid-python 3.6.1 and use the current python-http-client: |
| 40 | + |
| 41 | +```sh-session |
| 42 | +$ git clone https://github.com/sendgrid/sendgrid-python.git --branch v3.6.1 |
| 43 | +$ realpath sendgrid-python |
| 44 | +/path/to/sendgrid-python |
| 45 | +$ docker run -it -v /path/to/sendgrid-python:/mnt/sendgrid-python sendgrid/sendgrid-python |
| 46 | +``` |
| 47 | + |
| 48 | +To install sendgrid-python v3.6.1 and use an older version of python-http-client: |
| 49 | + |
| 50 | +```sh-session |
| 51 | +$ git clone https://github.com/sendgrid/sendgrid-python.git --branch v3.6.1 |
| 52 | +$ realpath sendgrid-python |
| 53 | +/path/to/sendgrid-python |
| 54 | +$ git clone https://github.com/sendgrid/python-http-client.git --branch v1.2.4 |
| 55 | +$ realpath python-http-client |
| 56 | +/path/to/python-http-client |
| 57 | +$ docker run -it -v /path/to/sendgrid-python:/mnt/sendgrid-python \ |
| 58 | +> -v /path/to/python-http-client:/mnt/python-http-client \ |
| 59 | +> sendgrid/sendgrid-python |
| 60 | +``` |
| 61 | + |
| 62 | +## Specifying your own fork: |
| 63 | + |
| 64 | +```sh-session |
| 65 | +$ git clone https://github.com/you/cool-sendgrid-python.git |
| 66 | +$ realpath cool-sendgrid-python |
| 67 | +/path/to/cool-sendgrid-python |
| 68 | +$ docker run -it -v /path/to/cool-sendgrid-python:/mnt/sendgrid-python sendgrid/sendgrid-python |
| 69 | +``` |
| 70 | + |
| 71 | +Note that the paths you specify in `-v` must be absolute. |
| 72 | + |
| 73 | +<a name="Testing"></a> |
| 74 | +# Testing |
| 75 | +Testing is easy! Run the container, `cd sendgrid`, and run `tox`. |
| 76 | + |
| 77 | +<a name="about"></a> |
| 78 | +# About |
| 79 | + |
| 80 | +sendgrid-python is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). |
| 81 | + |
| 82 | +sendgrid-python is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-python are trademarks of SendGrid, Inc. |
| 83 | + |
| 84 | + |
0 commit comments