### Running Make Install for Project Setup Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Executes the `make install` command, typically used in projects to automate the setup of development dependencies or compile necessary components. This step prepares the project for local development after cloning. ```Shell make install ``` -------------------------------- ### Verifying PyPI Installation of SparkPost Package Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Installs the `sparkpost` package from PyPI using `pip`. This command is used to confirm that the newly released version of the library is successfully available and installable by users. ```Shell pip install sparkpost ``` -------------------------------- ### Installing Tox for Multi-Version Testing Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Installs the `tox` package via `pip`. `tox` is a generic virtual environment management and test tool that automates testing against multiple Python versions and dependency configurations. ```Shell pip install tox ``` -------------------------------- ### Installing Virtualenv for Python Development Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md This command installs the `virtualenv` package using `pip`, which is essential for creating isolated Python environments. Virtual environments help manage project-specific dependencies without interfering with the global Python installation. ```Shell pip install virtualenv ``` -------------------------------- ### Installing Python 3.5.1 with Pyenv Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Installs Python version 3.5.1 using `pyenv`. This ensures that all specified Python versions are available for `tox` to execute tests against, covering a range of supported environments. ```Shell pyenv install 3.5.1 ``` -------------------------------- ### Installing SparkPost Python Client Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Installs the SparkPost Python API client library from PyPI using the pip package manager. This command is executed in a bash terminal and requires Python 2.7 or later. ```bash $ pip install sparkpost ``` -------------------------------- ### Re-running Tox After Pyenv Setup Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Executes `tox` again after `pyenv` has been used to install and set global Python versions. This ensures that `tox` can now run tests against the newly available Python environments, providing full test coverage. ```Shell tox ``` -------------------------------- ### Installing Python 2.7.11 with Pyenv Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Installs Python version 2.7.11 using `pyenv`, a tool for managing multiple Python versions. This is a prerequisite for comprehensive testing with `tox` if specific Python versions are not already present. ```Shell pyenv install 2.7.11 ``` -------------------------------- ### Installing Python 3.4.4 with Pyenv Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Installs Python version 3.4.4 using `pyenv`. This command is part of setting up the required Python environments for thorough testing across different major Python releases. ```Shell pyenv install 3.4.4 ``` -------------------------------- ### Activating Python Virtual Environment Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Activates the previously created virtual environment located in `venv/bin/`. Activating the environment ensures that all subsequent Python commands and package installations are confined to this isolated environment. ```Shell source venv/bin/activate ``` -------------------------------- ### Setting Global Python Versions with Pyenv Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Sets the specified Python versions (2.7.11, 3.4.4, 3.5.1) as the global default versions for `pyenv`. This allows `tox` to easily find and utilize these installed Python interpreters for testing. ```Shell pyenv global 2.7.11 3.4.4 3.5.1 ``` -------------------------------- ### Registering Python Package with PyPI Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Runs the `setup.py register` command, which is used to register the package with the Python Package Index (PyPI). This step is often a prerequisite for uploading packages and can help configure `~/.pypirc`. ```Shell python setup.py register ``` -------------------------------- ### Executing Make Release for PyPI Deployment Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Executes the `make release` command, which automates the process of creating distribution archives (dists) and uploading them to PyPI. This is a critical step for publishing new versions of the library. ```Shell make release ``` -------------------------------- ### Initializing SparkPost with Environment Variable API Key Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Initializes the SparkPost client. This method automatically uses the API key set in the `SPARKPOST_API_KEY` environment variable, which is the recommended approach for security and flexibility. ```python from sparkpost import SparkPost sp = SparkPost() # uses environment variable ``` -------------------------------- ### Running Tox for Comprehensive Testing Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Executes `tox` to run the project's tests across all supported Python versions and dependency combinations defined in the `tox.ini` configuration. This ensures broad compatibility and stability. ```Shell tox ``` -------------------------------- ### Running Local Python Tests with Make Source: https://github.com/sparkpost/python-sparkpost/blob/master/CONTRIBUTING.md Executes the project's test suite using the `make test` command. This runs tests against the current Python environment, providing immediate feedback on code changes and ensuring functionality. ```Shell make test ``` -------------------------------- ### Initializing SparkPost with Direct API Key Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Initializes the SparkPost client by directly passing the API key as a string argument. This method is an alternative to using environment variables, suitable for cases where direct key injection is preferred. ```python from sparkpost import SparkPost sp = SparkPost('YOUR API KEY') ``` -------------------------------- ### Adding Requests Dependencies for Google Cloud Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Specifies the required Python packages (`requests` and `requests-toolbelt`) to be added to the `requirements.txt` file for deploying a SparkPost application on Google Cloud. These libraries are essential for the underlying HTTP requests made by the `python-sparkpost` client. ```text requests requests-toolbelt ``` -------------------------------- ### Sending a Test Transmission with SparkPost Python Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Demonstrates how to send a test email (transmission) using the SparkPost Python client. It initializes the client, then calls the `transmissions.send` method with recipient, content, and sender details, utilizing the sandbox environment for testing. The response object contains details about the transmission, including accepted and rejected recipients. ```python from sparkpost import SparkPost sp = SparkPost() response = sp.transmissions.send( use_sandbox=True, recipients=['someone@somedomain.com'], html='

