diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 3d89c6a..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,19 +0,0 @@ -engines: - duplication: - enabled: true - config: - languages: - - python - fixme: - enabled: true - markdownlint: - enabled: true - pep8: - enabled: true - radon: - enabled: true -ratings: - paths: - - "**.inc" - - "**.module" - - "**.py" \ No newline at end of file diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..2f5232b --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,15 @@ +name: Lint PR +on: + pull_request_target: + types: [ opened, edited, synchronize, reopened ] + +jobs: + validate: + name: Validate title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v4 + with: + types: chore docs fix feat test misc + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml new file mode 100644 index 0000000..9638a03 --- /dev/null +++ b/.github/workflows/test-and-deploy.yml @@ -0,0 +1,88 @@ +name: Test and Deploy +on: + push: + branches: [ '*' ] + tags: [ '*' ] + pull_request: + branches: [ main ] + schedule: + # Run automatically at 8AM PST Monday-Friday + - cron: '0 15 * * 1-5' + workflow_dispatch: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + python-version: [ '2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10' ] + steps: + - name: Checkout sendgrid-python-smtpapi + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Build & Test + run: make install test-install test + + deploy: + name: Deploy + if: success() && github.ref_type == 'tag' + needs: [ test ] + runs-on: ubuntu-latest + steps: + - name: Checkout sendgrid-python-smtpapi + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + pip install wheel + python setup.py sdist bdist_wheel + + - name: Create GitHub Release + uses: sendgrid/dx-automator/actions/release@main + with: + footer: '**[pypi](https://pypi.org/project/smtpapi/${version})**' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + + - name: Submit metric to Datadog + uses: sendgrid/dx-automator/actions/datadog-release-metric@main + env: + DD_API_KEY: ${{ secrets.DATADOG_API_KEY }} + + notify-on-failure: + name: Slack notify on failure + if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag') + needs: [ test, deploy ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: failure + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }} + SLACK_TITLE: Action Failure - ${{ github.repository }} + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3f53f34..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -dist: xenial # required for Python >= 3.7 -language: python -python: - - '2.7' - - '3.4' - - '3.5' - - '3.6' - - '3.7' - - '3.8' -install: - - make install - - make test-install - - pip install codecov -script: - - make test - - . venv/bin/activate; coverage run test/__init__.py - - . venv/bin/activate; flake8 --statistics --count -after_success: - - codecov -deploy: - provider: pypi - user: "__token__" - password: $PYPI_TOKEN - skip_cleanup: true - distributions: sdist bdist_wheel - on: - branch: master - condition: "$TRAVIS_TEST_RESULT = 0" - tags: true - python: '3.6' - -notifications: - slack: - if: branch = master - on_pull_requests: false - on_success: never - on_failure: change - rooms: - - secure: GBYjICnJwGDgb3CM8STuWXESuR2hUZHkl1oCQC8Vd9WmId281AeMflMw3GIo9Ay+uY0+TXUIUihxS61SuX9T/LP4lV7b47dH9BzQ7IbVVfCaOtgq7KmkD4dCeaA8X5zvTktrpMcS1b2WNKKaExCkuetj80dJRSX5vw1s+zl3o5U= diff --git a/CHANGELOG.md b/CHANGELOG.md index 1713e79..6d884e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,60 @@ # Change Log -All notable changes to this project will be documented in this file. +All the notable changes to this project will be documented in this file. + +[2022-03-09] Version 0.4.12 +--------------------------- +**Library - Chore** +- [PR #112](https://github.com/sendgrid/smtpapi-python/pull/112): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)! + + +[2022-02-09] Version 0.4.11 +--------------------------- +**Library - Chore** +- [PR #111](https://github.com/sendgrid/smtpapi-python/pull/111): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)! +- [PR #110](https://github.com/sendgrid/smtpapi-python/pull/110): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)! +- [PR #109](https://github.com/sendgrid/smtpapi-python/pull/109): merge test and deploy gh action workflows. Thanks to [@Hunga1](https://github.com/Hunga1)! + + +[2022-01-12] Version 0.4.10 +--------------------------- +**Library - Chore** +- [PR #108](https://github.com/sendgrid/smtpapi-python/pull/108): update license year. Thanks to [@JenniferMah](https://github.com/JenniferMah)! + + +[2021-12-01] Version 0.4.9 +-------------------------- +**Library - Chore** +- [PR #107](https://github.com/sendgrid/smtpapi-python/pull/107): migrate to GitHub Actions. Thanks to [@JenniferMah](https://github.com/JenniferMah)! + + +[2021-09-22] Version 0.4.8 +-------------------------- +**Library - Chore** +- [PR #106](https://github.com/sendgrid/smtpapi-python/pull/106): test against python v3.9. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)! + + +[2020-12-02] Version 0.4.7 +-------------------------- +**Library - Chore** +- [PR #63](https://github.com/sendgrid/smtpapi-python/pull/63): Add .codeclimate.yml and update test/__init__.py. Thanks to [@geomars](https://github.com/geomars)! + + +[2020-09-28] Version 0.4.6 +-------------------------- +**Library - Docs** +- [PR #57](https://github.com/sendgrid/smtpapi-python/pull/57): Few typos and grammatical mistake corrected. Thanks to [@yudhik11](https://github.com/yudhik11)! +- [PR #61](https://github.com/sendgrid/smtpapi-python/pull/61): Add pull request info to CONTRIBUTING and README. Thanks to [@shorrock](https://github.com/shorrock)! + + +[2020-08-19] Version 0.4.5 +-------------------------- +**Library - Docs** +- [PR #72](https://github.com/sendgrid/smtpapi-python/pull/72): Fix .md with Grammar.ly. Thanks to [@ssiddhantsharma](https://github.com/ssiddhantsharma)! +- [PR #70](https://github.com/sendgrid/smtpapi-python/pull/70): Correct *.md files using Grammarly. Thanks to [@myzeprog](https://github.com/myzeprog)! + +**Library - Chore** +- [PR #105](https://github.com/sendgrid/smtpapi-python/pull/105): update GitHub branch references to use HEAD. Thanks to [@thinkingserious](https://github.com/thinkingserious)! + [2020-07-08] Version 0.4.4 -------------------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b0d7109..53bcd2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,57 +1,11 @@ -Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies. +Hello! Thank you for choosing to help contribute to one of the Twilio SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies. -- [CLAs and CCLAs](#cla) -- [Roadmap & Milestones](#roadmap) -- [Feature Request](#feature-request) -- [Submit a Bug Report](#submit-a-bug-report) - [Improvements to the Codebase](#improvements-to-the-codebase) - [Understanding the Code Base](#understanding-the-codebase) - [Testing](#testing) - [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions) - [Creating a Pull Request](#creating-a-pull-request) - - -We use [Milestones](https://github.com/sendgrid/smtpapi-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 review, comments, suggestions and additional PRs are welcomed and encouraged. - - -## CLAs and CCLAs - -Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project. - -Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution. - -SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla). - -When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change. - -There are a few ways to contribute, which we'll enumerate below: - - -## Feature Request - -If you'd like to make a feature request, please read this section. - -The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions: - -- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests. -- Please be respectful and considerate of others when commenting on issues - - -## Submit a Bug Report - -Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public. - -A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report. - -Before you decide to create a new issue, please try the following: - -1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post. -2. Update to the latest version of this code and check if issue has already been fixed -3. Copy and fill in the Bug Report Template we have provided below - -### Please use our Bug Report Template - -In order to make the process easier, we've included a [sample bug report template](ISSUE_TEMPLATE.md). +- [Code Reviews](#code-reviews) ## Improvements to the Codebase @@ -77,7 +31,7 @@ cd smtpapi-python ##### Execute: ##### -See the [examples folder](https://github.com/sendgrid/smtpapi-python/tree/master/examples) to get started quickly. +See the [examples folder](examples) to get started quickly. ## Understanding the Code Base @@ -99,9 +53,9 @@ Builds the SMTPAPI header. All PRs require passing tests before the PR will be reviewed. -All test files are in the [`test`](https://github.com/sendgrid/smtpapi-python/tree/master/test) directory. +All the test files are in the [`test`](test) directory. -For the purposes of contributing to this repo, please update the [`__init__.py`](https://github.com/sendgrid/smtpapi-python/blob/master/test/__init__.py) file with unit tests as you modify the code. +For the purposes of contributing to this repo, please update the [`__init__.py`](test/__init__.py) file with unit tests as you modify the code. ```bash python setup.py install @@ -151,7 +105,7 @@ Please run your code through: 4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) - or your code is unlikely be merged into the main project. Use Git's + or your code is unlikely to be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. @@ -173,3 +127,9 @@ Please run your code through: 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `development` branch. All tests must be passing before we will review the PR. + +## Code Reviews +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/). diff --git a/Dockerfile b/Dockerfile index 8f5a44f..527ece2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:xenial ENV PYTHON_VERSIONS='python2.6 python2.7 python3.4 python3.5 python3.6' \ - OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json" + OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/oai_stoplight.json" # install testing versions of python, including old versions, from deadsnakes RUN set -x \ @@ -17,7 +17,7 @@ RUN set -x \ WORKDIR /root # install Prism -ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh +ADD https://raw.githubusercontent.com/stoplightio/prism/HEAD/install.sh install.sh RUN chmod +x ./install.sh && \ ./install.sh && \ rm ./install.sh diff --git a/FIRST-TIMERS.md b/FIRST-TIMERS.md deleted file mode 100644 index 1b296cd..0000000 --- a/FIRST-TIMERS.md +++ /dev/null @@ -1,77 +0,0 @@ -# How To Contribute to SendGrid Repositories via GitHub - Contributing to the SendGrid is easy! All you need to do is find an open issue (see the bottom of this page for a list of repositories containing open issues), fix it and submit a pull request. Once you have submitted your pull request, the team can easily review it before it is merged into the repository. - To make a pull request, follow these steps: - 1. Log into GitHub. If you do not already have a GitHub account, you will have to create one in order to submit a change. Click the Sign up link in the upper right-hand corner to create an account. Enter your username, password, and email address. If you are an employee of SendGrid, please use your full name with your GitHub account and enter SendGrid as your company so we can easily identify you. - - - - 2. __[Fork](https://help.github.com/fork-a-repo/)__ the [smtpapi-python](https://github.com/sendgrid/smtpapi-python) repository: - - - - 3. __Clone__ your fork via the following commands: - - ``` - # Clone your fork of the repo into the current directory - git clone https://github.com/your_username/smtpapi-python - # Navigate to the newly cloned directory - cd smtpapi-python - # Assign the original repo to a remote called "upstream" - git remote add upstream https://github.com/sendgrid/smtpapi-python - ``` - - > Don't forget to replace *your_username* in the URL by your real GitHub username. - - 4. __Create a new topic branch__ (off the main project development branch) to - contain your feature, change, or fix: - -``` - git checkout -b -``` - - 5. __Commit your changes__ in logical chunks. Please adhere to these [git commit - message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) - or your code is unlikely be merged into the main project. Use Git's - [interactive rebase](https://help.github.com/articles/interactive-rebase) - feature to tidy up your commits before making them public. Probably you will also have to create tests (if needed) or create or update the example code that demonstrates the functionality of this change to the code. - 6. __Locally merge (or rebase)__ the upstream development branch into your topic branch: - - ``` - git pull [--rebase] upstream master - ``` - - 7. __Push__ your topic branch up to your fork: - ``` - git push origin - ``` - 8. __[Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#changing-the-branch-range-and-destination-repository/)__ - with a clear title and description against the `master` branch. All tests must be passing before we will review the PR. - - ### Important notice - Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](./CONTRIBUTING.md) file. - ## Repositories with Open, Easy, Help Wanted, Issue Filters - * [Python SDK](https://github.com/sendgrid/sendgrid-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [PHP SDK](https://github.com/sendgrid/sendgrid-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [C# SDK](https://github.com/sendgrid/sendgrid-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Ruby SDK](https://github.com/sendgrid/sendgrid-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Node.js SDK](https://github.com/sendgrid/sendgrid-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Java SDK](https://github.com/sendgrid/sendgrid-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Go SDK](https://github.com/sendgrid/sendgrid-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Python STMPAPI Client](https://github.com/sendgrid/smtpapi-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [PHP STMPAPI Client](https://github.com/sendgrid/smtpapi-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [C# STMPAPI Client](https://github.com/sendgrid/smtpapi-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Ruby STMPAPI Client](https://github.com/sendgrid/smtpapi-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Node.js STMPAPI Client](https://github.com/sendgrid/smtpapi-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Java STMPAPI Client](https://github.com/sendgrid/smtpapi-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Go STMPAPI Client](https://github.com/sendgrid/smtpapi-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Python HTTP Client](https://github.com/sendgrid/python-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [PHP HTTP Client](https://github.com/sendgrid/php-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [C# HTTP Client](https://github.com/sendgrid/csharp-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Java HTTP Client](https://github.com/sendgrid/java-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Ruby HTTP Client](https://github.com/sendgrid/ruby-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Go HTTP Client](https://github.com/sendgrid/rest/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Node.js HTTP Client](https://github.com/sendgrid/nodejs-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Open Source Data Collector](https://github.com/sendgrid/open-source-library-data-collector/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Open API Definition](https://github.com/sendgrid/sendgrid-oai/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [DX Automator](https://github.com/sendgrid/dx-automator/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) -* [Documentation](https://github.com/sendgrid/docs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22) \ No newline at end of file diff --git a/FIRST_TIMERS.md b/FIRST_TIMERS.md new file mode 100644 index 0000000..ade7912 --- /dev/null +++ b/FIRST_TIMERS.md @@ -0,0 +1,53 @@ +# How To Contribute to Twilio SendGrid Repositories via GitHub +Contributing to the Twilio SendGrid repositories is easy! All you need to do is find an open issue (see the bottom of this page for a list of repositories containing open issues), fix it and submit a pull request. Once you have submitted your pull request, the team can easily review it before it is merged into the repository. + +To make a pull request, follow these steps: + +1. Log into GitHub. If you do not already have a GitHub account, you will have to create one in order to submit a change. Click the Sign up link in the upper right-hand corner to create an account. Enter your username, password, and email address. If you are an employee of Twilio SendGrid, please use your full name with your GitHub account and enter Twilio SendGrid as your company so we can easily identify you. + + + +2. __[Fork](https://help.github.com/fork-a-repo/)__ the [smtpapi-python](https://github.com/sendgrid/smtpapi-python) repository: + + + +3. __Clone__ your fork via the following commands: + +```bash +# Clone your fork of the repo into the current directory +git clone https://github.com/your_username/smtpapi-python +# Navigate to the newly cloned directory +cd smtpapi-python +# Assign the original repo to a remote called "upstream" +git remote add upstream https://github.com/sendgrid/smtpapi-python +``` + +> Don't forget to replace *your_username* in the URL by your real GitHub username. + +4. __Create a new topic branch__ (off the main project development branch) to contain your feature, change, or fix: + +```bash +git checkout -b +``` + +5. __Commit your changes__ in logical chunks. + +Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. Probably you will also have to create tests (if needed) or create or update the example code that demonstrates the functionality of this change to the code. + +6. __Locally merge (or rebase)__ the upstream development branch into your topic branch: + +```bash +git pull [--rebase] upstream main +``` + +7. __Push__ your topic branch up to your fork: + +```bash +git push origin +``` + +8. __[Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#changing-the-branch-range-and-destination-repository/)__ with a clear title and description against the `main` branch. All tests must be passing before we will review the PR. + +## Important notice + +Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](CONTRIBUTING.md) file. diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index 56dbe14..0000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,26 +0,0 @@ - - -### Issue Summary -A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples. - -### Steps to Reproduce -1. This is the first step -2. This is the second step -3. Further steps, etc. - -### Code Snippet -```python -# paste code here -``` - -### Exception/Log -``` -# paste exception/log here -``` - -### Technical details: -* smtpapi-python version: -* python version: - diff --git a/LICENSE.md b/LICENSE similarity index 59% rename from LICENSE.md rename to LICENSE index 35244b0..3154774 100644 --- a/LICENSE.md +++ b/LICENSE @@ -1,13 +1,13 @@ -The MIT License (MIT) +MIT License -Copyright (C) 2020, Twilio SendGrid, Inc. +Copyright (C) 2023, Twilio SendGrid, Inc. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/MANIFEST.in b/MANIFEST.in index 9feef94..20d9d81 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include README.rst LICENSE.md VERSION.txt +include README.rst LICENSE VERSION.txt recursive-include smtpapi *.py *.txt prune test diff --git a/Makefile b/Makefile index 7cff157..3e3bb1a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ venv: @python --version || (echo "Python is not installed, please install Python 2 or Python 3"; exit 1); + pip install virtualenv virtualenv --python=python venv install: venv @@ -13,6 +14,8 @@ test-install: test: . venv/bin/activate; python -m unittest discover -v . venv/bin/activate; python test/__init__.py + . venv/bin/activate; flake8 --statistics --count + . venv/bin/activate; coverage run test/__init__.py clean: nopyc rm -rf venv diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 215059a..8a966bb 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ We appreciate the effort for this pull request but before that please make sure Please format the PR title appropriately based on the type of change: [!]: -Where is one of: docs, chore, feat, fix, test. +Where is one of: docs, chore, feat, fix, test, misc. Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature). **All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.** @@ -19,13 +19,13 @@ Closes #2 A short description of what this PR does. ### Checklist -- [ ] I acknowledge that all my contributions will be made under the project's license +- [x] I acknowledge that all my contributions will be made under the project's license - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar) -- [ ] I have read the [Contribution Guidelines](CONTRIBUTING.md) and my PR follows them +- [ ] I have read the [Contribution Guidelines](https://github.com/sendgrid/smtpapi-python/blob/main/CONTRIBUTING.md) and my PR follows them - [ ] I have titled the PR appropriately -- [ ] I have updated my branch with the master branch +- [ ] I have updated my branch with the main branch - [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] I have added necessary documentation about the functionality in the appropriate .md file +- [ ] I have added the necessary documentation about the functionality in the appropriate .md file - [ ] I have added inline documentation to the code I modified -If you have questions, please file a [support ticket](https://twilio.com/help/contact), or create a GitHub Issue in this repository. +If you have questions, please file a [support ticket](https://support.sendgrid.com). diff --git a/README.rst b/README.rst index 75a36ff..4b6041f 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ :target: https://www.sendgrid.com :alt: SendGrid Logo -|Travis Badge| |Email Notifications Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed| +|Test and Deploy Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed| **This module helps build SendGrid's SMTP API headers.** @@ -10,8 +10,7 @@ Learn more about the SMTP API at `SendGrid documentation`_. Announcements ============= - -All updates to this module is documented in our `CHANGELOG`_. +All the updates to this module are documented in our `CHANGELOG`_. Table of Contents ================= @@ -19,7 +18,6 @@ Table of Contents - `Installation <#installation>`__ - `Quick Start <#quick-start>`__ - `Usage <#usage>`__ -- `Roadmap <#roadmap>`__ - `How to Contribute <#how-to-contribute>`__ - `Local Setup of the Project <#local-setup-of-the-project>`__ - `About <#about>`__ @@ -75,32 +73,24 @@ Usage - `SendGrid documentation`_ - `Example Code`_ -Roadmap -======= - -If you are interested in the future direction of this project, please take a look at our `milestones`_. -We would love to hear your feedback. - How to Contribute ================= -We encourage contribution to our projects, please see our `CONTRIBUTING`_ guide for details. +We encourage contribution to our projects, please see our `CONTRIBUTING`_ guide for more details. Quick links: -- `Feature Request`_ -- `Bug Reports`_ -- `Sign the CLA to Create a Pull Request`_ - `Improvements to the Codebase`_ +- `Review Pull Requests`_ Local Setup of the Project ========================== -The simplest local development workflow is by using docker. +The simplest local development workflow is by using Docker. Steps: -1. Install Docker +1. Install [Docker](https://www.docker.com/) 2. Run ``docker-compose build`` (this builds the container) 3. Run ``docker-compose up`` (this runs tests by default) @@ -116,25 +106,20 @@ License `The MIT License (MIT)`_ .. _SendGrid documentation: https://sendgrid.com/docs/API_Reference/SMTP_API/index.html -.. _CHANGELOG: https://github.com/sendgrid/smtpapi-python/blob/master/CHANGELOG.md +.. _CHANGELOG: https://github.com/sendgrid/smtpapi-python/blob/HEAD/CHANGELOG.md .. _free level: https://sendgrid.com/free?source=sendgrid-python .. _SENDGRID_API_KEY: https://app.sendgrid.com/settings/api_keys -.. _Example Code: https://github.com/sendgrid/smtpapi-python/tree/master/examples -.. _milestones: https://github.com/sendgrid/smtpapi-python/milestones -.. _CONTRIBUTING: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md -.. _Feature Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#feature-request -.. _Bug Reports: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#submit-a-bug-report -.. _Sign the CLA to Create a Pull Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#cla -.. _Improvements to the Codebase: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#improvements-to-the-codebase -.. _The MIT License (MIT): https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.md - -.. |Travis Badge| image:: https://travis-ci.org/sendgrid/smtpapi-python.svg?branch=master - :target: https://travis-ci.org/sendgrid/smtpapi-python -.. |Email Notifications Badge| image:: https://dx.sendgrid.com/badge/python - :target: https://dx.sendgrid.com/newsletter/python +.. _Example Code: https://github.com/sendgrid/smtpapi-python/tree/HEAD/examples +.. _CONTRIBUTING: https://github.com/sendgrid/smtpapi-python/blob/HEAD/CONTRIBUTING.md +.. _Improvements to the Codebase: https://github.com/sendgrid/smtpapi-python/blob/HEAD/CONTRIBUTING.md#improvements-to-the-codebase +.. _Review Pull Requests: https://github.com/sendgrid/smtpapi-python/blob/HEAD/CONTRIBUTING.md#code-reviews) +.. _The MIT License (MIT): https://github.com/sendgrid/smtpapi-python/blob/HEAD/LICENSE + +.. |Test and Deploy Badge| image:: https://github.com/sendgrid/smtpapi-python/actions/workflows/test-and-deploy.yml/badge.svg + :target: https://github.com/sendgrid/smtpapi-python/actions/workflows/test-and-deploy.yml .. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow :target: https://twitter.com/sendgrid -.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/smtpapi-python/master.svg?style=flat-square&label=Codecov+Coverage +.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/smtpapi-python/main.svg?style=flat-square&label=Codecov+Coverage :target: https://codecov.io/gh/sendgrid/smtpapi-python .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/smtpapi.svg :target: https://pypi.org/project/smtpapi/ @@ -143,4 +128,4 @@ License .. |GitHub contributors| image:: https://img.shields.io/github/contributors/sendgrid/smtpapi-python.svg :target: https://github.com/sendgrid/smtpapi-python/graphs/contributors .. |MIT Licensed| image:: https://img.shields.io/badge/license-MIT-blue.svg - :target: https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.md + :target: https://github.com/sendgrid/smtpapi-python/blob/HEAD/LICENSE diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index af15ede..717dcfa 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -1,7 +1,5 @@ If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). -If you can't find a solution below, please open an [issue](https://github.com/sendgrid/smtpapi-python/issues). - ## Table of Contents * [Viewing the Request Body](#request-body) diff --git a/USAGE.md b/USAGE.md index a2060fc..737d565 100644 --- a/USAGE.md +++ b/USAGE.md @@ -90,7 +90,7 @@ You can add as many of the SMTP API methods as you want to a single large JSON s The above example is formatted for readability. Headers must be wrapped to keep the line length under 72. By RFC 821 no line can be longer than 1,000, so if you are going to generate this string yourself it is a good idea to make sure that you wrap it. ## Requirements and Limitations -While there is a hard limit of 10,000 addresses that can be sent to in a multiple recipient e-mail, it is best to split up large jobs to around 1,000 recipients, to better allow for the processing load to be distributed. Furthermore, if you have a large number of additional substitutions or sections in the headers, it is best to split the send into even smaller groups. +While there is a hard limit of 10,000 addresses that can be sent to in a multiple recipient e-mail, it is best to split up large jobs to around 1,000 recipients, to better allow for the processing load to be distributed. Furthermore, if you have numerous additional substitutions or sections in the headers, it is best to split the group into even smaller groups. # Settings (Filters) @@ -332,7 +332,7 @@ You can specify up to 25 groups to display. ``` ## Groups -You can find your group IDs by looking at the Group ID column in the Unsubscribe Groups UI, or by calling the [GET method](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html#-GET) of the groups resource. +You can find your group IDs by looking at the Group ID column in the Unsubscribe Groups UI, or by calling the [GET method](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html#-GET) of the group's resource. # Unique Arguments diff --git a/VERSION.txt b/VERSION.txt index 6f2743d..75274d8 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.4.4 +0.4.12 diff --git a/setup.py b/setup.py index 50b5a32..1777899 100644 --- a/setup.py +++ b/setup.py @@ -31,5 +31,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', ], ) diff --git a/test/__init__.py b/test/__init__.py index 149d225..417fadc 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,11 +1,15 @@ import decimal import json import os -import unittest import datetime from smtpapi import SMTPAPIHeader +try: + import unittest2 as unittest +except ImportError: + import unittest + class TestSMTPAPI(unittest.TestCase): @@ -82,7 +86,7 @@ def test_drop_empty(self): self.assertEqual(self.dropsHeader, json.loads(header.json_string())) def test_license_year(self): - LICENSE_FILE = 'LICENSE.md' + LICENSE_FILE = 'LICENSE' copyright_line = '' with open(LICENSE_FILE, 'r') as f: for line in f: @@ -101,18 +105,14 @@ class TestRepository(unittest.TestCase): def setUp(self): self.required_files = [ - ['./Dockerfile', './docker/Dockerfile'], - ['./docker-compose.yml', './docker/docker-compose.yml'], - './.codeclimate.yml', + './Dockerfile', './.env_sample', - './ISSUE_TEMPLATE.md', './PULL_REQUEST_TEMPLATE.md', './.gitignore', - './.travis.yml', './CHANGELOG.md', './CODE_OF_CONDUCT.md', './CONTRIBUTING.md', - ['./LICENSE.md', './LICENSE.txt'], + './LICENSE', './README.rst', './TROUBLESHOOTING.md', './USAGE.md', diff --git a/test/test_project.py b/test/test_project.py index fdd3684..888cc41 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -26,14 +26,6 @@ def test_env(self): def test_gitignore(self): self.assertTrue(os.path.isfile('./.gitignore')) - # ./.travis.yml - def test_travis(self): - self.assertTrue(os.path.isfile('./.travis.yml')) - - # ./.codeclimate.yml - def test_codeclimate(self): - self.assertTrue(os.path.isfile('./.codeclimate.yml')) - # ./CHANGELOG.md def test_changelog(self): self.assertTrue(os.path.isfile('./CHANGELOG.md')) @@ -46,15 +38,9 @@ def test_code_of_conduct(self): def test_contributing(self): self.assertTrue(os.path.isfile('./CONTRIBUTING.md')) - # ./ISSUE_TEMPLATE.md - def test_issue_template(self): - self.assertTrue(os.path.isfile('./ISSUE_TEMPLATE.md')) - - # ./LICENSE.md + # ./LICENSE def test_license(self): - self.assertTrue( - os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt') - ) + self.assertTrue(os.path.isfile('./LICENSE')) # ./PULL_REQUEST_TEMPLATE.md def test_pr_template(self): diff --git a/twilio_sendgrid_logo.png b/twilio_sendgrid_logo.png new file mode 100644 index 0000000..a4c2223 Binary files /dev/null and b/twilio_sendgrid_logo.png differ