You can use Docker to easily try out or test sendgrid-python.
- Install Docker on your machine.
- Run
docker run -it sendgrid/sendgrid-python.
This Docker image contains
sendgrid-pythonandpython-http-client- Stoplight's Prism, which lets you try out the API without actually sending email
toxand all supported Python versions, set up to testsendgrid-pythonor your own fork
Run it in interactive mode with -it.
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.
The easiest way to use an old version is to use an old tag.
$ docker run -it sendgrid/sendgrid-python:v3.6.1Tags from before this Docker image was created might not exist yet. You may manually download old versions in order to use them.
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.
For instance, to install sendgrid-python 3.6.1 and use the current python-http-client:
$ git clone https://github.com/sendgrid/sendgrid-python.git --branch v3.6.1
$ realpath sendgrid-python
/path/to/sendgrid-python
$ docker run -it -v /path/to/sendgrid-python:/mnt/sendgrid-python sendgrid/sendgrid-pythonTo install sendgrid-python v3.6.1 and use an older version of python-http-client:
$ git clone https://github.com/sendgrid/sendgrid-python.git --branch v3.6.1
$ realpath sendgrid-python
/path/to/sendgrid-python
$ git clone https://github.com/sendgrid/python-http-client.git --branch v1.2.4
$ realpath python-http-client
/path/to/python-http-client
$ docker run -it -v /path/to/sendgrid-python:/mnt/sendgrid-python \
> -v /path/to/python-http-client:/mnt/python-http-client \
> sendgrid/sendgrid-python$ git clone https://github.com/you/cool-sendgrid-python.git
$ realpath cool-sendgrid-python
/path/to/cool-sendgrid-python
$ docker run -it -v /path/to/cool-sendgrid-python:/mnt/sendgrid-python sendgrid/sendgrid-pythonNote that the paths you specify in -v must be absolute.
- Install docker-compose on your machine.
- Must copy sendgrid.env to .env file.
- Edit .env file for your versions and paths.
- Must create env folder for clone yours repo.
- Have fun! :D
$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'
$ sed -ie 's/HTTP_CLIENT_VERSION=vy.x.z/HTTP_CLIENT_VERSION=vx.y.z/g'$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid-dev$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'
$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid-betaTesting is easy! Run the container, cd sendgrid, and run tox.