Hello world

', from_email='test@sparkpostbox.com', subject='Hello from python-sparkpost' ) print(response) # outputs {u'total_accepted_recipients': 1, u'id': u'47960765679942446', u'total_rejected_recipients': 0} ``` -------------------------------- ### Initializing SparkPost for EU/Enterprise Accounts Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Initializes the SparkPost client for EU or Enterprise accounts by specifying both the API key and the custom API host URL. This is necessary for connecting to non-default SparkPost API endpoints, such as `https://api.eu.sparkpost.com`. ```python from sparkpost import SparkPost sp = SparkPost('YOUR API KEY', 'https://api.eu.sparkpost.com') ``` -------------------------------- ### Configuring SparkPost Email Backend for Django Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Provides the necessary configuration settings for integrating the SparkPost email backend into a Django project's `settings.py` file. It defines the API key, base URI, and sets the `EMAIL_BACKEND` to use SparkPost's Django integration, allowing Django to send emails via SparkPost. ```python SPARKPOST_API_KEY = 'API_KEY' SPARKPOST_BASE_URI = 'api.sparkpost.com' EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend' ``` -------------------------------- ### Specifying Python Project Dependencies Source: https://github.com/sparkpost/python-sparkpost/blob/master/dev-requirements.txt This snippet defines the Python package dependencies and their version constraints for the project. It includes a reference to an external test requirements file, the 'wheel' package for distribution, 'Django' for web development within a specific version range, and 'tornado' for asynchronous networking. ```Python -r test-requirements.txt wheel Django>=1.7,<1.10 tornado>=3.2 ``` -------------------------------- ### Defining Python Project Dependencies Source: https://github.com/sparkpost/python-sparkpost/blob/master/test-requirements.txt This snippet specifies the Python packages and their exact versions required for the project's development and testing environment. It includes tools for code quality (flake8), testing (pytest, pytest-cov), HTTP requests (requests), mocking HTTP responses (responses), and general mocking (mock). ```Python flake8 pytest==2.8.7 pytest-cov==1.8.1 requests==2.20.1 responses==0.3.0 mock==2.0.0 ``` -------------------------------- ### Monkeypatching Requests for Google App Engine Source: https://github.com/sparkpost/python-sparkpost/blob/master/README.rst Provides Python code for `appengine_config.py` to enable the `requests` library, used by `python-sparkpost`, to function correctly within the Google App Engine environment. It imports necessary modules and applies a monkeypatch to adapt requests for App Engine's specific networking requirements. ```python import requests import requests_toolbelt.adapters.appengine requests_toolbelt.adapters.appengine.monkeypatch() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.