diff --git a/.gitignore b/.gitignore
index 0487142..29d5072 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,3 +68,4 @@ cleanup.sh
*_example.py
.idea
README.txt
+python_http_client/VERSION.txt
diff --git a/MANIFEST.in b/MANIFEST.in
index 42eb410..4d284ec 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,3 @@
-include LICENSE.txt
+include LICENSE.txt VERSION.txt README.rst
+recursive-include python_http_client *.py *.txt
+prune tests
diff --git a/README.md b/README.md
deleted file mode 100644
index d77e674..0000000
--- a/README.md
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-[](https://travis-ci.org/sendgrid/python-http-client)
-[](https://dx.sendgrid.com/newsletter/python)
-[](https://twitter.com/sendgrid)
-[](https://codecov.io/gh/sendgrid/python-http-client)
-[](https://codeclimate.com/github/sendgrid/python-http-client)
-[](https://github.com/sendgrid/python-http-client/graphs/contributors)
-[](./LICENSE.txt)
-
-**Quickly and easily access any RESTful or RESTful-like API.**
-
-If you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-python).
-
-# Table of Contents
-
-* [Installation](#installation)
-* [Quick Start](#quick-start)
-* [Usage](#usage)
-* [Roadmap](#roadmap)
-* [How to Contribute](#contribute)
-- [Local set up](#local_setup)
-* [Troubleshooting](#troubleshooting)
-* [Announcements](#announcements)
-* [Thanks](#thanks)
-* [About](#about)
-* [License](#license)
-
-
-# Installation
-
-## Prerequisites
-
-- Python version 2.7 or 3.4+
-
-## Install Package
-
-```bash
-pip install python_http_client
-```
-
-or
-
-```bash
-easy_install python_http_client
-```
-
-## API Key
-
-Store your SendGrid API key in a .env file
-
-```bash
-cp .env_sample .env
-```
-
-Edit the `.env` file and add your API key.
-
-
-# Quick Start
-
-Here is a quick example:
-
-`GET /your/api/{param}/call`
-
-```python
-import python_http_client
-global_headers = {"Authorization": "Basic XXXXXXX"}
-client = Client(host='base_url', request_headers=global_headers)
-client.your.api._(param).call.get()
-print response.status_code
-print response.headers
-print response.body
-```
-
-`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning.
-
-```python
-import python_http_client
-global_headers = {"Authorization": "Basic XXXXXXX"}
-client = Client(host='base_url', request_headers=global_headers)
-query_params={"hello":0, "world":1}
-request_headers={"X-Test": "test"}
-data={"some": 1, "awesome": 2, "data": 3}
-response = client.your.api._(param).call.post(request_body=data,
- query_params=query_params,
- request_headers=request_headers)
-print response.status_code
-print response.headers
-print response.body
-```
-
-
-# Usage
-
-- [Example Code](https://github.com/sendgrid/python-http-client/tree/master/examples)
-
-
-# Roadmap
-
-If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/python-http-client/milestones). We would love to hear your feedback.
-
-
-# How to Contribute
-
-We encourage contribution to our projects, please see our [CONTRIBUTING](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md) guide for details.
-
-Quick links:
-
-- [Feature Request](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#feature-request)
-- [Bug Reports](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report)
-- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#cla)
-- [Improvements to the Codebase](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase)
-- [Review Pull Requests](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#code-reviews)
-
-
-
-# Local Setup of the project
-
-The simplest local development workflow is by using docker.
-
-> Steps
-
-1. Install Docker
-2. Run `docker-compose build` (This builds the container)
-3. Run `docker-compose up` (This runs tests by default)
-
-
-# Troubleshooting
-
-Please see our [troubleshooting guide](https://github.com/sendgrid/python-http-client/blob/master/TROUBLESHOOTING.md) for any issues.
-
-
-# Announcements
-
-All updates to this project is documented in our [CHANGELOG](https://github.com/sendgrid/python-http-client/blob/master/CHANGELOG.md).
-
-
-# Thanks
-
-We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient).
-
-
-# About
-
-python-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
-
-python-http-client is maintained and funded by SendGrid, Inc. The names and logos for python-http-client are trademarks of SendGrid, Inc.
-
-
-# License
-
-[The MIT License (MIT)](LICENSE.txt)
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e98987e
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,187 @@
+.. image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
+ :target: https://www.sendgrid.com
+
+|Build Status| |Email Notifications Badge| |Twitter Follow| |Codecov branch| |Code Climate| |Python Versions| |PyPI Version| |GitHub contributors| |MIT licensed|
+
+**Quickly and easily access any RESTful or RESTful-like API.**
+
+If you are looking for the SendGrid API client library, please see `this repo`_.
+
+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>`__
+- `Troubleshooting <#troubleshooting>`__
+- `Announcements <#announcements>`__
+- `Thanks <#thanks>`__
+- `About <#about>`__
+- `License <#license>`__
+
+Installation
+============
+
+Prerequisites
+-------------
+
+- Python version 2.7 or 3.4+
+
+Install Package
+---------------
+
+.. code:: bash
+
+ pip install python_http_client
+
+or
+
+.. code:: bash
+
+ easy_install python_http_client
+
+API Key
+-------
+
+Store your SendGrid API key in a ``.env`` file.
+
+.. code:: bash
+
+ cp .env_sample .env
+
+Edit the ``.env`` file and add your API key.
+
+Quick Start
+===========
+
+Here is a quick example:
+
+``GET /your/api/{param}/call``
+
+.. code:: python
+
+ import python_http_client
+
+ global_headers = {"Authorization": "Basic XXXXXXX"}
+ client = Client(host='base_url', request_headers=global_headers)
+ client.your.api._(param).call.get()
+ print(response.status_code)
+ print(response.headers)
+ print(response.body)
+
+``POST /your/api/{param}/call`` with headers, query parameters and a request body with versioning.
+
+.. code:: python
+
+ import python_http_client
+
+ global_headers = {"Authorization": "Basic XXXXXXX"}
+ client = Client(host='base_url', request_headers=global_headers)
+ query_params = {"hello":0, "world":1}
+ request_headers = {"X-Test": "test"}
+ data = {"some": 1, "awesome": 2, "data": 3}
+ response = client.your.api._(param).call.post(request_body=data,
+ query_params=query_params,
+ request_headers=request_headers)
+ print(response.status_code)
+ print(response.headers)
+ print(response.body)
+
+Usage
+=====
+
+- `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.
+
+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.
+
+1. Install Docker
+2. Run ``docker-compose build`` (this builds the container)
+3. Run ``docker-compose up`` (this runs tests by default)
+
+Troubleshooting
+===============
+
+Please see our `troubleshooting guide`_ for any issues.
+
+Announcements
+=============
+
+All updates to this project is documented in our `CHANGELOG`_.
+
+Thanks
+======
+
+We were inspired by the work done on `birdy`_ and `universalclient`_.
+
+About
+=====
+
+**python-http-client** is guided and supported by the SendGrid `Developer Experience Team`_.
+
+**python-http-client** is maintained and funded by SendGrid, Inc.
+The names and logos for **python-http-client** are trademarks of SendGrid, Inc.
+
+License
+=======
+
+`The MIT License (MIT)`_
+
+.. _this repo: https://github.com/sendgrid/sendgrid-python
+.. _Example Code: https://github.com/sendgrid/python-http-client/tree/master/examples
+.. _milestones: https://github.com/sendgrid/python-http-client/milestones
+.. _CONTRIBUTING: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md
+.. _Feature Request: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#feature-request
+.. _Bug Reports: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report
+.. _Sign the CLA to Create a Pull Request: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#cla
+.. _Improvements to the Codebase: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase
+.. _Review Pull Requests: https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#code-reviews
+.. _troubleshooting guide: https://github.com/sendgrid/python-http-client/blob/master/TROUBLESHOOTING.md
+.. _CHANGELOG: https://github.com/sendgrid/python-http-client/blob/master/CHANGELOG.md
+.. _birdy: https://github.com/inueni/birdy
+.. _universalclient: https://github.com/dgreisen/universalclient
+.. _Developer Experience Team: mailto:dx@sendgrid.com
+.. _The MIT License (MIT): https://github.com/sendgrid/python-http-client/blob/master/LICENSE.txt
+
+.. |Build Status| image:: https://travis-ci.org/sendgrid/python-http-client.svg?branch=master
+ :target: https://travis-ci.org/sendgrid/python-http-client
+.. |Email Notifications Badge| image:: https://dx.sendgrid.com/badge/python
+ :target: https://dx.sendgrid.com/newsletter/python
+.. |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/python-http-client/master.svg?style=flat-square&label=Codecov+Coverage
+ :target: https://codecov.io/gh/sendgrid/python-http-client
+.. |Code Climate| image:: https://codeclimate.com/github/sendgrid/python-http-client/badges/gpa.svg
+ :target: https://codeclimate.com/github/sendgrid/python-http-client
+.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/python-http-client.svg
+ :target: https://pypi.org/project/python-http-client
+.. |PyPI Version| image:: https://img.shields.io/pypi/v/python-http-client.svg
+ :target: https://pypi.org/project/python-http-client
+.. |GitHub contributors| image:: https://img.shields.io/github/contributors/sendgrid/python-http-client.svg
+ :target: https://github.com/sendgrid/python-http-client/graphs/contributors
+.. |MIT licensed| image:: https://img.shields.io/badge/license-MIT-blue.svg
+ :target: https://github.com/sendgrid/python-http-client/blob/master/LICENSE.txt
diff --git a/VERSION.txt b/VERSION.txt
new file mode 100644
index 0000000..fd2a018
--- /dev/null
+++ b/VERSION.txt
@@ -0,0 +1 @@
+3.1.0
diff --git a/python_http_client/__init__.py b/python_http_client/__init__.py
index d7052b8..0d88104 100644
--- a/python_http_client/__init__.py
+++ b/python_http_client/__init__.py
@@ -1,3 +1,5 @@
+import os
+
from .client import Client # noqa
from .exceptions import ( # noqa
HTTPError,
@@ -13,3 +15,8 @@
ServiceUnavailableError,
GatewayTimeoutError
)
+
+
+dir_path = os.path.dirname(os.path.realpath(__file__))
+if os.path.isfile(os.path.join(dir_path, 'VERSION.txt')):
+ __version__ = open(os.path.join(dir_path, 'VERSION.txt')).read().strip()
diff --git a/register.py b/register.py
deleted file mode 100644
index f42994f..0000000
--- a/register.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import pypandoc
-
-
-output = pypandoc.convert('README.md', 'rst')
-
-with open('README.txt', 'w+') as f:
- f.write(output)
-
-readme_rst = open('./README.txt').read()
-
-replace = """\
-[SendGrid Logo]
-(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)"""
-
-replacement = """\
-|SendGrid Logo|
-
-.. |SendGrid Logo| image:: \
-https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
- :target: https://www.sendgrid.com"""
-
-final_text = readme_rst.replace(replace, replacement)
-with open('./README.txt', 'w') as f:
- f.write(final_text)
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 224a779..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[metadata]
-description-file = README.md
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 9b6cbc6..2214330 100755
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,18 @@
+import io
import os
-from setuptools import setup
+from distutils.file_util import copy_file
+from setuptools import find_packages, setup
-long_description = 'Please see our GitHub README'
-if os.path.exists('README.txt'):
- long_description = open('README.txt').read()
+dir_path = os.path.abspath(os.path.dirname(__file__))
+readme = io.open(os.path.join(dir_path, 'README.rst'), encoding='utf-8').read()
+version = io.open(os.path.join(dir_path, 'VERSION.txt'), encoding='utf-8').read().strip()
+base_url = 'https://github.com/sendgrid/'
+copy_file(os.path.join(dir_path, 'VERSION.txt'),
+ os.path.join(dir_path, 'python_http_client', 'VERSION.txt'),
+ verbose=0)
-base_url = 'https://github.com/sendgrid/'
-version = '3.1.0'
setup(
name='python_http_client',
version=version,
@@ -16,10 +20,11 @@
author_email='dx@sendgrid.com',
url='{}python-http-client'.format(base_url),
download_url='{}python-http-client/tarball/{}'.format(base_url, version),
- packages=['python_http_client'],
+ packages=find_packages(),
+ include_package_data=True,
license='MIT',
description='HTTP REST client, simplified for Python',
- long_description=long_description,
+ long_description=readme,
keywords=[
'REST',
'HTTP',
diff --git a/tests/test_repofiles.py b/tests/test_repofiles.py
index 733f7d5..9837b10 100644
--- a/tests/test_repofiles.py
+++ b/tests/test_repofiles.py
@@ -16,9 +16,10 @@ class RepoFiles(unittest.TestCase):
['./.github/ISSUE_TEMPLATE'],
['./LICENSE.md', './LICENSE.txt'],
['./.github/PULL_REQUEST_TEMPLATE'],
- ['./README.md'],
+ ['./README.rst'],
['./TROUBLESHOOTING.md'],
- ['./USAGE.md']
+ ['./USAGE.md'],
+ ['./VERSION.txt']
]
def _all_file(self, files):