Skip to content

Commit a7a0e80

Browse files
Merge pull request #75 from StrikerRUS/pypi
fixed Travis, converted README and version as file
2 parents ee2b073 + 7b6fcfd commit a7a0e80

File tree

10 files changed

+194
-127
lines changed

10 files changed

+194
-127
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ bin/
1010
include/
1111
lib/
1212
.env
13+
smtpapi/VERSION.txt

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: python
22
python:
3-
- '2.6'
4-
- '2.7'
5-
- '3.4'
6-
- '3.5'
3+
- '2.6'
4+
- '2.7'
5+
- '3.4'
6+
- '3.5'
77
install:
88
- python setup.py install
99
- pip install codecov

MANIFEST.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
include README.md
1+
include README.rst LICENSE.txt VERSION.txt
2+
recursive-include smtpapi *.py *.txt
3+
prune test

README.md

Lines changed: 0 additions & 111 deletions
This file was deleted.

README.rst

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
.. image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
2+
:target: https://www.sendgrid.com
3+
:alt: SendGrid Logo
4+
5+
|Travis Badge| |Email Notifications Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed|
6+
7+
**This module helps build SendGrid's SMTP API headers.**
8+
9+
Learn more about the SMTP API at `SendGrid documentation`_.
10+
11+
Announcements
12+
=============
13+
14+
All updates to this module is documented in our `CHANGELOG`_.
15+
16+
Table of Contents
17+
=================
18+
19+
- `Installation <#installation>`__
20+
- `Quick Start <#quick-start>`__
21+
- `Usage <#usage>`__
22+
- `Roadmap <#roadmap>`__
23+
- `How to Contribute <#how-to-contribute>`__
24+
- `Local Setup of the Project <#local-setup-of-the-project>`__
25+
- `About <#about>`__
26+
- `License <#license>`__
27+
28+
Installation
29+
============
30+
31+
Prerequisites
32+
-------------
33+
34+
- Python version 2.6, 2.7, 3.4 or 3.5
35+
- The SendGrid service, starting at the `free level`_
36+
37+
Install Package
38+
---------------
39+
40+
.. code:: bash
41+
42+
pip install smtpapi
43+
44+
Setup Environment Variables
45+
---------------------------
46+
47+
Update the development environment with your `SENDGRID_API_KEY`_, for example:
48+
49+
.. code:: bash
50+
51+
cp .env_sample .env
52+
53+
In ``.env`` set ``SENDGRID_API_KEY`` to your own API key.
54+
55+
You can add your environment variables to your environment by sourcing the file:
56+
57+
.. code:: bash
58+
59+
source .env
60+
61+
Quick Start
62+
===========
63+
64+
.. code:: python
65+
66+
from smtpapi import SMTPAPIHeader
67+
68+
header = SMTPAPIHeader()
69+
header.add_to('[email protected]')
70+
print(header.json_string())
71+
72+
Usage
73+
=====
74+
75+
- `SendGrid documentation`_
76+
- `Example Code`_
77+
78+
Roadmap
79+
=======
80+
81+
If you are interested in the future direction of this project, please take a look at our `milestones`_.
82+
We would love to hear your feedback.
83+
84+
How to Contribute
85+
=================
86+
87+
We encourage contribution to our projects, please see our `CONTRIBUTING`_ guide for details.
88+
89+
Quick links:
90+
91+
- `Feature Request`_
92+
- `Bug Reports`_
93+
- `Sign the CLA to Create a Pull Request`_
94+
- `Improvements to the Codebase`_
95+
96+
Local Setup of the Project
97+
==========================
98+
99+
The simplest local development workflow is by using docker.
100+
101+
Steps:
102+
103+
1. Install Docker
104+
2. Run ``docker-compose build`` (this builds the container)
105+
3. Run ``docker-compose up`` (this runs tests by default)
106+
107+
About
108+
=====
109+
110+
**smtpapi-python** is guided and supported by the SendGrid `Developer Experience Team`_.
111+
112+
**smtpapi-python** is maintained and funded by SendGrid, Inc.
113+
The names and logos for **smtpapi-python** are trademarks of SendGrid, Inc.
114+
115+
License
116+
=======
117+
118+
`The MIT License (MIT)`_
119+
120+
.. _SendGrid documentation: https://sendgrid.com/docs/API_Reference/SMTP_API/index.html
121+
.. _CHANGELOG: https://github.com/sendgrid/smtpapi-python/blob/master/CHANGELOG.md
122+
.. _free level: https://sendgrid.com/free?source=sendgrid-python
123+
.. _SENDGRID_API_KEY: https://app.sendgrid.com/settings/api_keys
124+
.. _Example Code: https://github.com/sendgrid/smtpapi-python/tree/master/examples
125+
.. _milestones: https://github.com/sendgrid/smtpapi-python/milestones
126+
.. _CONTRIBUTING: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md
127+
.. _Feature Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#feature-request
128+
.. _Bug Reports: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#submit-a-bug-report
129+
.. _Sign the CLA to Create a Pull Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#cla
130+
.. _Improvements to the Codebase: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#improvements-to-the-codebase
131+
.. _Developer Experience Team: mailto:[email protected]
132+
.. _The MIT License (MIT): https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.txt
133+
134+
.. |Travis Badge| image:: https://travis-ci.org/sendgrid/smtpapi-python.svg?branch=master
135+
:target: https://travis-ci.org/sendgrid/smtpapi-python
136+
.. |Email Notifications Badge| image:: https://dx.sendgrid.com/badge/python
137+
:target: https://dx.sendgrid.com/newsletter/python
138+
.. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow
139+
:target: https://twitter.com/sendgrid
140+
.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/smtpapi-python/master.svg?style=flat-square&label=Codecov+Coverage
141+
:target: https://codecov.io/gh/sendgrid/smtpapi-python
142+
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/smtpapi.svg
143+
:target: https://pypi.org/project/smtpapi/
144+
.. |PyPI Version| image:: https://img.shields.io/pypi/v/smtpapi.svg
145+
:target: https://pypi.org/project/smtpapi/
146+
.. |GitHub contributors| image:: https://img.shields.io/github/contributors/sendgrid/smtpapi-python.svg
147+
:target: https://github.com/sendgrid/smtpapi-python/graphs/contributors
148+
.. |MIT Licensed| image:: https://img.shields.io/badge/license-MIT-blue.svg
149+
:target: https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.txt

VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3.1

setup.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1+
import io
2+
import os
3+
from distutils.file_util import copy_file
14
from setuptools import setup, find_packages
25

6+
7+
dir_path = os.path.abspath(os.path.dirname(__file__))
8+
readme = io.open(os.path.join(dir_path, 'README.rst'), encoding='utf-8').read()
9+
version = io.open(os.path.join(dir_path, 'VERSION.txt'), encoding='utf-8').read().strip()
10+
copy_file(os.path.join(dir_path, 'VERSION.txt'),
11+
os.path.join(dir_path, 'smtpapi', 'VERSION.txt'),
12+
verbose=0)
313
setup(
414
name='smtpapi',
5-
version='0.3.1',
15+
version=version,
616
author='Yamil Asusta, Kane Kim',
717
8-
packages=find_packages(),
18+
url='https://github.com/sendgrid/smtpapi-python/',
19+
packages=find_packages(exclude=["test"]),
20+
include_package_data=True,
921
license='MIT License',
1022
description='Simple wrapper to use SendGrid SMTP API',
11-
long_description='Simple wrapper to use SendGrid SMTP API',
23+
long_description=readme,
24+
classifiers=[
25+
'Programming Language :: Python :: 2.6',
26+
'Programming Language :: Python :: 2.7',
27+
'Programming Language :: Python :: 3.4',
28+
'Programming Language :: Python :: 3.5',
29+
],
1230
)

smtpapi/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import json, decimal
1+
import decimal
2+
import json
3+
import os
4+
5+
6+
dir_path = os.path.dirname(os.path.realpath(__file__))
7+
if os.path.isfile(os.path.join(dir_path, 'VERSION.txt')):
8+
__version__ = open(os.path.join(dir_path, 'VERSION.txt')).read().strip()
29

310
class _CustomJSONEncoder(json.JSONEncoder):
411

test/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ def setUp(self):
104104
'./CODE_OF_CONDUCT.md',
105105
'./CONTRIBUTING.md',
106106
['./LICENSE.md', './LICENSE.txt'],
107-
'./README.md',
107+
'./README.rst',
108108
'./TROUBLESHOOTING.md',
109109
'./USAGE.md',
110-
'./USE_CASES.md',
110+
'./VERSION.txt',
111111
]
112112

113113
self.file_not_found_message = 'File "{0}" does not exist in repo!'

test/test_project.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def test_license(self):
5555
def test_pr_template(self):
5656
self.assertEqual(True, os.path.isfile('./.github/PULL_REQUEST_TEMPLATE'))
5757

58-
# ./README.md
58+
# ./README.rst
5959
def test_readme(self):
60-
self.assertEqual(True, os.path.isfile('./README.md'))
60+
self.assertEqual(True, os.path.isfile('./README.rst'))
6161

6262
# ./TROUBLESHOOTING.md
6363
def test_troubleshooting(self):
@@ -67,9 +67,9 @@ def test_troubleshooting(self):
6767
def test_usage(self):
6868
self.assertEqual(True, os.path.isfile('./USAGE.md'))
6969

70-
# ./USE_CASES.md
70+
# ./VERSION.txt
7171
def test_use_cases(self):
72-
self.assertEqual(True, os.path.isfile('./USE_CASES.md'))
72+
self.assertEqual(True, os.path.isfile('./VERSION.txt'))
7373

7474
if __name__ == '__main__':
75-
unittest.main()
75+
unittest.main()

0 commit comments

Comments
 (0)